diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-04-07 15:08:01 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-04-07 15:08:01 +0100 |
commit | 8c9796085071950f9a03ca0fe116608e4f86aac2 (patch) | |
tree | 0a7ccec814f261a3ee1a30d6ab4ff67fda734d57 /src/edit.c | |
parent | 6a06940f8ae7283999c83ccdf268540220573105 (diff) |
patch 8.2.4707: redrawing could be a bit more efficientv8.2.4707
Problem: Redrawing could be a bit more efficient.
Solution: Optimize redrawing. (closes #10105)
Diffstat (limited to 'src/edit.c')
-rw-r--r-- | src/edit.c | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/src/edit.c b/src/edit.c index c52583a8b6..53e86ff18f 100644 --- a/src/edit.c +++ b/src/edit.c @@ -293,14 +293,9 @@ edit( conceal_check_cursor_line(cursor_line_was_concealed); #endif - // Need to recompute the cursor position, it might move when the cursor - // is on a TAB or special character. - // ptr2cells() treats a TAB character as double-width. - if (ptr2cells(ml_get_cursor()) > 1) - { - curwin->w_valid &= ~VALID_VIRTCOL; - curs_columns(TRUE); - } + // need to position cursor again when on a TAB + if (gchar_cursor() == TAB) + curwin->w_valid &= ~(VALID_WROW|VALID_WCOL|VALID_VIRTCOL); /* * Enable langmap or IME, indicated by 'iminsert'. @@ -3149,21 +3144,20 @@ mb_replace_pop_ins(int cc) replace_push(c); break; } + + buf[0] = c; + for (i = 1; i < n; ++i) + buf[i] = replace_pop(); + if (utf_iscomposing(utf_ptr2char(buf))) + ins_bytes_len(buf, n); else { - buf[0] = c; - for (i = 1; i < n; ++i) - buf[i] = replace_pop(); - if (utf_iscomposing(utf_ptr2char(buf))) - ins_bytes_len(buf, n); - else - { - // Not a composing char, put it back. - for (i = n - 1; i >= 0; --i) - replace_push(buf[i]); - break; - } + // Not a composing char, put it back. + for (i = n - 1; i >= 0; --i) + replace_push(buf[i]); + break; } + } } @@ -3702,8 +3696,9 @@ ins_esc( State = NORMAL; trigger_modechanged(); - // need to position cursor again (e.g. when on a TAB ) - changed_cline_bef_curs(); + // need to position cursor again when on a TAB + if (gchar_cursor() == TAB) + curwin->w_valid &= ~(VALID_WROW|VALID_WCOL|VALID_VIRTCOL); setmouse(); #ifdef CURSOR_SHAPE |