From 937e54f86599ab448e6497955e2b4dddf6347e88 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 27 Feb 2017 03:10:55 +0100 Subject: terminal: Keep cursor position. Let the terminal dictate the normal-mode cursor position. This will be disorienting sometimes, but it is closer to what users expect vs always going to the last line. --- test/functional/terminal/mouse_spec.lua | 38 +++++++++++---------------------- 1 file changed, 12 insertions(+), 26 deletions(-) (limited to 'test/functional/terminal/mouse_spec.lua') diff --git a/test/functional/terminal/mouse_spec.lua b/test/functional/terminal/mouse_spec.lua index da7e1c36db..9239c2ad31 100644 --- a/test/functional/terminal/mouse_spec.lua +++ b/test/functional/terminal/mouse_spec.lua @@ -1,6 +1,6 @@ local helpers = require('test.functional.helpers')(after_each) local thelpers = require('test.functional.terminal.helpers') -local clear = helpers.clear +local clear, eq, eval = helpers.clear, helpers.eq, helpers.eval local feed, nvim = helpers.feed, helpers.nvim local feed_data = thelpers.feed_data @@ -38,31 +38,17 @@ describe('terminal mouse', function() end) describe('when the terminal has focus', function() - it('will exit focus when scrolled', function() - feed('<0,0>') - screen:expect([[ - line23 | - line24 | - line25 | - line26 | - line27 | - ^line28 | - | - ]]) + it('will exit focus on mouse-scroll', function() + eq('t', eval('mode()')) + feed('<0,0>') + eq('n', eval('mode()')) end) - it('will exit focus after , then scrolled', function() + it('will exit focus on + mouse-scroll', function() + eq('t', eval('mode()')) feed('') - feed('<0,0>') - screen:expect([[ - line23 | - line24 | - line25 | - line26 | - line27 | - ^line28 | - | - ]]) + feed('<0,0>') + eq('n', eval('mode()')) end) describe('with mouse events enabled by the program', function() @@ -94,7 +80,7 @@ describe('terminal mouse', function() end) it('will forward mouse scroll to the program', function() - feed('<0,0>') + feed('<0,0>') screen:expect([[ line27 | line28 | @@ -164,7 +150,7 @@ describe('terminal mouse', function() end) it('wont lose focus if another window is scrolled', function() - feed('<0,0><0,0>') + feed('<0,0><0,0>') screen:expect([[ {7: 21 }line |line30 | {7: 22 }line |rows: 5, cols: 25 | @@ -174,7 +160,7 @@ describe('terminal mouse', function() ========== ========== | {3:-- TERMINAL --} | ]]) - feed('<0,0>') + feed('<0,0>') screen:expect([[ {7: 26 }line |line30 | {7: 27 }line |rows: 5, cols: 25 | -- cgit