diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2023-11-29 21:52:58 +0000 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2023-11-29 21:52:58 +0000 |
commit | 931bffbda3668ddc609fc1da8f9eb576b170aa52 (patch) | |
tree | d8c1843a95da5ea0bb4acc09f7e37843d9995c86 /test/functional/terminal/mouse_spec.lua | |
parent | 142d9041391780ac15b89886a54015fdc5c73995 (diff) | |
parent | 4a8bf24ac690004aedf5540fa440e788459e5e34 (diff) | |
download | rneovim-userreg.tar.gz rneovim-userreg.tar.bz2 rneovim-userreg.zip |
Merge remote-tracking branch 'upstream/master' into userreguserreg
Diffstat (limited to 'test/functional/terminal/mouse_spec.lua')
-rw-r--r-- | test/functional/terminal/mouse_spec.lua | 78 |
1 files changed, 55 insertions, 23 deletions
diff --git a/test/functional/terminal/mouse_spec.lua b/test/functional/terminal/mouse_spec.lua index 50c8f5e7df..3291a38e03 100644 --- a/test/functional/terminal/mouse_spec.lua +++ b/test/functional/terminal/mouse_spec.lua @@ -11,7 +11,7 @@ describe(':terminal mouse', function() before_each(function() clear() - nvim('set_option', 'statusline', '==========') + nvim('set_option_value', 'statusline', '==========', {}) command('highlight StatusLine cterm=NONE') command('highlight StatusLineNC cterm=NONE') command('highlight VertSplit cterm=NONE') @@ -67,9 +67,23 @@ describe(':terminal mouse', function() eq('nt', eval('mode(1)')) end) - it('does not leave terminal mode on left-release', function() - skip(is_os('win')) - feed('<LeftRelease>') + it('will not exit focus on left-release', function() + eq('t', eval('mode(1)')) + feed('<LeftRelease><0,0>') + eq('t', eval('mode(1)')) + command('setlocal number') + eq('t', eval('mode(1)')) + feed('<LeftRelease><0,0>') + eq('t', eval('mode(1)')) + end) + + it('will not exit focus on mouse movement', function() + eq('t', eval('mode(1)')) + feed('<MouseMove><0,0>') + eq('t', eval('mode(1)')) + command('setlocal number') + eq('t', eval('mode(1)')) + feed('<MouseMove><0,0>') eq('t', eval('mode(1)')) end) @@ -232,7 +246,6 @@ describe(':terminal mouse', function() end) describe('with a split window and other buffer', function() - skip(is_os('win')) before_each(function() feed('<c-\\><c-n>:vsp<cr>') screen:expect([[ @@ -289,7 +302,7 @@ describe(':terminal mouse', function() ]]) end) - it("won't lose focus if another window is scrolled", function() + it("scrolling another window keeps focus and respects 'mousescroll'", function() feed('<ScrollWheelUp><4,0><ScrollWheelUp><4,0>') screen:expect([[ {7: 21 }line │line30 | @@ -310,22 +323,8 @@ describe(':terminal mouse', function() ========== ========== | {3:-- TERMINAL --} | ]]) - end) - - it("scrolling another window respects 'mousescroll'", function() - command('set mousescroll=ver:1') - feed('<ScrollWheelUp><4,0>') - screen:expect([[ - {7: 26 }line │line30 | - {7: 27 }line │rows: 5, cols: 25 | - {7: 28 }line │rows: 5, cols: 24 | - {7: 29 }line │mouse enabled | - {7: 30 }line │{1: } | - ========== ========== | - {3:-- TERMINAL --} | - ]]) command('set mousescroll=ver:10') - feed('<ScrollWheelUp><4,0>') + feed('<ScrollWheelUp><0,0>') screen:expect([[ {7: 16 }line │line30 | {7: 17 }line │rows: 5, cols: 25 | @@ -336,8 +335,41 @@ describe(':terminal mouse', function() {3:-- TERMINAL --} | ]]) command('set mousescroll=ver:0') - feed('<ScrollWheelUp><4,0>') + feed('<ScrollWheelUp><0,0>') screen:expect_unchanged() + feed([[<C-\><C-N><C-W>w]]) + command('setlocal nowrap') + feed('0<C-V>gg3ly$4p<C-W>wi') + screen:expect([[ + {7: 1 }linelinelinelineline │line30 | + {7: 2 }linelinelinelineline │rows: 5, cols: 25 | + {7: 3 }linelinelinelineline │rows: 5, cols: 24 | + {7: 4 }linelinelinelineline │mouse enabled | + {7: 5 }linelinelinelineline │{1: } | + ========== ========== | + {3:-- TERMINAL --} | + ]]) + feed('<ScrollWheelRight><4,0>') + screen:expect([[ + {7: 1 }nelinelineline │line30 | + {7: 2 }nelinelineline │rows: 5, cols: 25 | + {7: 3 }nelinelineline │rows: 5, cols: 24 | + {7: 4 }nelinelineline │mouse enabled | + {7: 5 }nelinelineline │{1: } | + ========== ========== | + {3:-- TERMINAL --} | + ]]) + command('set mousescroll=hor:4') + feed('<ScrollWheelLeft><4,0>') + screen:expect([[ + {7: 1 }nelinelinelineline │line30 | + {7: 2 }nelinelinelineline │rows: 5, cols: 25 | + {7: 3 }nelinelinelineline │rows: 5, cols: 24 | + {7: 4 }nelinelinelineline │mouse enabled | + {7: 5 }nelinelinelineline │{1: } | + ========== ========== | + {3:-- TERMINAL --} | + ]]) end) it('will lose focus if another window is clicked', function() @@ -354,7 +386,7 @@ describe(':terminal mouse', function() end) it('handles terminal size when switching buffers', function() - nvim('set_option', 'hidden', true) + nvim('set_option_value', 'hidden', true, {}) feed('<c-\\><c-n><c-w><c-w>') screen:expect([[ {7: 27 }line │line30 | |