diff options
author | Jonathan de Boyne Pollard <postmaster@localhost> | 2017-05-23 01:09:17 +0100 |
---|---|---|
committer | Jonathan de Boyne Pollard <J.deBoynePollard-newsgroups@NTLWorld.com> | 2017-06-03 18:53:27 +0100 |
commit | e826ec0b0ef36e48d2628b1a64226676e3c49eed (patch) | |
tree | a4532f00a1ac97dbea3103752e0f2cf0f69e3460 | |
parent | 5b07ca1dfde4d44a11e3052b552f48fe61034247 (diff) | |
download | rneovim-e826ec0b0ef36e48d2628b1a64226676e3c49eed.tar.gz rneovim-e826ec0b0ef36e48d2628b1a64226676e3c49eed.tar.bz2 rneovim-e826ec0b0ef36e48d2628b1a64226676e3c49eed.zip |
tui: Optimize more cursor motions
A slight improvement on the CR optimization for some edge cases.
-rw-r--r-- | src/nvim/tui/tui.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c index 23096725be..8f1647803f 100644 --- a/src/nvim/tui/tui.c +++ b/src/nvim/tui/tui.c @@ -446,9 +446,14 @@ static void cursor_goto(UI *ui, int row, int col) ugrid_goto(&data->grid, row, col); return; } - if (0 == col && 0 != grid->col) { + if (0 == col ? col != grid->col : + 1 == col ? 2 < grid->col && cheap_to_print(ui, grid->row, 0, col) : + 2 == col ? 5 < grid->col && cheap_to_print(ui, grid->row, 0, col) : + false) { + // Motion to left margin from anywhere else, or CR + printing chars is + // even less expensive than using BSes or CUB. unibi_out(ui, unibi_carriage_return); - ugrid_goto(&data->grid, grid->row, col); + ugrid_goto(&data->grid, grid->row, 0); } else if (col > grid->col) { int n = col - grid->col; if (n <= (row == grid->row ? 4 : 2) && cheap_to_print(ui, grid->row, grid->col, n)) { |