Mercurial > vim
comparison src/terminal.c @ 11983:448635f73e09 v8.0.0872
patch 8.0.0872: no mouse scroll with a terminal window
commit https://github.com/vim/vim/commit/98fd66d311a62133c835307dc7692763dfa32c69
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Aug 5 19:34:47 2017 +0200
patch 8.0.0872: no mouse scroll with a terminal window
Problem: Using mouse scroll while a terminal window has focus and the mouse
pointer is on another window does not work. Same for focus in a
non-terminal window ahd the mouse pointer is over a terminal
window.
Solution: Send the scroll action to the right window.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 05 Aug 2017 19:45:04 +0200 |
parents | 4d4ee9c5803c |
children | d036c1c8537d |
comparison
equal
deleted
inserted
replaced
11982:973099a97aed | 11983:448635f73e09 |
---|---|
35 * When the job ends the text is put in a buffer. Redrawing then happens from | 35 * When the job ends the text is put in a buffer. Redrawing then happens from |
36 * that buffer, attributes come from the scrollback buffer tl_scrollback. | 36 * that buffer, attributes come from the scrollback buffer tl_scrollback. |
37 * | 37 * |
38 * TODO: | 38 * TODO: |
39 * - MS-Windows: no redraw for 'updatetime' #1915 | 39 * - MS-Windows: no redraw for 'updatetime' #1915 |
40 * - mouse scroll: when over other window, scroll that window. | |
41 * - add argument to term_wait() for waiting time. | 40 * - add argument to term_wait() for waiting time. |
42 * - For the scrollback buffer store lines in the buffer, only attributes in | 41 * - For the scrollback buffer store lines in the buffer, only attributes in |
43 * tl_scrollback. | 42 * tl_scrollback. |
44 * - When the job ends: | 43 * - When the job ends: |
45 * - Need an option or argument to drop the window+buffer right away, to be | 44 * - Need an option or argument to drop the window+buffer right away, to be |
907 /* | 906 /* |
908 * Send keys to terminal. | 907 * Send keys to terminal. |
909 * Return FAIL when the key needs to be handled in Normal mode. | 908 * Return FAIL when the key needs to be handled in Normal mode. |
910 * Return OK when the key was dropped or sent to the terminal. | 909 * Return OK when the key was dropped or sent to the terminal. |
911 */ | 910 */ |
912 static int | 911 int |
913 send_keys_to_term(term_T *term, int c, int typed) | 912 send_keys_to_term(term_T *term, int c, int typed) |
914 { | 913 { |
915 char msg[KEY_BUF_LEN]; | 914 char msg[KEY_BUF_LEN]; |
916 size_t len; | 915 size_t len; |
917 static int mouse_was_outside = FALSE; | 916 static int mouse_was_outside = FALSE; |
946 case K_RIGHTRELEASE: | 945 case K_RIGHTRELEASE: |
947 case K_X1MOUSE: | 946 case K_X1MOUSE: |
948 case K_X1RELEASE: | 947 case K_X1RELEASE: |
949 case K_X2MOUSE: | 948 case K_X2MOUSE: |
950 case K_X2RELEASE: | 949 case K_X2RELEASE: |
950 | |
951 case K_MOUSEUP: | |
952 case K_MOUSEDOWN: | |
953 case K_MOUSELEFT: | |
954 case K_MOUSERIGHT: | |
951 if (mouse_row < W_WINROW(curwin) | 955 if (mouse_row < W_WINROW(curwin) |
952 || mouse_row >= (W_WINROW(curwin) + curwin->w_height) | 956 || mouse_row >= (W_WINROW(curwin) + curwin->w_height) |
953 || mouse_col < W_WINCOL(curwin) | 957 || mouse_col < W_WINCOL(curwin) |
954 || mouse_col >= W_ENDCOL(curwin) | 958 || mouse_col >= W_ENDCOL(curwin) |
955 || dragging_outside) | 959 || dragging_outside) |
956 { | 960 { |
957 /* click outside the current window */ | 961 /* click or scroll outside the current window */ |
958 if (typed) | 962 if (typed) |
959 { | 963 { |
960 stuffcharReadbuff(c); | 964 stuffcharReadbuff(c); |
961 mouse_was_outside = TRUE; | 965 mouse_was_outside = TRUE; |
962 } | 966 } |