Patch 8.2.0147
Problem: Block Visual mode operators not correct when 'linebreak' set.
Solution: Set w_p_lbr to lbr_saved more often. (Ken Takata, closes #5524)
Files: src/ops.c, src/testdir/test_listlbr.vim
*** ../vim-8.2.0146/src/ops.c 2019-12-30 20:42:35.377103372 +0100
--- src/ops.c 2020-01-23 20:52:56.492994161 +0100
***************
*** 2744,2750 ****
--- 2744,2755 ----
char_u *line;
char_u *prev_pstart;
char_u *prev_pend;
+ #ifdef FEAT_LINEBREAK
+ int lbr_saved = curwin->w_p_lbr;
+ // Avoid a problem with unwanted linebreaks in block mode.
+ curwin->w_p_lbr = FALSE;
+ #endif
bdp->startspaces = 0;
bdp->endspaces = 0;
bdp->textlen = 0;
***************
*** 2863,2868 ****
--- 2868,2876 ----
}
bdp->textcol = (colnr_T) (pstart - line);
bdp->textstart = pstart;
+ #ifdef FEAT_LINEBREAK
+ curwin->w_p_lbr = lbr_saved;
+ #endif
}
/*
***************
*** 4556,4566 ****
#ifdef FEAT_LINEBREAK
// Restore linebreak, so that when the user edits it looks as
// before.
! if (curwin->w_p_lbr != lbr_saved)
! {
! curwin->w_p_lbr = lbr_saved;
! get_op_vcol(oap, redo_VIsual_mode, FALSE);
! }
#endif
// Reset finish_op now, don't want it set inside edit().
finish_op = FALSE;
--- 4564,4570 ----
#ifdef FEAT_LINEBREAK
// Restore linebreak, so that when the user edits it looks as
// before.
! curwin->w_p_lbr = lbr_saved;
#endif
// Reset finish_op now, don't want it set inside edit().
finish_op = FALSE;
***************
*** 4663,4673 ****
#ifdef FEAT_LINEBREAK
// Restore linebreak, so that when the user edits it looks as
// before.
! if (curwin->w_p_lbr != lbr_saved)
! {
! curwin->w_p_lbr = lbr_saved;
! get_op_vcol(oap, redo_VIsual_mode, FALSE);
! }
#endif
op_insert(oap, cap->count1);
#ifdef FEAT_LINEBREAK
--- 4667,4673 ----
#ifdef FEAT_LINEBREAK
// Restore linebreak, so that when the user edits it looks as
// before.
! curwin->w_p_lbr = lbr_saved;
#endif
op_insert(oap, cap->count1);
#ifdef FEAT_LINEBREAK
***************
*** 4698,4708 ****
#ifdef FEAT_LINEBREAK
// Restore linebreak, so that when the user edits it looks as
// before.
! if (curwin->w_p_lbr != lbr_saved)
! {
! curwin->w_p_lbr = lbr_saved;
! get_op_vcol(oap, redo_VIsual_mode, FALSE);
! }
#endif
op_replace(oap, cap->nchar);
}
--- 4698,4704 ----
#ifdef FEAT_LINEBREAK
// Restore linebreak, so that when the user edits it looks as
// before.
! curwin->w_p_lbr = lbr_saved;
#endif
op_replace(oap, cap->nchar);
}
*** ../vim-8.2.0146/src/testdir/test_listlbr.vim 2019-06-15
17:34:34.000000000 +0200
--- src/testdir/test_listlbr.vim 2020-01-23 20:52:56.492994161 +0100
***************
*** 100,105 ****
--- 100,136 ----
call s:close_windows()
endfunc
+ func Test_linebreak_with_visual_operations()
+ call s:test_windows()
+ let line = '1234567890 2234567890 3234567890'
+ call setline(1, line)
+
+ " yank
+ exec "norm! ^w\<C-V>ey"
+ call assert_equal('2234567890', @@)
+ exec "norm! w\<C-V>ey"
+ call assert_equal('3234567890', @@)
+
+ " increment / decrement
+ exec "norm! ^w\<C-V>\<C-A>w\<C-V>\<C-X>"
+ call assert_equal('1234567890 3234567890 2234567890', getline(1))
+
+ " replace
+ exec "norm! ^w\<C-V>3lraw\<C-V>3lrb"
+ call assert_equal('1234567890 aaaa567890 bbbb567890', getline(1))
+
+ " tilde
+ exec "norm! ^w\<C-V>2l~w\<C-V>2l~"
+ call assert_equal('1234567890 AAAa567890 BBBb567890', getline(1))
+
+ " delete and insert
+ exec "norm! ^w\<C-V>3lc2345\<Esc>w\<C-V>3lc3456\<Esc>"
+ call assert_equal('1234567890 2345567890 3456567890', getline(1))
+ call assert_equal('BBBb', @@)
+
+ call s:close_windows()
+ endfunc
+
func Test_virtual_block()
call s:test_windows('setl sbr=+')
call setline(1, [
*** ../vim-8.2.0146/src/version.c 2020-01-23 19:59:16.285588199 +0100
--- src/version.c 2020-01-23 20:56:24.812170401 +0100
***************
*** 744,745 ****
--- 744,747 ----
{ /* Add new patch number below this line */
+ /**/
+ 147,
/**/
--
If you had to identify, in one word, the reason why the
human race has not achieved, and never will achieve, its
full potential, that word would be "meetings."
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202001231958.00NJwY7w014861%40masaka.moolenaar.net.