vtgl

terminal emulator implemented in OpenGL
git clone anongit@rnpnr.xyz:vtgl.git
Log | Files | Refs | Feed | LICENSE

Commit: 7eb72fc276b9781d494e3826dd81558a0ff8fe26
Parent: 1e9e8b6b04b22445caba3a0a9cc93cf31343c794
Author: Randy Palamar
Date:   Fri, 18 Oct 2024 23:05:50 -0600

copy: ensure last_non_space is set for utf-8 sequences longer than 1

Diffstat:
Mvtgl.c | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/vtgl.c b/vtgl.c @@ -456,11 +456,11 @@ KEYBIND_FN(copy) Cell c = tv->fb.rows[curs.y][curs.x]; if (c.style.attr & ATTR_WDUMMY) continue; - if (!ISSPACE(c.cp)) - last_non_space_idx = buf_curs; s8 enc = utf8_encode(c.cp); for (size i = 0; i < enc.len && buf_curs != buf_size; i++) buf[buf_curs++] = enc.data[i]; + if (!ISSPACE(c.cp)) + last_non_space_idx = buf_curs; } buf[last_non_space_idx + 1] = '\n'; buf_curs = last_non_space_idx + 2; @@ -472,11 +472,11 @@ KEYBIND_FN(copy) Cell c = tv->fb.rows[curs.y][curs.x]; if (c.style.attr & ATTR_WDUMMY) continue; - if (!ISSPACE(c.cp)) - last_non_space_idx = buf_curs; s8 enc = utf8_encode(c.cp); for (size i = 0; i < enc.len && buf_curs != buf_size; i++) buf[buf_curs++] = enc.data[i]; + if (!ISSPACE(c.cp)) + last_non_space_idx = buf_curs; } CLAMP(buf_curs, 0, buf_size - 1);