mirror of
https://github.com/neovim/neovim.git
synced 2025-10-17 15:21:47 +00:00
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.
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user