summaryrefslogtreecommitdiff
path: root/src/ops.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-01-23 20:58:09 +0100
committerBram Moolenaar <Bram@vim.org>2020-01-23 20:58:09 +0100
commit03c3bd9fd094c1aede2e8fe3ad8fd25b9f033053 (patch)
tree82016d614bb0ec98bae2e7eb52621355b8d3836d /src/ops.c
parentdfede9a70b3136988a8f262742101ad5cb98f46d (diff)
downloadvim-git-03c3bd9fd094c1aede2e8fe3ad8fd25b9f033053.tar.gz
patch 8.2.0147: block Visual mode operators not correct when 'linebreak' setv8.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)
Diffstat (limited to 'src/ops.c')
-rw-r--r--src/ops.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/src/ops.c b/src/ops.c
index 28e97577f..b412b8a5b 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -2744,7 +2744,12 @@ block_prep(
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,6 +2868,9 @@ block_prep(
}
bdp->textcol = (colnr_T) (pstart - line);
bdp->textstart = pstart;
+#ifdef FEAT_LINEBREAK
+ curwin->w_p_lbr = lbr_saved;
+#endif
}
/*
@@ -4556,11 +4564,7 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank)
#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);
- }
+ curwin->w_p_lbr = lbr_saved;
#endif
// Reset finish_op now, don't want it set inside edit().
finish_op = FALSE;
@@ -4663,11 +4667,7 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank)
#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);
- }
+ curwin->w_p_lbr = lbr_saved;
#endif
op_insert(oap, cap->count1);
#ifdef FEAT_LINEBREAK
@@ -4698,11 +4698,7 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank)
#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);
- }
+ curwin->w_p_lbr = lbr_saved;
#endif
op_replace(oap, cap->nchar);
}