aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/ui.c
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2023-07-03 09:53:27 +0200
committerGitHub <noreply@github.com>2023-07-03 09:53:27 +0200
commitf771d6247147b393238fe57065a96fb5e9635358 (patch)
treefa544c99d54078d46212bd665050c73593f26a2b /src/nvim/api/ui.c
parent4fd852b8cb88ed035203d3f9ae2e6a8258244974 (diff)
parent981acc2922ce9a5f214ba14acbb1e444748855f2 (diff)
downloadrneovim-f771d6247147b393238fe57065a96fb5e9635358.tar.gz
rneovim-f771d6247147b393238fe57065a96fb5e9635358.tar.bz2
rneovim-f771d6247147b393238fe57065a96fb5e9635358.zip
Merge pull request #23891 from rickyz/grid_line_flags
fix(ui): propagate line flags on grid_line events
Diffstat (limited to 'src/nvim/api/ui.c')
-rw-r--r--src/nvim/api/ui.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c
index e98c589189..861ce100cd 100644
--- a/src/nvim/api/ui.c
+++ b/src/nvim/api/ui.c
@@ -73,6 +73,11 @@ static void mpack_uint(char **buf, uint32_t val)
}
}
+static void mpack_bool(char **buf, bool val)
+{
+ mpack_w(buf, 0xc2 | val);
+}
+
static void mpack_array(char **buf, uint32_t len)
{
if (len < 0x10) {
@@ -809,7 +814,7 @@ void remote_ui_raw_line(UI *ui, Integer grid, Integer row, Integer startcol, Int
data->ncalls++;
char **buf = &data->buf_wptr;
- mpack_array(buf, 4);
+ mpack_array(buf, 5);
mpack_uint(buf, (uint32_t)grid);
mpack_uint(buf, (uint32_t)row);
mpack_uint(buf, (uint32_t)startcol);
@@ -823,17 +828,20 @@ void remote_ui_raw_line(UI *ui, Integer grid, Integer row, Integer startcol, Int
repeat++;
if (i == ncells - 1 || attrs[i] != attrs[i + 1]
|| strcmp(chunk[i], chunk[i + 1]) != 0) {
- if (UI_BUF_SIZE - BUF_POS(data) < 2 * (1 + 2 + sizeof(schar_T) + 5 + 5)) {
+ if (UI_BUF_SIZE - BUF_POS(data) < 2 * (1 + 2 + sizeof(schar_T) + 5 + 5) + 1) {
// close to overflowing the redraw buffer. finish this event,
// flush, and start a new "grid_line" event at the current position.
// For simplicity leave place for the final "clear" element
// as well, hence the factor of 2 in the check.
mpack_w2(&lenpos, nelem);
+
+ // We only ever set the wrap field on the final "grid_line" event for the line.
+ mpack_bool(buf, false);
remote_ui_flush_buf(ui);
prepare_call(ui, "grid_line");
data->ncalls++;
- mpack_array(buf, 4);
+ mpack_array(buf, 5);
mpack_uint(buf, (uint32_t)grid);
mpack_uint(buf, (uint32_t)row);
mpack_uint(buf, (uint32_t)startcol + (uint32_t)i - repeat + 1);
@@ -865,9 +873,10 @@ void remote_ui_raw_line(UI *ui, Integer grid, Integer row, Integer startcol, Int
mpack_uint(buf, (uint32_t)(clearcol - endcol));
}
mpack_w2(&lenpos, nelem);
+ mpack_bool(buf, flags & kLineFlagWrap);
if (data->ncells_pending > 500) {
- // pass of cells to UI to let it start processing them
+ // pass off cells to UI to let it start processing them
remote_ui_flush_buf(ui);
}
} else {