diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/normal.c | 38 | ||||
-rw-r--r-- | src/nvim/option.c | 19 | ||||
-rw-r--r-- | src/nvim/syntax.c | 3 | ||||
-rw-r--r-- | src/nvim/version.c | 6 |
4 files changed, 44 insertions, 22 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 849bc0ea7d..3cf3636e23 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -1089,8 +1089,6 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank) 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 */ @@ -1107,6 +1105,8 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank) if ((finish_op || VIsual_active ) && oap->op_type != OP_NOP) { + // Avoid a problem with unwanted linebreaks in block mode + curwin->w_p_lbr = false; oap->is_VIsual = VIsual_active; if (oap->motion_force == 'V') oap->motion_type = MLINE; @@ -1434,8 +1434,11 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank) || oap->op_type == OP_COLON || oap->op_type == OP_FUNCTION || oap->op_type == OP_FILTER) - && oap->motion_force == NUL) + && oap->motion_force == NUL) { + // Make sure redrawing is correct. + curwin->w_p_lbr = lbr_saved; redraw_curbuf_later(INVERTED); + } } } @@ -1471,8 +1474,10 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank) * 'modifiable is off or creating a fold. */ if (oap->is_VIsual && (oap->empty || !MODIFIABLE(curbuf) || oap->op_type == OP_FOLD - )) + )) { + curwin->w_p_lbr = lbr_saved; redraw_curbuf_later(INVERTED); + } /* * If the end of an operator is in column one while oap->motion_type @@ -1544,8 +1549,10 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank) vim_beep(); CancelRedo(); } - } else + } else { + curwin->w_p_lbr = lbr_saved; (void)op_yank(oap, !gui_yank); + } check_cursor_col(); break; @@ -1564,6 +1571,8 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank) else restart_edit_save = 0; restart_edit = 0; + // Restore linebreak, so that when the user edits it looks as before. + curwin->w_p_lbr = lbr_saved; /* Reset finish_op now, don't want it set inside edit(). */ finish_op = false; if (op_change(oap)) /* will call edit() */ @@ -1641,8 +1650,14 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank) restart_edit_save = restart_edit; restart_edit = 0; + // Restore linebreak, so that when the user edits it looks as before. + curwin->w_p_lbr = lbr_saved; + op_insert(oap, cap->count1); + // Reset linebreak, so that formatting works correctly. + curwin->w_p_lbr = false; + /* TODO: when inserting in several lines, should format all * the lines. */ auto_format(false, true); @@ -1657,8 +1672,11 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank) if (empty_region_error) { vim_beep(); CancelRedo(); - } else + } else { + // Restore linebreak, so that when the user edits it looks as before. + curwin->w_p_lbr = lbr_saved; op_replace(oap, cap->nchar); + } break; case OP_FOLD: @@ -1695,8 +1713,10 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank) */ if (!p_sol && oap->motion_type == MLINE && !oap->end_adjusted && (oap->op_type == OP_LSHIFT || oap->op_type == OP_RSHIFT - || oap->op_type == OP_DELETE)) + || oap->op_type == OP_DELETE)) { + curwin->w_p_lbr = false; coladvance(curwin->w_curswant = old_col); + } } else { curwin->w_cursor = old_cursor; } @@ -3379,6 +3399,10 @@ static bool nv_screengo(oparg_T *oap, int dir, long dist) width1 = curwin->w_width - col_off1; width2 = curwin->w_width - col_off2; + if (width2 == 0) { + width2 = 1; // Avoid divide by zero. + } + if (curwin->w_width != 0) { /* * Instead of sticking at the last character of the buffer line we diff --git a/src/nvim/option.c b/src/nvim/option.c index dcf02513dd..8aeeb7fe8b 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -4013,17 +4013,16 @@ did_set_string_option ( else if (varp == &p_cb) { if (opt_strings_flags(p_cb, p_cb_values, &cb_flags, TRUE) != OK) errmsg = e_invarg; - } - /* When 'spelllang' or 'spellfile' is set and there is a window for this - * buffer in which 'spell' is set load the wordlists. */ - else if (varp == &(curbuf->b_s.b_p_spl) || varp == &(curbuf->b_s.b_p_spf)) { - int l; - - if (varp == &(curbuf->b_s.b_p_spf)) { - l = (int)STRLEN(curbuf->b_s.b_p_spf); - if (l > 0 && (l < 4 || STRCMP(curbuf->b_s.b_p_spf + l - 4, - ".add") != 0)) + } else if (varp == &(curwin->w_s->b_p_spl) + || varp == &(curwin->w_s->b_p_spf)) { + // When 'spelllang' or 'spellfile' is set and there is a window for this + // buffer in which 'spell' is set load the wordlists. + if (varp == &(curwin->w_s->b_p_spf)) { + int l = (int)STRLEN(curwin->w_s->b_p_spf); + if (l > 0 + && (l < 4 || STRCMP(curwin->w_s->b_p_spf + l - 4, ".add") != 0)) { errmsg = e_invarg; + } } if (errmsg == NULL) { diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index ec54887246..0bee42c4a9 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -5404,11 +5404,10 @@ void ex_ownsyntax(exarg_T *eap) if (curwin->w_s == &curwin->w_buffer->b_s) { curwin->w_s = xmalloc(sizeof(synblock_T)); memset(curwin->w_s, 0, sizeof(synblock_T)); + // TODO: Keep the spell checking as it was. curwin->w_p_spell = FALSE; /* No spell checking */ clear_string_option(&curwin->w_s->b_p_spc); clear_string_option(&curwin->w_s->b_p_spf); - vim_regfree(curwin->w_s->b_cap_prog); - curwin->w_s->b_cap_prog = NULL; clear_string_option(&curwin->w_s->b_p_spl); } diff --git a/src/nvim/version.c b/src/nvim/version.c index e80b653c00..ce7a21a99a 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -177,7 +177,7 @@ static int included_patches[] = { //609, //608, //607, - //606, + 606, //605, //604, //603, @@ -207,7 +207,7 @@ static int included_patches[] = { //579, 578, //577, - //576, + 576, //575, 574, //573, @@ -259,7 +259,7 @@ static int included_patches[] = { 527, 526, 525, - //524, + 524, //523 NA //522 NA 521, |