mirror of
https://github.com/neovim/neovim.git
synced 2025-09-28 14:08:32 +00:00
test: 'showcmd' with ext_messages and Visual selection (#28393)
Also slightly reorder some code to make comments look less out-of-place.
This commit is contained in:
@@ -64,6 +64,15 @@
|
|||||||
#include "nvim/undo.h"
|
#include "nvim/undo.h"
|
||||||
#include "nvim/vim_defs.h"
|
#include "nvim/vim_defs.h"
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int prev_c;
|
||||||
|
uint8_t buf[MB_MAXBYTES * 3 + 4];
|
||||||
|
size_t buflen;
|
||||||
|
unsigned pending;
|
||||||
|
bool in_special;
|
||||||
|
bool in_mbyte;
|
||||||
|
} gotchars_state_T;
|
||||||
|
|
||||||
/// Index in scriptin
|
/// Index in scriptin
|
||||||
static int curscript = -1;
|
static int curscript = -1;
|
||||||
/// Streams to read script from
|
/// Streams to read script from
|
||||||
@@ -84,15 +93,6 @@ static FileDescriptor scriptin[NSCRIPT] = { 0 };
|
|||||||
|
|
||||||
#define MINIMAL_SIZE 20 // minimal size for b_str
|
#define MINIMAL_SIZE 20 // minimal size for b_str
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
int prev_c;
|
|
||||||
uint8_t buf[MB_MAXBYTES * 3 + 4];
|
|
||||||
size_t buflen;
|
|
||||||
unsigned pending;
|
|
||||||
bool in_special;
|
|
||||||
bool in_mbyte;
|
|
||||||
} gotchars_state_T;
|
|
||||||
|
|
||||||
static buffheader_T redobuff = { { NULL, { NUL } }, NULL, 0, 0 };
|
static buffheader_T redobuff = { { NULL, { NUL } }, NULL, 0, 0 };
|
||||||
static buffheader_T old_redobuff = { { NULL, { NUL } }, NULL, 0, 0 };
|
static buffheader_T old_redobuff = { { NULL, { NUL } }, NULL, 0, 0 };
|
||||||
static buffheader_T recordbuff = { { NULL, { NUL } }, NULL, 0, 0 };
|
static buffheader_T recordbuff = { { NULL, { NUL } }, NULL, 0, 0 };
|
||||||
|
@@ -893,8 +893,8 @@ static bool normal_get_command_count(NormalState *s)
|
|||||||
// Handle a count before a command and compute ca.count0.
|
// Handle a count before a command and compute ca.count0.
|
||||||
// Note that '0' is a command and not the start of a count, but it's
|
// Note that '0' is a command and not the start of a count, but it's
|
||||||
// part of a count after other digits.
|
// part of a count after other digits.
|
||||||
while ((s->c >= '1' && s->c <= '9') || (s->ca.count0 != 0
|
while ((s->c >= '1' && s->c <= '9')
|
||||||
&& (s->c == K_DEL || s->c == K_KDEL || s->c == '0'))) {
|
|| (s->ca.count0 != 0 && (s->c == K_DEL || s->c == K_KDEL || s->c == '0'))) {
|
||||||
if (s->c == K_DEL || s->c == K_KDEL) {
|
if (s->c == K_DEL || s->c == K_KDEL) {
|
||||||
s->ca.count0 /= 10;
|
s->ca.count0 /= 10;
|
||||||
del_from_showcmd(4); // delete the digit and ~@%
|
del_from_showcmd(4); // delete the digit and ~@%
|
||||||
@@ -2065,9 +2065,6 @@ static void display_showcmd(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 'showcmdloc' is "last" or empty
|
// 'showcmdloc' is "last" or empty
|
||||||
if (p_ch == 0 && !ui_has(kUIMessages)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ui_has(kUIMessages)) {
|
if (ui_has(kUIMessages)) {
|
||||||
MAXSIZE_TEMP_ARRAY(content, 1);
|
MAXSIZE_TEMP_ARRAY(content, 1);
|
||||||
@@ -2081,6 +2078,9 @@ static void display_showcmd(void)
|
|||||||
ui_call_msg_showcmd(content);
|
ui_call_msg_showcmd(content);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (p_ch == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
msg_grid_validate();
|
msg_grid_validate();
|
||||||
int showcmd_row = Rows - 1;
|
int showcmd_row = Rows - 1;
|
||||||
|
@@ -685,7 +685,18 @@ describe('ui/ext_messages', function()
|
|||||||
]],
|
]],
|
||||||
ruler = { { '2,1 All' } },
|
ruler = { { '2,1 All' } },
|
||||||
}
|
}
|
||||||
feed('d')
|
feed('<c-v>k2l')
|
||||||
|
screen:expect({
|
||||||
|
grid = [[
|
||||||
|
{17:ab}^cde |
|
||||||
|
{17:123}45 |
|
||||||
|
{1:~ }|*3
|
||||||
|
]],
|
||||||
|
showmode = { { '-- VISUAL BLOCK --', 5 } },
|
||||||
|
showcmd = { { '2x3' } },
|
||||||
|
ruler = { { '1,3 All' } },
|
||||||
|
})
|
||||||
|
feed('o<esc>d')
|
||||||
screen:expect {
|
screen:expect {
|
||||||
grid = [[
|
grid = [[
|
||||||
abcde |
|
abcde |
|
||||||
|
Reference in New Issue
Block a user