mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
vim-patch:9.0.0259: crash with mouse click when not initialized (#21282)
Problem: Crash with mouse click when not initialized.
Solution: Check TabPageIdxs[] is not NULL.
80525751c5
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
@@ -467,6 +467,7 @@ bool do_mouse(oparg_T *oap, int c, int dir, long count, bool fixindent)
|
||||
|
||||
start_visual.lnum = 0;
|
||||
|
||||
if (tab_page_click_defs != NULL) { // only when initialized
|
||||
// Check for clicking in the tab page line.
|
||||
if (mouse_grid <= 1 && mouse_row == 0 && firstwin->w_winrow > 0) {
|
||||
if (is_drag) {
|
||||
@@ -528,6 +529,7 @@ bool do_mouse(oparg_T *oap, int c, int dir, long count, bool fixindent)
|
||||
move_tab_to_mouse();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// When 'mousemodel' is "popup" or "popup_setpos", translate mouse events:
|
||||
// right button up -> pop-up menu
|
||||
|
@@ -147,4 +147,18 @@ func Test_tabline_20_format_items_no_overrun()
|
||||
set showtabline& tabline&
|
||||
endfunc
|
||||
|
||||
func Test_mouse_click_in_tab()
|
||||
" This used to crash because TabPageIdxs[] was not initialized
|
||||
let lines =<< trim END
|
||||
tabnew
|
||||
set mouse=a
|
||||
exe "norm \<LeftMouse>"
|
||||
END
|
||||
call writefile(lines, 'Xclickscript')
|
||||
call RunVim([], [], "-e -s -S Xclickscript -c qa")
|
||||
|
||||
call delete('Xclickscript')
|
||||
endfunc
|
||||
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
Reference in New Issue
Block a user