diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2018-08-06 19:16:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-06 19:16:42 +0200 |
commit | 1593ee7cf21f77168531c959fa9e73933b502d2e (patch) | |
tree | 2c2991996429def33fc192009cc408f809c6e687 /src/nvim/mouse.c | |
parent | 3aca372ac88b4864c2da00780c01f207bdc58435 (diff) | |
parent | 41dbb69a85302e9af5c8b76e0d8217ad7d197f8a (diff) | |
download | rneovim-1593ee7cf21f77168531c959fa9e73933b502d2e.tar.gz rneovim-1593ee7cf21f77168531c959fa9e73933b502d2e.tar.bz2 rneovim-1593ee7cf21f77168531c959fa9e73933b502d2e.zip |
Merge #8820 from janlazo/vim-8.0.0671
Diffstat (limited to 'src/nvim/mouse.c')
-rw-r--r-- | src/nvim/mouse.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/nvim/mouse.c b/src/nvim/mouse.c index 8c615f52e7..3c792326a4 100644 --- a/src/nvim/mouse.c +++ b/src/nvim/mouse.c @@ -125,6 +125,9 @@ retnomove: // find the window where the row is in wp = mouse_find_win(&row, &col); + if (wp == NULL) { + return IN_UNKNOWN; + } dragwin = NULL; // winpos and height may change in win_enter()! if (row >= wp->w_height) { // In (or below) status line @@ -427,6 +430,7 @@ bool mouse_comp_pos(win_T *win, int *rowp, int *colp, linenr_T *lnump) // Find the window at screen position "*rowp" and "*colp". The positions are // updated to become relative to the top-left of the window. +// Returns NULL when something is wrong. win_T *mouse_find_win(int *rowp, int *colp) { frame_T *fp; @@ -450,7 +454,14 @@ win_T *mouse_find_win(int *rowp, int *colp) } } } - return fp->fr_win; + // When using a timer that closes a window the window might not actually + // exist. + FOR_ALL_WINDOWS_IN_TAB(wp, curtab) { + if (wp == fp->fr_win) { + return wp; + } + } + return NULL; } /* |