diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2015-04-28 10:09:31 -0400 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2015-04-28 10:09:31 -0400 |
commit | 7315b9d8727176a96d273e6d697e15bff83f6fba (patch) | |
tree | ef0c2f74b6ba028dab4a29540b70e4fd96d91a46 | |
parent | 2d4a6843fc60e3223665fb2b71df0145bebd4352 (diff) | |
parent | 6fb66f44161f3e5bed519f7ac20b56f0b96bd661 (diff) | |
download | rneovim-7315b9d8727176a96d273e6d697e15bff83f6fba.tar.gz rneovim-7315b9d8727176a96d273e6d697e15bff83f6fba.tar.bz2 rneovim-7315b9d8727176a96d273e6d697e15bff83f6fba.zip |
Merge pull request #2383 from mhinz/fix-left-click
Fix visual selection after left click on tabline
-rw-r--r-- | src/nvim/normal.c | 1 | ||||
-rw-r--r-- | test/functional/ui/mouse_spec.lua | 64 |
2 files changed, 65 insertions, 0 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 9462a2186e..5f4faae03c 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -2067,6 +2067,7 @@ do_mouse ( } else if (is_drag && in_tab_line) { c1 = TabPageIdxs[mouse_col]; tabpage_move(c1 <= 0 ? 9999 : c1 - 1); + in_tab_line = false; return false; } diff --git a/test/functional/ui/mouse_spec.lua b/test/functional/ui/mouse_spec.lua index f1973f60ba..30f37a7463 100644 --- a/test/functional/ui/mouse_spec.lua +++ b/test/functional/ui/mouse_spec.lua @@ -57,6 +57,33 @@ describe('Mouse input', function() ]]) end) + it('left click in tabline switches to tab', function() + local tab_attrs = { + tab = { background=Screen.colors.LightGrey, underline=true }, + sel = { bold=true }, + fill = { reverse=true } + } + execute('%delete') + insert('this is foo') + execute('silent file foo | tabnew | file bar') + insert('this is bar') + screen:expect([[ + {tab: + foo }{sel: + bar }{fill: }{tab:X}| + this is ba^r | + ~ | + ~ | + | + ]], tab_attrs) + feed('<LeftMouse><4,0>') + screen:expect([[ + {sel: + foo }{tab: + bar }{fill: }{tab:X}| + this is fo^o | + ~ | + ~ | + | + ]], tab_attrs) + end) + it('left drag changes visual selection', function() -- drag events must be preceded by a click feed('<LeftMouse><2,1>') @@ -93,6 +120,43 @@ describe('Mouse input', function() ]]) end) + it('left drag changes visual selection after tab click', function() + local tab_attrs = { + tab = { background=Screen.colors.LightGrey, underline=true }, + sel = { bold=true }, + fill = { reverse=true }, + vis = { background=Screen.colors.LightGrey } + } + execute('silent file foo | tabnew | file bar') + insert('this is bar') + execute('tabprevious') -- go to first tab + screen:expect([[ + {sel: + foo }{tab: + bar }{fill: }{tab:X}| + mouse | + support and selectio^n | + ~ | + | + ]], tab_attrs) + feed('<LeftMouse><10,0><LeftRelease>') -- go to second tab + helpers.wait() + feed('<LeftMouse><0,1>') + screen:expect([[ + {tab: + foo }{sel: + bar }{fill: }{tab:X}| + ^this is bar | + ~ | + ~ | + | + ]], tab_attrs) + feed('<LeftDrag><4,1>') + screen:expect([[ + {tab: + foo }{sel: + bar }{fill: }{tab:X}| + {vis:this}^ is bar | + ~ | + ~ | + {sel:-- VISUAL --} | + ]], tab_attrs) + end) + it('two clicks will select the word and enter VISUAL', function() feed('<LeftMouse><2,2><LeftMouse><2,2>') screen:expect([[ |