diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/edit.c | 15 | ||||
-rw-r--r-- | src/nvim/indent.c | 4 | ||||
-rw-r--r-- | src/nvim/os/users.c | 2 | ||||
-rw-r--r-- | src/nvim/plines.c | 2 | ||||
-rw-r--r-- | src/nvim/regexp.c | 4 | ||||
-rw-r--r-- | src/nvim/tag.c | 18 |
6 files changed, 22 insertions, 23 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 11c5ba2628..8b8345657c 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -3838,7 +3838,7 @@ static bool ins_bs(int c, int mode, int *inserted_space_p) bool const use_ts = !curwin->w_p_list || curwin->w_p_lcs_chars.tab1; char *const line = get_cursor_line_ptr(); - char *const end_ptr = line + curwin->w_cursor.col; + char *const cursor_ptr = line + curwin->w_cursor.col; colnr_T vcol = 0; colnr_T space_vcol = 0; @@ -3846,9 +3846,10 @@ static bool ins_bs(int c, int mode, int *inserted_space_p) StrCharInfo space_sci = sci; bool prev_space = false; - // Find the last whitespace that is preceded by non-whitespace. + // Compute virtual column of cursor position, and find the last + // whitespace before cursor that is preceded by non-whitespace. // Use charsize_nowrap() so that virtual text and wrapping are ignored. - while (sci.ptr < end_ptr) { + while (sci.ptr < cursor_ptr) { bool cur_space = ascii_iswhite(sci.chr.value); if (!prev_space && cur_space) { space_sci = sci; @@ -3860,11 +3861,9 @@ static bool ins_bs(int c, int mode, int *inserted_space_p) } // Compute the virtual column where we want to be. - colnr_T want_vcol = vcol - 1; - if (want_vcol <= 0) { - want_vcol = 0; - } else if (p_sta && in_indent) { - want_vcol = want_vcol - want_vcol % get_sw_value(curbuf); + colnr_T want_vcol = vcol > 0 ? vcol - 1 : 0; + if (p_sta && in_indent) { + want_vcol -= want_vcol % get_sw_value(curbuf); } else { want_vcol = tabstop_start(want_vcol, get_sts_value(), curbuf->b_p_vsts_array); } diff --git a/src/nvim/indent.c b/src/nvim/indent.c index d477b466d7..d635c7d7bf 100644 --- a/src/nvim/indent.c +++ b/src/nvim/indent.c @@ -177,7 +177,7 @@ colnr_T tabstop_start(colnr_T col, int ts, colnr_T *vts) colnr_T tabcol = 0; if (vts == NULL || vts[0] == 0) { - return ((col / ts) * ts); + return col - col % ts; } const int tabcount = vts[0]; @@ -189,7 +189,7 @@ colnr_T tabstop_start(colnr_T col, int ts, colnr_T *vts) } const int excess = (tabcol % vts[tabcount]); - return (excess + ((col - excess) / vts[tabcount]) * vts[tabcount]); + return col - (col - excess) % vts[tabcount]; } /// Find the number of tabs and spaces necessary to get from one column diff --git a/src/nvim/os/users.c b/src/nvim/os/users.c index 8886d6068d..d5a8355470 100644 --- a/src/nvim/os/users.c +++ b/src/nvim/os/users.c @@ -203,7 +203,7 @@ static void init_users(void) os_get_usernames(&ga_users); } -/// Given to ExpandGeneric() to obtain an user names. +/// Given to ExpandGeneric() to obtain user names. char *get_users(expand_T *xp, int idx) { init_users(); diff --git a/src/nvim/plines.c b/src/nvim/plines.c index dae9de48c6..d90ee9c1ba 100644 --- a/src/nvim/plines.c +++ b/src/nvim/plines.c @@ -249,7 +249,7 @@ CharSize charsize_regular(CharsizeArg *csarg, char *const cur, colnr_T const vco } csarg->indent_width = head_mid; } - if (head_mid > 0 && wcol + size > wp->w_width_inner) { + if (head_mid > 0) { // Calculate effective window width. int prev_rem = wp->w_width_inner - wcol; int width = width2 - head_mid; diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c index 86082adbb6..08c804bca5 100644 --- a/src/nvim/regexp.c +++ b/src/nvim/regexp.c @@ -4494,7 +4494,7 @@ static uint8_t *regatom(int *flagp) n = n * 10 + (uint32_t)(c - '0'); c = getchr(); } - if (c == '\'' && n == 0) { + if (no_Magic(c) == '\'' && n == 0) { // "\%'m", "\%<'m" and "\%>'m": Mark c = getchr(); ret = regnode(RE_MARK); @@ -10218,7 +10218,7 @@ static int nfa_regatom(void) } EMIT((int)n); break; - } else if (c == '\'' && n == 0) { + } else if (no_Magic(c) == '\'' && n == 0) { // \%'m \%<'m \%>'m EMIT(cmp == '<' ? NFA_MARK_LT : cmp == '>' ? NFA_MARK_GT : NFA_MARK); diff --git a/src/nvim/tag.c b/src/nvim/tag.c index 0265d2d822..7e94a8b124 100644 --- a/src/nvim/tag.c +++ b/src/nvim/tag.c @@ -290,10 +290,6 @@ void set_buflocal_tfu_callback(buf_T *buf) /// @param verbose print "tag not found" message void do_tag(char *tag, int type, int count, int forceit, bool verbose) { - if (postponed_split == 0 && !check_can_set_curbuf_forceit(forceit)) { - return; - } - taggy_T *tagstack = curwin->w_tagstack; int tagstackidx = curwin->w_tagstackidx; int tagstacklen = curwin->w_tagstacklen; @@ -320,11 +316,6 @@ void do_tag(char *tag, int type, int count, int forceit, bool verbose) static char **matches = NULL; static int flags; - if (tfu_in_use) { - emsg(_(e_cannot_modify_tag_stack_within_tagfunc)); - return; - } - #ifdef EXITFREE if (type == DT_FREE) { // remove the list of matches @@ -334,6 +325,15 @@ void do_tag(char *tag, int type, int count, int forceit, bool verbose) } #endif + if (tfu_in_use) { + emsg(_(e_cannot_modify_tag_stack_within_tagfunc)); + return; + } + + if (postponed_split == 0 && !check_can_set_curbuf_forceit(forceit)) { + return; + } + if (type == DT_HELP) { type = DT_TAG; no_regexp = true; |