diff options
author | Bram Moolenaar <bram@vim.org> | 2015-08-11 17:46:36 +0200 |
---|---|---|
committer | Bram Moolenaar <bram@vim.org> | 2015-08-11 17:46:36 +0200 |
commit | c29361f227405acc02be01d3b6e2eee23614ae94 (patch) | |
tree | 822f1cb8e75c2b98cb8ccb8c84cac5eee6c3d727 | |
parent | 6088dcf32bcadc3db170b752a86fb418107786bf (diff) | |
download | vim-c29361f227405acc02be01d3b6e2eee23614ae94.tar.gz |
Problem: 'linebreak' breaks c% if the last Visual selection was block.
(Chris Morganiser, Issue 389)
Solution: Handle Visual block mode differently. (Christian Brabandt)
-rw-r--r-- | src/normal.c | 9 | ||||
-rw-r--r-- | src/testdir/test_listlbr.in | 7 | ||||
-rw-r--r-- | src/testdir/test_listlbr.ok | 3 | ||||
-rw-r--r-- | src/version.c | 2 |
4 files changed, 17 insertions, 4 deletions
diff --git a/src/normal.c b/src/normal.c index 309b895a..a46cc9d6 100644 --- a/src/normal.c +++ b/src/normal.c @@ -9583,20 +9583,21 @@ nv_cursorhold(cap) #endif /* - * 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(oap, redo_VIsual_vcol, initial) oparg_T *oap; colnr_T redo_VIsual_vcol; - int initial; /* when true: adjust position for 'selectmode' */ + int initial; /* when TRUE adjust position for 'selectmode' */ { colnr_T start, end; - if (VIsual_mode != Ctrl_V) + if (VIsual_mode != Ctrl_V + || (!initial && oap->end.col < W_WIDTH(curwin))) return; - oap->block_mode = TRUE; + oap->block_mode = VIsual_active; #ifdef FEAT_MBYTE /* prevent from moving onto a trail byte */ diff --git a/src/testdir/test_listlbr.in b/src/testdir/test_listlbr.in index 164f12a8..e5372d4d 100644 --- a/src/testdir/test_listlbr.in +++ b/src/testdir/test_listlbr.in @@ -80,6 +80,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/testdir/test_listlbr.ok b/src/testdir/test_listlbr.ok index 323bcdee..295a9f73 100644 --- a/src/testdir/test_listlbr.ok +++ b/src/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/version.c b/src/version.c index 177b5910..0f48baec 100644 --- a/src/version.c +++ b/src/version.c @@ -742,6 +742,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 818, +/**/ 817, /**/ 816, |