diff options
author | bfredl <bjorn.linse@gmail.com> | 2023-11-03 14:25:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-03 14:25:15 +0100 |
commit | 310896f6aa1d1242d531c30d2cffa20ff8cb635f (patch) | |
tree | aeb487ea271274f92c59c275bf6cb26e42ed2eac /src/nvim/ex_getln.c | |
parent | d4dc1355eda78ca2a8aece08d1ab6c6bc1e91505 (diff) | |
parent | 44f0480a22af8f87f8784dac430416cb9913adea (diff) | |
download | rneovim-310896f6aa1d1242d531c30d2cffa20ff8cb635f.tar.gz rneovim-310896f6aa1d1242d531c30d2cffa20ff8cb635f.tar.bz2 rneovim-310896f6aa1d1242d531c30d2cffa20ff8cb635f.zip |
Merge pull request #25874 from bfredl/lets_rock
refactor(grid): implement rightleftcmd as a post-processing step
Diffstat (limited to 'src/nvim/ex_getln.c')
-rw-r--r-- | src/nvim/ex_getln.c | 38 |
1 files changed, 9 insertions, 29 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 93fd62f107..80a1410dbc 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -715,12 +715,8 @@ static uint8_t *command_line_enter(int firstc, int count, int indent, bool clear ExpandInit(&s->xpc); ccline.xpc = &s->xpc; - if (curwin->w_p_rl && *curwin->w_p_rlc == 's' - && (s->firstc == '/' || s->firstc == '?')) { - cmdmsg_rl = true; - } else { - cmdmsg_rl = false; - } + cmdmsg_rl = (curwin->w_p_rl && *curwin->w_p_rlc == 's' + && (s->firstc == '/' || s->firstc == '?')); msg_grid_validate(); @@ -1564,11 +1560,7 @@ static int command_line_erase_chars(CommandLineState *s) XFREE_CLEAR(ccline.cmdbuff); // no commandline to return if (!cmd_silent && !ui_has(kUICmdline)) { - if (cmdmsg_rl) { - msg_col = Columns; - } else { - msg_col = 0; - } + msg_col = 0; msg_putchar(' '); // delete ':' } s->is_state.search_start = s->is_state.save_cursor; @@ -2664,7 +2656,7 @@ static int command_line_changed(CommandLineState *s) } } - if (cmdmsg_rl || (p_arshape && !p_tbidi)) { + if (p_arshape && !p_tbidi) { // Always redraw the whole command line to fix shaping and // right-left typing. Not efficient, but it works. // Do it only when there are no characters left to read @@ -3863,18 +3855,10 @@ void cursorcmd(void) return; } - if (cmdmsg_rl) { - msg_row = cmdline_row + (ccline.cmdspos / (Columns - 1)); - msg_col = Columns - (ccline.cmdspos % (Columns - 1)) - 1; - if (msg_row <= 0) { - msg_row = Rows - 1; - } - } else { - msg_row = cmdline_row + (ccline.cmdspos / Columns); - msg_col = ccline.cmdspos % Columns; - if (msg_row >= Rows) { - msg_row = Rows - 1; - } + msg_row = cmdline_row + (ccline.cmdspos / Columns); + msg_col = ccline.cmdspos % Columns; + if (msg_row >= Rows) { + msg_row = Rows - 1; } msg_cursor_goto(msg_row, msg_col); @@ -3886,11 +3870,7 @@ void gotocmdline(bool clr) return; } msg_start(); - if (cmdmsg_rl) { - msg_col = Columns - 1; - } else { - msg_col = 0; // always start in column 0 - } + msg_col = 0; // always start in column 0 if (clr) { // clear the bottom line(s) msg_clr_eos(); // will reset clear_cmdline } |