summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-08-05 19:34:47 +0200
committerBram Moolenaar <Bram@vim.org>2017-08-05 19:34:47 +0200
commit98fd66d311a62133c835307dc7692763dfa32c69 (patch)
tree478b884a33d599ca23ff69f50bdb4a5afe4144f4
parent086d535f775da1abc557f5f28d101ff3308dc18f (diff)
patch 8.0.0872: no mouse scroll with a terminal windowv8.0.0872
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.
-rw-r--r--src/normal.c5
-rw-r--r--src/proto/terminal.pro1
-rw-r--r--src/terminal.c10
-rw-r--r--src/version.c2
4 files changed, 15 insertions, 3 deletions
diff --git a/src/normal.c b/src/normal.c
index 16f9f0ea5a..25ab2d345c 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -4638,6 +4638,11 @@ nv_mousescroll(cmdarg_T *cap)
if (cap->arg == MSCR_UP || cap->arg == MSCR_DOWN)
{
+# ifdef FEAT_TERMINAL
+ if (term_use_loop())
+ send_keys_to_term(curbuf->b_term, cap->cmdchar, TRUE);
+ else
+# endif
if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL))
{
(void)onepage(cap->arg ? FORWARD : BACKWARD, 1L);
diff --git a/src/proto/terminal.pro b/src/proto/terminal.pro
index 157b6aaafb..b6c27ed0b6 100644
--- a/src/proto/terminal.pro
+++ b/src/proto/terminal.pro
@@ -5,6 +5,7 @@ void write_to_term(buf_T *buffer, char_u *msg, channel_T *channel);
int term_job_running(term_T *term);
int term_in_terminal_mode(void);
void term_leave_terminal_mode(void);
+int send_keys_to_term(term_T *term, int c, int typed);
int term_use_loop(void);
int terminal_loop(void);
void term_job_ended(job_T *job);
diff --git a/src/terminal.c b/src/terminal.c
index 0f5382bacd..20c927248a 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -37,7 +37,6 @@
*
* TODO:
* - MS-Windows: no redraw for 'updatetime' #1915
- * - mouse scroll: when over other window, scroll that window.
* - add argument to term_wait() for waiting time.
* - For the scrollback buffer store lines in the buffer, only attributes in
* tl_scrollback.
@@ -909,7 +908,7 @@ term_vgetc()
* Return FAIL when the key needs to be handled in Normal mode.
* Return OK when the key was dropped or sent to the terminal.
*/
- static int
+ int
send_keys_to_term(term_T *term, int c, int typed)
{
char msg[KEY_BUF_LEN];
@@ -948,13 +947,18 @@ send_keys_to_term(term_T *term, int c, int typed)
case K_X1RELEASE:
case K_X2MOUSE:
case K_X2RELEASE:
+
+ case K_MOUSEUP:
+ case K_MOUSEDOWN:
+ case K_MOUSELEFT:
+ case K_MOUSERIGHT:
if (mouse_row < W_WINROW(curwin)
|| mouse_row >= (W_WINROW(curwin) + curwin->w_height)
|| mouse_col < W_WINCOL(curwin)
|| mouse_col >= W_ENDCOL(curwin)
|| dragging_outside)
{
- /* click outside the current window */
+ /* click or scroll outside the current window */
if (typed)
{
stuffcharReadbuff(c);
diff --git a/src/version.c b/src/version.c
index 758ea20598..b3f3eb5253 100644
--- a/src/version.c
+++ b/src/version.c
@@ -770,6 +770,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 872,
+/**/
871,
/**/
870,