mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #25874 from bfredl/lets_rock
refactor(grid): implement rightleftcmd as a post-processing step
This commit is contained in:
commit
310896f6aa
@ -715,12 +715,8 @@ static uint8_t *command_line_enter(int firstc, int count, int indent, bool clear
|
|||||||
ExpandInit(&s->xpc);
|
ExpandInit(&s->xpc);
|
||||||
ccline.xpc = &s->xpc;
|
ccline.xpc = &s->xpc;
|
||||||
|
|
||||||
if (curwin->w_p_rl && *curwin->w_p_rlc == 's'
|
cmdmsg_rl = (curwin->w_p_rl && *curwin->w_p_rlc == 's'
|
||||||
&& (s->firstc == '/' || s->firstc == '?')) {
|
&& (s->firstc == '/' || s->firstc == '?'));
|
||||||
cmdmsg_rl = true;
|
|
||||||
} else {
|
|
||||||
cmdmsg_rl = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
msg_grid_validate();
|
msg_grid_validate();
|
||||||
|
|
||||||
@ -1564,11 +1560,7 @@ static int command_line_erase_chars(CommandLineState *s)
|
|||||||
|
|
||||||
XFREE_CLEAR(ccline.cmdbuff); // no commandline to return
|
XFREE_CLEAR(ccline.cmdbuff); // no commandline to return
|
||||||
if (!cmd_silent && !ui_has(kUICmdline)) {
|
if (!cmd_silent && !ui_has(kUICmdline)) {
|
||||||
if (cmdmsg_rl) {
|
msg_col = 0;
|
||||||
msg_col = Columns;
|
|
||||||
} else {
|
|
||||||
msg_col = 0;
|
|
||||||
}
|
|
||||||
msg_putchar(' '); // delete ':'
|
msg_putchar(' '); // delete ':'
|
||||||
}
|
}
|
||||||
s->is_state.search_start = s->is_state.save_cursor;
|
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
|
// Always redraw the whole command line to fix shaping and
|
||||||
// right-left typing. Not efficient, but it works.
|
// right-left typing. Not efficient, but it works.
|
||||||
// Do it only when there are no characters left to read
|
// Do it only when there are no characters left to read
|
||||||
@ -3863,18 +3855,10 @@ void cursorcmd(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmdmsg_rl) {
|
msg_row = cmdline_row + (ccline.cmdspos / Columns);
|
||||||
msg_row = cmdline_row + (ccline.cmdspos / (Columns - 1));
|
msg_col = ccline.cmdspos % Columns;
|
||||||
msg_col = Columns - (ccline.cmdspos % (Columns - 1)) - 1;
|
if (msg_row >= Rows) {
|
||||||
if (msg_row <= 0) {
|
msg_row = Rows - 1;
|
||||||
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_cursor_goto(msg_row, msg_col);
|
msg_cursor_goto(msg_row, msg_col);
|
||||||
@ -3886,11 +3870,7 @@ void gotocmdline(bool clr)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
msg_start();
|
msg_start();
|
||||||
if (cmdmsg_rl) {
|
msg_col = 0; // always start in column 0
|
||||||
msg_col = Columns - 1;
|
|
||||||
} else {
|
|
||||||
msg_col = 0; // always start in column 0
|
|
||||||
}
|
|
||||||
if (clr) { // clear the bottom line(s)
|
if (clr) { // clear the bottom line(s)
|
||||||
msg_clr_eos(); // will reset clear_cmdline
|
msg_clr_eos(); // will reset clear_cmdline
|
||||||
}
|
}
|
||||||
|
@ -472,6 +472,45 @@ void grid_line_cursor_goto(int col)
|
|||||||
ui_grid_cursor_goto(grid_line_grid->handle, grid_line_row, col);
|
ui_grid_cursor_goto(grid_line_grid->handle, grid_line_row, col);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void grid_line_mirror(void)
|
||||||
|
{
|
||||||
|
if (grid_line_first >= grid_line_last) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t n = (size_t)(grid_line_last - grid_line_first);
|
||||||
|
int mirror = grid_line_maxcol - 1; // Mirrors are more fun than television.
|
||||||
|
schar_T *scratch_char = (schar_T *)linebuf_scratch;
|
||||||
|
memcpy(scratch_char + grid_line_first, linebuf_char + grid_line_first, n * sizeof(schar_T));
|
||||||
|
for (int col = grid_line_first; col < grid_line_last; col++) {
|
||||||
|
int rev = mirror - col;
|
||||||
|
if (col + 1 < grid_line_last && scratch_char[col + 1] == 0) {
|
||||||
|
linebuf_char[rev - 1] = scratch_char[col];
|
||||||
|
linebuf_char[rev] = 0;
|
||||||
|
col++;
|
||||||
|
} else {
|
||||||
|
linebuf_char[rev] = scratch_char[col];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// for attr and vcol: assumes doublewidth chars are self-consistent
|
||||||
|
sattr_T *scratch_attr = (sattr_T *)linebuf_scratch;
|
||||||
|
memcpy(scratch_attr + grid_line_first, linebuf_attr + grid_line_first, n * sizeof(sattr_T));
|
||||||
|
for (int col = grid_line_first; col < grid_line_last; col++) {
|
||||||
|
linebuf_attr[mirror - col] = scratch_attr[col];
|
||||||
|
}
|
||||||
|
|
||||||
|
colnr_T *scratch_vcol = (colnr_T *)linebuf_scratch;
|
||||||
|
memcpy(scratch_vcol + grid_line_first, linebuf_vcol + grid_line_first, n * sizeof(colnr_T));
|
||||||
|
for (int col = grid_line_first; col < grid_line_last; col++) {
|
||||||
|
linebuf_vcol[mirror - col] = scratch_vcol[col];
|
||||||
|
}
|
||||||
|
|
||||||
|
int grid_line_last_copy = grid_line_last;
|
||||||
|
grid_line_last = grid_line_maxcol - grid_line_first;
|
||||||
|
grid_line_first = grid_line_maxcol - grid_line_last_copy;
|
||||||
|
}
|
||||||
|
|
||||||
/// End a group of grid_line_puts calls and send the screen buffer to the UI layer.
|
/// End a group of grid_line_puts calls and send the screen buffer to the UI layer.
|
||||||
void grid_line_flush(void)
|
void grid_line_flush(void)
|
||||||
{
|
{
|
||||||
@ -828,9 +867,11 @@ void grid_alloc(ScreenGrid *grid, int rows, int columns, bool copy, bool valid)
|
|||||||
xfree(linebuf_char);
|
xfree(linebuf_char);
|
||||||
xfree(linebuf_attr);
|
xfree(linebuf_attr);
|
||||||
xfree(linebuf_vcol);
|
xfree(linebuf_vcol);
|
||||||
|
xfree(linebuf_scratch);
|
||||||
linebuf_char = xmalloc((size_t)columns * sizeof(schar_T));
|
linebuf_char = xmalloc((size_t)columns * sizeof(schar_T));
|
||||||
linebuf_attr = xmalloc((size_t)columns * sizeof(sattr_T));
|
linebuf_attr = xmalloc((size_t)columns * sizeof(sattr_T));
|
||||||
linebuf_vcol = xmalloc((size_t)columns * sizeof(colnr_T));
|
linebuf_vcol = xmalloc((size_t)columns * sizeof(colnr_T));
|
||||||
|
linebuf_scratch = xmalloc((size_t)columns * sizeof(sscratch_T));
|
||||||
linebuf_size = (size_t)columns;
|
linebuf_size = (size_t)columns;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -855,6 +896,7 @@ void grid_free_all_mem(void)
|
|||||||
xfree(linebuf_char);
|
xfree(linebuf_char);
|
||||||
xfree(linebuf_attr);
|
xfree(linebuf_attr);
|
||||||
xfree(linebuf_vcol);
|
xfree(linebuf_vcol);
|
||||||
|
xfree(linebuf_scratch);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// (Re)allocates a window grid if size changed while in ext_multigrid mode.
|
/// (Re)allocates a window grid if size changed while in ext_multigrid mode.
|
||||||
|
@ -29,6 +29,7 @@ EXTERN bool resizing_screen INIT( = 0);
|
|||||||
EXTERN schar_T *linebuf_char INIT( = NULL);
|
EXTERN schar_T *linebuf_char INIT( = NULL);
|
||||||
EXTERN sattr_T *linebuf_attr INIT( = NULL);
|
EXTERN sattr_T *linebuf_attr INIT( = NULL);
|
||||||
EXTERN colnr_T *linebuf_vcol INIT( = NULL);
|
EXTERN colnr_T *linebuf_vcol INIT( = NULL);
|
||||||
|
EXTERN char *linebuf_scratch INIT( = NULL);
|
||||||
|
|
||||||
// Low-level functions to manipulate individual character cells on the
|
// Low-level functions to manipulate individual character cells on the
|
||||||
// screen grid.
|
// screen grid.
|
||||||
|
@ -16,7 +16,9 @@
|
|||||||
// otherwise it must be a UTF-8 string of length maximum 4 (no NUL when n=4)
|
// otherwise it must be a UTF-8 string of length maximum 4 (no NUL when n=4)
|
||||||
|
|
||||||
typedef uint32_t schar_T;
|
typedef uint32_t schar_T;
|
||||||
typedef int sattr_T;
|
typedef int32_t sattr_T;
|
||||||
|
// must be at least as big as the biggest of schar_T, sattr_T, col_T
|
||||||
|
typedef int32_t sscratch_T;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
kZIndexDefaultGrid = 0,
|
kZIndexDefaultGrid = 0,
|
||||||
|
@ -1231,9 +1231,7 @@ void wait_return(int redraw)
|
|||||||
} else {
|
} else {
|
||||||
msg_didout = false;
|
msg_didout = false;
|
||||||
c = K_IGNORE;
|
c = K_IGNORE;
|
||||||
msg_col =
|
msg_col = 0;
|
||||||
cmdmsg_rl ? Columns - 1 :
|
|
||||||
0;
|
|
||||||
}
|
}
|
||||||
if (quit_more) {
|
if (quit_more) {
|
||||||
c = CAR; // just pretend CR was hit
|
c = CAR; // just pretend CR was hit
|
||||||
@ -1435,7 +1433,7 @@ void msg_start(void)
|
|||||||
|
|
||||||
if (!msg_scroll && full_screen) { // overwrite last message
|
if (!msg_scroll && full_screen) { // overwrite last message
|
||||||
msg_row = cmdline_row;
|
msg_row = cmdline_row;
|
||||||
msg_col = cmdmsg_rl ? Columns - 1 : 0;
|
msg_col = 0;
|
||||||
} else if (msg_didout || (p_ch == 0 && !ui_has(kUIMessages))) { // start message on next line
|
} else if (msg_didout || (p_ch == 0 && !ui_has(kUIMessages))) { // start message on next line
|
||||||
msg_putchar('\n');
|
msg_putchar('\n');
|
||||||
did_return = true;
|
did_return = true;
|
||||||
@ -2132,7 +2130,7 @@ static void msg_puts_display(const char *str, int maxlen, int attr, int recurse)
|
|||||||
int msg_row_pending = -1;
|
int msg_row_pending = -1;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
if (cmdmsg_rl ? msg_col <= 0 : msg_col >= Columns) {
|
if (msg_col >= Columns) {
|
||||||
if (p_more && !recurse) {
|
if (p_more && !recurse) {
|
||||||
// Store text for scrolling back.
|
// Store text for scrolling back.
|
||||||
store_sb_text(&sb_str, s, attr, &sb_col, true);
|
store_sb_text(&sb_str, s, attr, &sb_col, true);
|
||||||
@ -2141,7 +2139,7 @@ static void msg_puts_display(const char *str, int maxlen, int attr, int recurse)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
msg_col = cmdmsg_rl ? Columns - 1 : 0;
|
msg_col = 0;
|
||||||
msg_row++;
|
msg_row++;
|
||||||
msg_didout = false;
|
msg_didout = false;
|
||||||
}
|
}
|
||||||
@ -2156,7 +2154,7 @@ static void msg_puts_display(const char *str, int maxlen, int attr, int recurse)
|
|||||||
|
|
||||||
if (!recurse) {
|
if (!recurse) {
|
||||||
if (msg_row_pending >= 0) {
|
if (msg_row_pending >= 0) {
|
||||||
grid_line_flush_if_valid_row();
|
msg_line_flush();
|
||||||
msg_row_pending = -1;
|
msg_row_pending = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2196,7 +2194,7 @@ static void msg_puts_display(const char *str, int maxlen, int attr, int recurse)
|
|||||||
// TODO(bfredl): this logic is messier that it has to be. What
|
// TODO(bfredl): this logic is messier that it has to be. What
|
||||||
// messages really want is its own private linebuf_char buffer.
|
// messages really want is its own private linebuf_char buffer.
|
||||||
if (msg_row_pending >= 0) {
|
if (msg_row_pending >= 0) {
|
||||||
grid_line_flush_if_valid_row();
|
msg_line_flush();
|
||||||
}
|
}
|
||||||
grid_line_start(&msg_grid_adj, msg_row);
|
grid_line_start(&msg_grid_adj, msg_row);
|
||||||
msg_row_pending = msg_row;
|
msg_row_pending = msg_row;
|
||||||
@ -2207,7 +2205,7 @@ static void msg_puts_display(const char *str, int maxlen, int attr, int recurse)
|
|||||||
// avoid including composing chars after the end
|
// avoid including composing chars after the end
|
||||||
int l = (maxlen >= 0) ? utfc_ptr2len_len(s, (int)((str + maxlen) - s)) : utfc_ptr2len(s);
|
int l = (maxlen >= 0) ? utfc_ptr2len_len(s, (int)((str + maxlen) - s)) : utfc_ptr2len(s);
|
||||||
|
|
||||||
if (cw > 1 && (cmdmsg_rl ? msg_col <= 1 : msg_col == Columns - 1)) {
|
if (cw > 1 && (msg_col == Columns - 1)) {
|
||||||
// Doesn't fit, print a highlighted '>' to fill it up.
|
// Doesn't fit, print a highlighted '>' to fill it up.
|
||||||
grid_line_puts(msg_col, ">", 1, HL_ATTR(HLF_AT));
|
grid_line_puts(msg_col, ">", 1, HL_ATTR(HLF_AT));
|
||||||
cw = 1;
|
cw = 1;
|
||||||
@ -2216,20 +2214,12 @@ static void msg_puts_display(const char *str, int maxlen, int attr, int recurse)
|
|||||||
s += l;
|
s += l;
|
||||||
}
|
}
|
||||||
msg_didout = true; // remember that line is not empty
|
msg_didout = true; // remember that line is not empty
|
||||||
if (cmdmsg_rl) {
|
msg_col += cw;
|
||||||
msg_col -= cw;
|
|
||||||
} else {
|
|
||||||
msg_col += cw;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
char c = *s++;
|
char c = *s++;
|
||||||
if (c == '\n') { // go to next line
|
if (c == '\n') { // go to next line
|
||||||
msg_didout = false; // remember that line is empty
|
msg_didout = false; // remember that line is empty
|
||||||
if (cmdmsg_rl) {
|
msg_col = 0;
|
||||||
msg_col = Columns - 1;
|
|
||||||
} else {
|
|
||||||
msg_col = 0;
|
|
||||||
}
|
|
||||||
msg_row++;
|
msg_row++;
|
||||||
if (p_more && !recurse) {
|
if (p_more && !recurse) {
|
||||||
// Store text for scrolling back.
|
// Store text for scrolling back.
|
||||||
@ -2244,9 +2234,9 @@ static void msg_puts_display(const char *str, int maxlen, int attr, int recurse)
|
|||||||
} else if (c == TAB) { // translate Tab into spaces
|
} else if (c == TAB) { // translate Tab into spaces
|
||||||
do {
|
do {
|
||||||
grid_line_puts(msg_col, " ", 1, print_attr);
|
grid_line_puts(msg_col, " ", 1, print_attr);
|
||||||
msg_col += cmdmsg_rl ? -1 : 1;
|
msg_col += 1;
|
||||||
|
|
||||||
if (msg_col == (cmdmsg_rl ? 0 : Columns)) {
|
if (msg_col == Columns) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} while (msg_col & 7);
|
} while (msg_col & 7);
|
||||||
@ -2257,7 +2247,7 @@ static void msg_puts_display(const char *str, int maxlen, int attr, int recurse)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (msg_row_pending >= 0) {
|
if (msg_row_pending >= 0) {
|
||||||
grid_line_flush_if_valid_row();
|
msg_line_flush();
|
||||||
}
|
}
|
||||||
msg_cursor_goto(msg_row, msg_col);
|
msg_cursor_goto(msg_row, msg_col);
|
||||||
|
|
||||||
@ -2268,9 +2258,20 @@ static void msg_puts_display(const char *str, int maxlen, int attr, int recurse)
|
|||||||
msg_check();
|
msg_check();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void msg_line_flush(void)
|
||||||
|
{
|
||||||
|
if (cmdmsg_rl) {
|
||||||
|
grid_line_mirror();
|
||||||
|
}
|
||||||
|
grid_line_flush_if_valid_row();
|
||||||
|
}
|
||||||
|
|
||||||
void msg_cursor_goto(int row, int col)
|
void msg_cursor_goto(int row, int col)
|
||||||
{
|
{
|
||||||
ScreenGrid *grid = &msg_grid_adj;
|
ScreenGrid *grid = &msg_grid_adj;
|
||||||
|
if (cmdmsg_rl) {
|
||||||
|
col = Columns - 1 - col;
|
||||||
|
}
|
||||||
grid_adjust(&grid, &row, &col);
|
grid_adjust(&grid, &row, &col);
|
||||||
ui_grid_cursor_goto(grid->handle, row, col);
|
ui_grid_cursor_goto(grid->handle, row, col);
|
||||||
}
|
}
|
||||||
@ -2656,18 +2657,10 @@ static void msg_puts_printf(const char *str, const ptrdiff_t maxlen)
|
|||||||
|
|
||||||
int cw = utf_char2cells(utf_ptr2char(s));
|
int cw = utf_char2cells(utf_ptr2char(s));
|
||||||
// primitive way to compute the current column
|
// primitive way to compute the current column
|
||||||
if (cmdmsg_rl) {
|
if (*s == '\r' || *s == '\n') {
|
||||||
if (*s == '\r' || *s == '\n') {
|
msg_col = 0;
|
||||||
msg_col = Columns - 1;
|
|
||||||
} else {
|
|
||||||
msg_col -= cw;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (*s == '\r' || *s == '\n') {
|
msg_col += cw;
|
||||||
msg_col = 0;
|
|
||||||
} else {
|
|
||||||
msg_col += cw;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
s += len;
|
s += len;
|
||||||
}
|
}
|
||||||
@ -2915,8 +2908,6 @@ static int do_more_prompt(int typed_char)
|
|||||||
if (quit_more) {
|
if (quit_more) {
|
||||||
msg_row = Rows - 1;
|
msg_row = Rows - 1;
|
||||||
msg_col = 0;
|
msg_col = 0;
|
||||||
} else if (cmdmsg_rl) {
|
|
||||||
msg_col = Columns - 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
entered = false;
|
entered = false;
|
||||||
@ -3014,7 +3005,7 @@ void msg_clr_eos_force(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int msg_startcol = (cmdmsg_rl) ? 0 : msg_col;
|
int msg_startcol = (cmdmsg_rl) ? 0 : msg_col;
|
||||||
int msg_endcol = (cmdmsg_rl) ? msg_col + 1 : Columns;
|
int msg_endcol = (cmdmsg_rl) ? Columns - msg_col : Columns;
|
||||||
|
|
||||||
if (msg_grid.chars && msg_row < msg_grid_pos) {
|
if (msg_grid.chars && msg_row < msg_grid_pos) {
|
||||||
// TODO(bfredl): ugly, this state should already been validated at this
|
// TODO(bfredl): ugly, this state should already been validated at this
|
||||||
@ -3028,7 +3019,7 @@ void msg_clr_eos_force(void)
|
|||||||
' ', ' ', HL_ATTR(HLF_MSG));
|
' ', ' ', HL_ATTR(HLF_MSG));
|
||||||
|
|
||||||
redraw_cmdline = true; // overwritten the command line
|
redraw_cmdline = true; // overwritten the command line
|
||||||
if (msg_row < Rows - 1 || msg_col == (cmdmsg_rl ? Columns : 0)) {
|
if (msg_row < Rows - 1 || msg_col == 0) {
|
||||||
clear_cmdline = false; // command line has been cleared
|
clear_cmdline = false; // command line has been cleared
|
||||||
mode_displayed = false; // mode cleared or overwritten
|
mode_displayed = false; // mode cleared or overwritten
|
||||||
}
|
}
|
||||||
@ -3383,14 +3374,8 @@ void msg_advance(int col)
|
|||||||
if (col >= Columns) { // not enough room
|
if (col >= Columns) { // not enough room
|
||||||
col = Columns - 1;
|
col = Columns - 1;
|
||||||
}
|
}
|
||||||
if (cmdmsg_rl) {
|
while (msg_col < col) {
|
||||||
while (msg_col > Columns - col) {
|
msg_putchar(' ');
|
||||||
msg_putchar(' ');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
while (msg_col < col) {
|
|
||||||
msg_putchar(' ');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -537,22 +537,18 @@ void spell_suggest(int count)
|
|||||||
} else {
|
} else {
|
||||||
// When 'rightleft' is set the list is drawn right-left.
|
// When 'rightleft' is set the list is drawn right-left.
|
||||||
cmdmsg_rl = curwin->w_p_rl;
|
cmdmsg_rl = curwin->w_p_rl;
|
||||||
if (cmdmsg_rl) {
|
|
||||||
msg_col = Columns - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// List the suggestions.
|
// List the suggestions.
|
||||||
msg_start();
|
msg_start();
|
||||||
msg_row = Rows - 1; // for when 'cmdheight' > 1
|
msg_row = Rows - 1; // for when 'cmdheight' > 1
|
||||||
lines_left = Rows; // avoid more prompt
|
lines_left = Rows; // avoid more prompt
|
||||||
vim_snprintf(IObuff, IOSIZE, _("Change \"%.*s\" to:"),
|
char *fmt = _("Change \"%.*s\" to:");
|
||||||
sug.su_badlen, sug.su_badptr);
|
if (cmdmsg_rl && strncmp(fmt, "Change", 6) == 0) {
|
||||||
if (cmdmsg_rl && strncmp(IObuff, "Change", 6) == 0) {
|
|
||||||
// And now the rabbit from the high hat: Avoid showing the
|
// And now the rabbit from the high hat: Avoid showing the
|
||||||
// untranslated message rightleft.
|
// untranslated message rightleft.
|
||||||
vim_snprintf(IObuff, IOSIZE, ":ot \"%.*s\" egnahC",
|
fmt = ":ot \"%.*s\" egnahC";
|
||||||
sug.su_badlen, sug.su_badptr);
|
|
||||||
}
|
}
|
||||||
|
vim_snprintf(IObuff, IOSIZE, fmt, sug.su_badlen, sug.su_badptr);
|
||||||
msg_puts(IObuff);
|
msg_puts(IObuff);
|
||||||
msg_clr_eos();
|
msg_clr_eos();
|
||||||
msg_putchar('\n');
|
msg_putchar('\n');
|
||||||
|
@ -24,6 +24,7 @@ local function new_screen(opt)
|
|||||||
[7] = {bold = true, foreground = Screen.colors.Brown},
|
[7] = {bold = true, foreground = Screen.colors.Brown},
|
||||||
[8] = {background = Screen.colors.LightGrey},
|
[8] = {background = Screen.colors.LightGrey},
|
||||||
[9] = {bold = true},
|
[9] = {bold = true},
|
||||||
|
[10] = {background = Screen.colors.Yellow1};
|
||||||
})
|
})
|
||||||
return screen
|
return screen
|
||||||
end
|
end
|
||||||
@ -771,6 +772,84 @@ describe('cmdline redraw', function()
|
|||||||
:^abc |
|
:^abc |
|
||||||
]])
|
]])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('with rightleftcmd', function()
|
||||||
|
command('set rightleft rightleftcmd=search shortmess+=s')
|
||||||
|
meths.buf_set_lines(0, 0, -1, true, {"let's rock!"})
|
||||||
|
screen:expect{grid=[[
|
||||||
|
!kcor s'te^l|
|
||||||
|
{1: ~}|
|
||||||
|
{1: ~}|
|
||||||
|
{1: ~}|
|
||||||
|
|
|
||||||
|
]]}
|
||||||
|
|
||||||
|
feed '/'
|
||||||
|
screen:expect{grid=[[
|
||||||
|
!kcor s'tel|
|
||||||
|
{1: ~}|
|
||||||
|
{1: ~}|
|
||||||
|
{1: ~}|
|
||||||
|
^ /|
|
||||||
|
]]}
|
||||||
|
|
||||||
|
feed "let's"
|
||||||
|
-- note: cursor looks off but looks alright in real use
|
||||||
|
-- when rendered as a block so it touches the end of the text
|
||||||
|
screen:expect{grid=[[
|
||||||
|
!kcor {2:s'tel}|
|
||||||
|
{1: ~}|
|
||||||
|
{1: ~}|
|
||||||
|
{1: ~}|
|
||||||
|
^ s'tel/|
|
||||||
|
]]}
|
||||||
|
|
||||||
|
-- cursor movement
|
||||||
|
feed "<space>"
|
||||||
|
screen:expect{grid=[[
|
||||||
|
!kcor{2: s'tel}|
|
||||||
|
{1: ~}|
|
||||||
|
{1: ~}|
|
||||||
|
{1: ~}|
|
||||||
|
^ s'tel/|
|
||||||
|
]]}
|
||||||
|
|
||||||
|
feed "rock"
|
||||||
|
screen:expect{grid=[[
|
||||||
|
!{2:kcor s'tel}|
|
||||||
|
{1: ~}|
|
||||||
|
{1: ~}|
|
||||||
|
{1: ~}|
|
||||||
|
^ kcor s'tel/|
|
||||||
|
]]}
|
||||||
|
|
||||||
|
feed "<right>"
|
||||||
|
screen:expect{grid=[[
|
||||||
|
!{2:kcor s'tel}|
|
||||||
|
{1: ~}|
|
||||||
|
{1: ~}|
|
||||||
|
{1: ~}|
|
||||||
|
^kcor s'tel/|
|
||||||
|
]]}
|
||||||
|
|
||||||
|
feed "<left>"
|
||||||
|
screen:expect{grid=[[
|
||||||
|
!{2:kcor s'tel}|
|
||||||
|
{1: ~}|
|
||||||
|
{1: ~}|
|
||||||
|
{1: ~}|
|
||||||
|
^ kcor s'tel/|
|
||||||
|
]]}
|
||||||
|
|
||||||
|
feed "<cr>"
|
||||||
|
screen:expect{grid=[[
|
||||||
|
!{10:kcor s'te^l}|
|
||||||
|
{1: ~}|
|
||||||
|
{1: ~}|
|
||||||
|
{1: ~}|
|
||||||
|
kcor s'tel/ |
|
||||||
|
]]}
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe('statusline is redrawn on entering cmdline', function()
|
describe('statusline is redrawn on entering cmdline', function()
|
||||||
|
Loading…
Reference in New Issue
Block a user