diff options
author | bfredl <bjorn.linse@gmail.com> | 2023-09-20 11:11:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-20 11:11:52 +0200 |
commit | 351dda5e26313f88edea2a01b687f12f4fd1c790 (patch) | |
tree | 0ce9ad86bbc9b4647c27a8aa79c8858e6efbb568 | |
parent | b6ef938c663bc930a42bf1b15d7e97efcd4904b6 (diff) | |
parent | 592bc831ce4b70294a1348fe29396d8cd524b3ed (diff) | |
download | rneovim-351dda5e26313f88edea2a01b687f12f4fd1c790.tar.gz rneovim-351dda5e26313f88edea2a01b687f12f4fd1c790.tar.bz2 rneovim-351dda5e26313f88edea2a01b687f12f4fd1c790.zip |
Merge pull request #25244 from jedrzejboczar/fix-cursor-jump-win-separators
fix: avoid ui_grid_cursor_goto when drawing window separators
-rw-r--r-- | src/nvim/drawscreen.c | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/src/nvim/drawscreen.c b/src/nvim/drawscreen.c index e3e9fc8170..681a5e2a02 100644 --- a/src/nvim/drawscreen.c +++ b/src/nvim/drawscreen.c @@ -1358,21 +1358,35 @@ static void draw_sep_connectors_win(win_T *wp) win_at_left = frp->fr_parent == NULL; // Draw the appropriate separator connector in every corner where drawing them is necessary - if (!(win_at_top || win_at_left)) { - grid_putchar(&default_grid, get_corner_sep_connector(wp, WC_TOP_LEFT), - wp->w_winrow - 1, wp->w_wincol - 1, hl); - } - if (!(win_at_top || win_at_right)) { - grid_putchar(&default_grid, get_corner_sep_connector(wp, WC_TOP_RIGHT), - wp->w_winrow - 1, W_ENDCOL(wp), hl); - } - if (!(win_at_bottom || win_at_left)) { - grid_putchar(&default_grid, get_corner_sep_connector(wp, WC_BOTTOM_LEFT), - W_ENDROW(wp), wp->w_wincol - 1, hl); + // Make sure not to send cursor position updates to ui. + bool top_left = !(win_at_top || win_at_left); + bool top_right = !(win_at_top || win_at_right); + bool bot_left = !(win_at_bottom || win_at_left); + bool bot_right = !(win_at_bottom || win_at_right); + + if (top_left || top_right) { + grid_puts_line_start(&default_grid, wp->w_winrow - 1); + if (top_left) { + grid_putchar(&default_grid, get_corner_sep_connector(wp, WC_TOP_LEFT), + wp->w_winrow - 1, wp->w_wincol - 1, hl); + } + if (top_right) { + grid_putchar(&default_grid, get_corner_sep_connector(wp, WC_TOP_RIGHT), + wp->w_winrow - 1, W_ENDCOL(wp), hl); + } + grid_puts_line_flush(false); } - if (!(win_at_bottom || win_at_right)) { - grid_putchar(&default_grid, get_corner_sep_connector(wp, WC_BOTTOM_RIGHT), - W_ENDROW(wp), W_ENDCOL(wp), hl); + if (bot_left || bot_right) { + grid_puts_line_start(&default_grid, W_ENDROW(wp)); + if (bot_left) { + grid_putchar(&default_grid, get_corner_sep_connector(wp, WC_BOTTOM_LEFT), + W_ENDROW(wp), wp->w_wincol - 1, hl); + } + if (bot_right) { + grid_putchar(&default_grid, get_corner_sep_connector(wp, WC_BOTTOM_RIGHT), + W_ENDROW(wp), W_ENDCOL(wp), hl); + } + grid_puts_line_flush(false); } } |