aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/drawscreen.c
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2023-09-19 14:30:02 +0200
committerbfredl <bjorn.linse@gmail.com>2023-10-08 15:22:45 +0200
commitddef39299f357d3131644647379e88a69749bf40 (patch)
tree617b46a628180bf4fa5cc56ba8de20b876810163 /src/nvim/drawscreen.c
parent5db076c7ccfef6732516074252ac4b21b12fc629 (diff)
downloadrneovim-ddef39299f357d3131644647379e88a69749bf40.tar.gz
rneovim-ddef39299f357d3131644647379e88a69749bf40.tar.bz2
rneovim-ddef39299f357d3131644647379e88a69749bf40.zip
refactor(grid): do arabic shaping in one place
The 'arabicshape' feature of vim is a transformation of unicode text to make arabic and some related scripts look better at display time. In particular the content of a cell will be adjusted depending on the (original) content of the cells just before and after it. This is implemented by the arabic_shape() function in nvim. Before this commit, shaping was invoked in four different contexts: - when rendering buffer text in win_line() - in line_putchar() for rendering virtual text - as part of grid_line_puts, used by messages and statuslines and similar - as part of draw_cmdline() for drawing the cmdline This replaces all these with a post-processing step in grid_put_linebuf(), which has become the entry point for all text rendering after recent refactors. An aim of this is to make the handling of multibyte text yet simpler. One of the main reasons multibyte chars needs to be "parsed" into codepoint arrays of composing chars is so that these could be inspected for the purpose of shaping. This can likely be vastly simplified in many contexts where only the total length (in bytes) and width of composed char is needed.
Diffstat (limited to 'src/nvim/drawscreen.c')
-rw-r--r--src/nvim/drawscreen.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nvim/drawscreen.c b/src/nvim/drawscreen.c
index e32a556daa..eee1348bc7 100644
--- a/src/nvim/drawscreen.c
+++ b/src/nvim/drawscreen.c
@@ -2391,10 +2391,10 @@ static void win_update(win_T *wp, DecorProviders *providers)
wp->w_botline = lnum;
} else if (dy_flags & DY_LASTLINE) { // 'display' has "lastline"
// Last line isn't finished: Display "@@@" at the end.
- // TODO(bfredl): this display ">@@@" when ">" was a left-halve
- // maybe "@@@@" is preferred when this happens.
+ // If this would split a doublewidth char in two, we need to display "@@@@" instead
grid_line_start(&wp->w_grid, wp->w_grid.rows - 1);
- grid_line_fill(MAX(wp->w_grid.cols - 3, 0), wp->w_grid.cols,
+ int width = grid_line_getchar(MAX(wp->w_grid.cols - 3, 0), NULL) == NUL ? 4 : 3;
+ grid_line_fill(MAX(wp->w_grid.cols - width, 0), wp->w_grid.cols,
wp->w_p_fcs_chars.lastline, at_attr);
grid_line_flush();
set_empty_rows(wp, srow);