mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.1.1175: no test for dragging a tab and double click for new tab
Problem: No test for dragging a tab with the mouse and for creating a new
tab by double clicking in the tabline.
Solution: Add two tests. (Dominique Pelle, closes vim/vim#4258)
e3e3828f93
Set 'mousetime' to 0 instead.
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
parent
5f710789f9
commit
a8d9f0a2d5
@ -261,6 +261,104 @@ func Test_xterm_mouse_click_X_to_close_tab()
|
|||||||
" let &ttymouse = save_ttymouse
|
" let &ttymouse = save_ttymouse
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_xterm_mouse_drag_to_move_tab()
|
||||||
|
let save_mouse = &mouse
|
||||||
|
let save_term = &term
|
||||||
|
" let save_ttymouse = &ttymouse
|
||||||
|
" Set 'mousetime' to 1 to avoid recognizing a double-click in the loop
|
||||||
|
" set mouse=a term=xterm mousetime=1
|
||||||
|
set mouse=a mousetime=0
|
||||||
|
let row = 1
|
||||||
|
|
||||||
|
for ttymouse_val in ['sgr']
|
||||||
|
" exe 'set ttymouse=' . ttymouse_val
|
||||||
|
e Xtab1
|
||||||
|
tabnew Xtab2
|
||||||
|
|
||||||
|
let a = split(execute(':tabs'), "\n")
|
||||||
|
call assert_equal(['Tab page 1',
|
||||||
|
\ '# Xtab1',
|
||||||
|
\ 'Tab page 2',
|
||||||
|
\ '> Xtab2'], a)
|
||||||
|
redraw
|
||||||
|
|
||||||
|
" Click in tab2 and drag it to tab1.
|
||||||
|
" Check getcharmod() to verify that click is not
|
||||||
|
" interpreted as a spurious double-click.
|
||||||
|
call MouseLeftClick(row, 10)
|
||||||
|
call assert_equal(0, getcharmod())
|
||||||
|
for col in [9, 8, 7, 6]
|
||||||
|
call MouseLeftDrag(row, col)
|
||||||
|
endfor
|
||||||
|
call MouseLeftRelease(row, col)
|
||||||
|
let a = split(execute(':tabs'), "\n")
|
||||||
|
call assert_equal(['Tab page 1',
|
||||||
|
\ '> Xtab2',
|
||||||
|
\ 'Tab page 2',
|
||||||
|
\ '# Xtab1'], a)
|
||||||
|
|
||||||
|
%bwipe!
|
||||||
|
endfor
|
||||||
|
|
||||||
|
let &mouse = save_mouse
|
||||||
|
" let &term = save_term
|
||||||
|
" let &ttymouse = save_ttymouse
|
||||||
|
set mousetime&
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func Test_xterm_mouse_double_click_to_create_tab()
|
||||||
|
let save_mouse = &mouse
|
||||||
|
let save_term = &term
|
||||||
|
" let save_ttymouse = &ttymouse
|
||||||
|
" Set 'mousetime' to a small value, so that double-click works but we don't
|
||||||
|
" have to wait long to avoid a triple-click.
|
||||||
|
" set mouse=a term=xterm mousetime=100
|
||||||
|
set mouse=a mousetime=100
|
||||||
|
let row = 1
|
||||||
|
let col = 10
|
||||||
|
|
||||||
|
for ttymouse_val in ['sgr']
|
||||||
|
" exe 'set ttymouse=' . ttymouse_val
|
||||||
|
e Xtab1
|
||||||
|
tabnew Xtab2
|
||||||
|
|
||||||
|
let a = split(execute(':tabs'), "\n")
|
||||||
|
call assert_equal(['Tab page 1',
|
||||||
|
\ '# Xtab1',
|
||||||
|
\ 'Tab page 2',
|
||||||
|
\ '> Xtab2'], a)
|
||||||
|
|
||||||
|
redraw
|
||||||
|
call MouseLeftClick(row, col)
|
||||||
|
" Check getcharmod() to verify that first click is not
|
||||||
|
" interpreted as a spurious double-click.
|
||||||
|
call assert_equal(0, getcharmod())
|
||||||
|
call MouseLeftRelease(row, col)
|
||||||
|
call MouseLeftClick(row, col)
|
||||||
|
call assert_equal(32, getcharmod()) " double-click
|
||||||
|
call MouseLeftRelease(row, col)
|
||||||
|
let a = split(execute(':tabs'), "\n")
|
||||||
|
call assert_equal(['Tab page 1',
|
||||||
|
\ ' Xtab1',
|
||||||
|
\ 'Tab page 2',
|
||||||
|
\ '> [No Name]',
|
||||||
|
\ 'Tab page 3',
|
||||||
|
\ '# Xtab2'], a)
|
||||||
|
|
||||||
|
if ttymouse_val !=# 'sgr'
|
||||||
|
" We need to sleep, or else MouseLeftClick() in next loop
|
||||||
|
" iteration will be interpreted as a spurious triple-click.
|
||||||
|
sleep 100m
|
||||||
|
endif
|
||||||
|
%bwipe!
|
||||||
|
endfor
|
||||||
|
|
||||||
|
let &mouse = save_mouse
|
||||||
|
" let &term = save_term
|
||||||
|
" let &ttymouse = save_ttymouse
|
||||||
|
set mousetime&
|
||||||
|
endfunc
|
||||||
|
|
||||||
" Test for translation of special key codes (<xF1>, <xF2>, etc.)
|
" Test for translation of special key codes (<xF1>, <xF2>, etc.)
|
||||||
func Test_Keycode_Translation()
|
func Test_Keycode_Translation()
|
||||||
let keycodes = [
|
let keycodes = [
|
||||||
|
Loading…
Reference in New Issue
Block a user