From 66571f64a46cba1fd54710fd7f59672cd21e2523 Mon Sep 17 00:00:00 2001 From: watiko Date: Thu, 11 Feb 2016 15:56:46 +0900 Subject: vim-patch:7.4.818 Problem: 'linebreak' breaks c% if the last Visual selection was block. (Chris Morganiser, Issue 389) Solution: Handle Visual block mode differently. (Christian Brabandt) https://github.com/vim/vim/commit/89c17c02cac7594c6bb85900d73b1dc70aa78306 --- src/nvim/normal.c | 9 ++++++--- src/nvim/testdir/test_listlbr.in | 7 +++++++ src/nvim/testdir/test_listlbr.ok | 3 +++ src/nvim/version.c | 2 +- 4 files changed, 17 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 049d650f86..d4b78b1a79 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -7782,7 +7782,7 @@ static void nv_open(cmdarg_T *cap) n_opencmd(cap); } -// calculate start/end virtual columns for operating in block mode +// Calculate start/end virtual columns for operating in block mode. static void get_op_vcol( oparg_T *oap, colnr_T redo_VIsual_vcol, @@ -7792,11 +7792,14 @@ static void get_op_vcol( colnr_T start; colnr_T end; - if (VIsual_mode != Ctrl_V) { + if (VIsual_mode != Ctrl_V + || (!initial && oap->end.col < curwin->w_width)) { return; } - oap->motion_type = MBLOCK; + if (VIsual_active) { + oap->motion_type = MBLOCK; + } // prevent from moving onto a trail byte if (has_mbyte) { diff --git a/src/nvim/testdir/test_listlbr.in b/src/nvim/testdir/test_listlbr.in index f13eee121e..9bf0086467 100644 --- a/src/nvim/testdir/test_listlbr.in +++ b/src/nvim/testdir/test_listlbr.in @@ -81,6 +81,13 @@ Go aaa aaa a2k2j~e. +:let g:test ="Test 10: using normal commands after block-visual" +:$put =g:test +:set linebreak +Go +abcd{ef +ghijklm +no}pqrs2k0f{c% :%w! test.out :qa! ENDTEST diff --git a/src/nvim/testdir/test_listlbr.ok b/src/nvim/testdir/test_listlbr.ok index 323bcdee08..295a9f7378 100644 --- a/src/nvim/testdir/test_listlbr.ok +++ b/src/nvim/testdir/test_listlbr.ok @@ -46,3 +46,6 @@ Test 9: using redo after block visual mode AaA AaA A +Test 10: using normal commands after block-visual + +abcdpqrs diff --git a/src/nvim/version.c b/src/nvim/version.c index 487f3fc27b..11c2488fa5 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -470,7 +470,7 @@ static int included_patches[] = { // 821, 820, // 819, - // 818, + 818, 817, 816, 815, -- cgit