From 35e23984417e5dfcb88c56c4301cc60e856a97cd Mon Sep 17 00:00:00 2001 From: Felipe Morales Date: Fri, 21 Nov 2014 13:14:54 -0300 Subject: vim-patch:7.4.467: Avoid a problem with unwanted linebreaks in block mode vim-patch:7.4.467 Avoid a problem with unwanted linebreaks in block mode https://code.google.com/p/vim/source/detail?r=v7-4-467 --- src/nvim/normal.c | 5 +++++ src/nvim/screen.c | 5 +++++ src/nvim/testdir/test_listlbr.in | 8 ++++++++ src/nvim/testdir/test_listlbr.ok | 4 ++++ src/nvim/version.c | 2 +- 5 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/nvim/normal.c b/src/nvim/normal.c index a2bdc05831..9ec97bd320 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -1099,6 +1099,10 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank) pos_T old_cursor; bool empty_region_error; int restart_edit_save; + int lbr_saved = curwin->w_p_lbr; + + curwin->w_p_lbr = false; /* avoid a problem with unwanted linebreaks in + * block mode */ /* The visual area is remembered for redo */ static int redo_VIsual_mode = NUL; /* 'v', 'V', or Ctrl-V */ @@ -1711,6 +1715,7 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank) oap->block_mode = false; clearop(oap); } + curwin->w_p_lbr = lbr_saved; } /* diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 58faac1ae7..164b8e7f7d 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -1205,8 +1205,13 @@ static void win_update(win_T *wp) */ if (VIsual_mode == Ctrl_V) { colnr_T fromc, toc; + int save_ve_flags = ve_flags; + + if (curwin->w_p_lbr) + ve_flags = VE_ALL; getvcols(wp, &VIsual, &curwin->w_cursor, &fromc, &toc); + ve_flags = save_ve_flags; ++toc; if (curwin->w_curswant == MAXCOL) toc = MAXCOL; diff --git a/src/nvim/testdir/test_listlbr.in b/src/nvim/testdir/test_listlbr.in index 2f28126554..75b06b4cc7 100644 --- a/src/nvim/testdir/test_listlbr.in +++ b/src/nvim/testdir/test_listlbr.in @@ -56,6 +56,14 @@ STARTTEST :syn match All /.*/ contains=ConcealVar :let line=ScreenChar(winwidth(0)) :call DoRecordScreen() +:set cpo&vim linebreak +:let g:test ="Test 6: set linebreak with visual block mode" +:let line="REMOVE: this not" +:$put =line +:let line="REMOVE: aaaaaaaaaaaaa" +:$put =line +:1/^REMOVE: +0jf x:$put :%w! test.out :qa! ENDTEST diff --git a/src/nvim/testdir/test_listlbr.ok b/src/nvim/testdir/test_listlbr.ok index 9b8037f4d3..ee74667661 100644 --- a/src/nvim/testdir/test_listlbr.ok +++ b/src/nvim/testdir/test_listlbr.ok @@ -32,3 +32,7 @@ Sabbbbbb bla ~ ~ ~ +this not +aaaaaaaaaaaaa +REMOVE: +REMOVE: diff --git a/src/nvim/version.c b/src/nvim/version.c index c692e43625..e4ad77b367 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -199,7 +199,7 @@ static int included_patches[] = { //470, //469, //468, - //467, + 467, //465, //464, //463, -- cgit