From 61e25f995c3434a159f0009d5066d284ff8aa816 Mon Sep 17 00:00:00 2001 From: KillTheMule Date: Sun, 17 Apr 2016 19:34:36 +0200 Subject: vim-patch:7.4.1296 Problem: Cursor changes column with up motion when the matchparen plugin saves and restores the cursor position. (Martin Kunev) Solution: Make sure curswant is updated before invoking the autocommand. https://github.com/vim/vim/commit/f068dcafcfe0c8018e5a559c50769ca1364bd9a5 Applied manually. Could reproduce the bug with vim/vim@4d8747c but not with vim/vim@2693ca2, so it must have appeared inbetween. For discussion, see https://groups.google.com/forum/#!msg/vim_dev/t2sdeFhkybs/WEtLJpCODQAJ http://vim.1045645.n5.nabble.com/Cursor-behaviour-change-td5726895.html Could not reproduce with current nvim master. --- src/nvim/edit.c | 3 +++ src/nvim/version.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 005c569561..26966b35c1 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -1359,6 +1359,9 @@ ins_redraw ( update_screen(0); } if (has_event(EVENT_CURSORMOVEDI)) { + // Make sure curswant is correct, an autocommand may call + // getcurpos() + update_curswant(); apply_autocmds(EVENT_CURSORMOVEDI, NULL, NULL, false, curbuf); } if (curwin->w_p_cole > 0) { diff --git a/src/nvim/version.c b/src/nvim/version.c index 51b7ae0001..1c4dcca8f7 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -382,7 +382,7 @@ static int included_patches[] = { // 1299 NA // 1298 NA // 1297 NA - // 1296, + 1296, // 1295 NA // 1294 NA // 1293 NA -- cgit From f931e78fe420884447a7a5d4e17f71a2eeeff3cd Mon Sep 17 00:00:00 2001 From: KillTheMule Date: Sun, 17 Apr 2016 20:23:30 +0200 Subject: test: matchparen_spec.lua Covers vim-patch 7.4.1296 --- test/functional/plugin/matchparen_spec.lua | 36 ++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 test/functional/plugin/matchparen_spec.lua diff --git a/test/functional/plugin/matchparen_spec.lua b/test/functional/plugin/matchparen_spec.lua new file mode 100644 index 0000000000..d8c1f2d392 --- /dev/null +++ b/test/functional/plugin/matchparen_spec.lua @@ -0,0 +1,36 @@ +local helpers = require('test.functional.helpers') +local Screen = require('test.functional.ui.screen') +local clear, feed, execute = helpers.clear, helpers.feed, helpers.execute + +describe('matchparen', function() + local screen + + before_each(function() + clear() + screen = Screen.new(20,5) + screen:attach() + screen:set_default_attr_ignore( {{bold=true, foreground=Screen.colors.Blue}} ) + end) + + it('uses correct column after i_. Vim patch 7.4.1296', function() + execute('set noai nosi nocin') + execute('runtime plugin/matchparen.vim') + feed('ivoid f_test()') + feed('{') + feed('}') + + -- critical part: up + cr should result in an empty line inbetween the + -- brackets... if the bug is there, the empty line will be before the '{' + feed('') + feed('') + + screen:expect([[ + void f_test() | + { | + ^ | + } | + {1:-- INSERT --} | + ]], {[1] = {bold = true}}) + + end) +end) -- cgit