aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/charset.c
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2023-11-03 20:25:52 +0100
committerbfredl <bjorn.linse@gmail.com>2023-11-05 21:19:35 +0100
commit83db9115af94992a2fb32e927b7349283434ff5d (patch)
tree63f3d371491755e8b6bdbb8648d396ffba5a4218 /src/nvim/charset.c
parentacc646ad8fc3ef11fcc63b69f3d8484e4a91accd (diff)
downloadrneovim-83db9115af94992a2fb32e927b7349283434ff5d.tar.gz
rneovim-83db9115af94992a2fb32e927b7349283434ff5d.tar.bz2
rneovim-83db9115af94992a2fb32e927b7349283434ff5d.zip
refactor(grid): reimplement 'rightleft' as a post-processing step
problem: checks for wp->w_p_rl are all over the place, making simple things like "advance column one cell" incredibly complicated. solution: always fill linebuf_char[] using an incrementing counter, and then mirror the buffer as a post-processing step This was "easier" that I first feared, because the stupid but simple workaround for things like keeping linenumbers still left-right, e.g. "mirror them and them mirror them once more" is more or less what vim did already. So let's just keep doing that.
Diffstat (limited to 'src/nvim/charset.c')
-rw-r--r--src/nvim/charset.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nvim/charset.c b/src/nvim/charset.c
index eb858b8d5e..95229c5ffb 100644
--- a/src/nvim/charset.c
+++ b/src/nvim/charset.c
@@ -650,9 +650,9 @@ size_t transchar_hex(char *const buf, const int c)
/// Mirror text "str" for right-left displaying.
/// Only works for single-byte characters (e.g., numbers).
-void rl_mirror_ascii(char *str)
+void rl_mirror_ascii(char *str, char *end)
{
- for (char *p1 = str, *p2 = str + strlen(str) - 1; p1 < p2; p1++, p2--) {
+ for (char *p1 = str, *p2 = (end ? end : str + strlen(str)) - 1; p1 < p2; p1++, p2--) {
char t = *p1;
*p1 = *p2;
*p2 = t;