mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.2.4707: redrawing could be a bit more efficient (#18022)
Problem: Redrawing could be a bit more efficient.
Solution: Optimize redrawing. (closes vim/vim#10105)
8c97960850
This commit is contained in:
parent
abc157a6fd
commit
1edca3872e
@ -286,9 +286,11 @@ static void changed_common(linenr_T lnum, colnr_T col, linenr_T lnume, long xtra
|
|||||||
set_topline(wp, wp->w_topline);
|
set_topline(wp, wp->w_topline);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Relative numbering may require updating more.
|
// If lines have been added or removed, relative numbering always
|
||||||
|
// requires a redraw.
|
||||||
if (wp->w_p_rnu && xtra != 0) {
|
if (wp->w_p_rnu && xtra != 0) {
|
||||||
redraw_later(wp, SOME_VALID);
|
wp->w_last_cursor_lnum_rnu = 0;
|
||||||
|
redraw_later(wp, VALID);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cursor line highlighting probably need to be updated with
|
// Cursor line highlighting probably need to be updated with
|
||||||
|
@ -390,12 +390,9 @@ static void insert_enter(InsertState *s)
|
|||||||
trigger_modechanged();
|
trigger_modechanged();
|
||||||
stop_insert_mode = false;
|
stop_insert_mode = false;
|
||||||
|
|
||||||
// Need to recompute the cursor position, it might move when the cursor
|
// need to position cursor again when on a TAB
|
||||||
// is on a TAB or special character.
|
if (gchar_cursor() == TAB) {
|
||||||
// ptr2cells() treats a TAB character as double-width.
|
curwin->w_valid &= ~(VALID_WROW|VALID_WCOL|VALID_VIRTCOL);
|
||||||
if (ptr2cells(get_cursor_pos_ptr()) > 1) {
|
|
||||||
curwin->w_valid &= ~VALID_VIRTCOL;
|
|
||||||
curs_columns(curwin, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enable langmap or IME, indicated by 'iminsert'.
|
// Enable langmap or IME, indicated by 'iminsert'.
|
||||||
@ -7330,21 +7327,21 @@ static void mb_replace_pop_ins(int cc)
|
|||||||
// Not a multi-byte char, put it back.
|
// Not a multi-byte char, put it back.
|
||||||
replace_push(c);
|
replace_push(c);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
buf[0] = c;
|
||||||
|
assert(n > 1);
|
||||||
|
for (i = 1; i < n; i++) {
|
||||||
|
buf[i] = replace_pop();
|
||||||
|
}
|
||||||
|
if (utf_iscomposing(utf_ptr2char(buf))) {
|
||||||
|
ins_bytes_len(buf, n);
|
||||||
} else {
|
} else {
|
||||||
buf[0] = c;
|
// Not a composing char, put it back.
|
||||||
assert(n > 1);
|
for (i = n - 1; i >= 0; i--) {
|
||||||
for (i = 1; i < n; i++) {
|
replace_push(buf[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;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -8054,8 +8051,10 @@ static bool ins_esc(long *count, int cmdchar, bool nomove)
|
|||||||
|
|
||||||
State = NORMAL;
|
State = NORMAL;
|
||||||
trigger_modechanged();
|
trigger_modechanged();
|
||||||
// need to position cursor again (e.g. when on a TAB )
|
// need to position cursor again when on a TAB
|
||||||
changed_cline_bef_curs();
|
if (gchar_cursor() == TAB) {
|
||||||
|
curwin->w_valid &= ~(VALID_WROW|VALID_WCOL|VALID_VIRTCOL);
|
||||||
|
}
|
||||||
|
|
||||||
setmouse();
|
setmouse();
|
||||||
ui_cursor_shape(); // may show different cursor shape
|
ui_cursor_shape(); // may show different cursor shape
|
||||||
|
@ -615,6 +615,14 @@ func Test_cursorcolumn_insert_on_tab()
|
|||||||
call TermWait(buf)
|
call TermWait(buf)
|
||||||
call VerifyScreenDump(buf, 'Test_cursorcolumn_insert_on_tab_2', {})
|
call VerifyScreenDump(buf, 'Test_cursorcolumn_insert_on_tab_2', {})
|
||||||
|
|
||||||
|
call term_sendkeys(buf, "\<C-O>")
|
||||||
|
call TermWait(buf)
|
||||||
|
call VerifyScreenDump(buf, 'Test_cursorcolumn_insert_on_tab_3', {})
|
||||||
|
|
||||||
|
call term_sendkeys(buf, 'i')
|
||||||
|
call TermWait(buf)
|
||||||
|
call VerifyScreenDump(buf, 'Test_cursorcolumn_insert_on_tab_2', {})
|
||||||
|
|
||||||
call StopVimInTerminal(buf)
|
call StopVimInTerminal(buf)
|
||||||
call delete('Xcuc_insert_on_tab')
|
call delete('Xcuc_insert_on_tab')
|
||||||
endfunc
|
endfunc
|
||||||
|
@ -1345,6 +1345,28 @@ describe('CursorColumn highlight', function()
|
|||||||
{2:~ }|
|
{2:~ }|
|
||||||
{3:-- INSERT --} |
|
{3:-- INSERT --} |
|
||||||
]])
|
]])
|
||||||
|
feed('<C-O>')
|
||||||
|
screen:expect([[
|
||||||
|
1234567{1:8}9 |
|
||||||
|
a ^ b |
|
||||||
|
{2:~ }|
|
||||||
|
{2:~ }|
|
||||||
|
{2:~ }|
|
||||||
|
{2:~ }|
|
||||||
|
{2:~ }|
|
||||||
|
{3:-- (insert) --} |
|
||||||
|
]])
|
||||||
|
feed('i')
|
||||||
|
screen:expect([[
|
||||||
|
1{1:2}3456789 |
|
||||||
|
a^ b |
|
||||||
|
{2:~ }|
|
||||||
|
{2:~ }|
|
||||||
|
{2:~ }|
|
||||||
|
{2:~ }|
|
||||||
|
{2:~ }|
|
||||||
|
{3:-- INSERT --} |
|
||||||
|
]])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('is updated if cursor is moved from timer', function()
|
it('is updated if cursor is moved from timer', function()
|
||||||
|
Loading…
Reference in New Issue
Block a user