mirror of
https://github.com/neovim/neovim.git
synced 2025-11-18 16:21:41 +00:00
Merge pull request #13602 from janlazo/vim-8.2.2206
vim-patch:8.1.2212,8.2.{51,782,856,1174,1212,2206,2211}
This commit is contained in:
@@ -954,9 +954,13 @@ inside of strings can change! Also see 'softtabstop' option. >
|
|||||||
delete and yank) ({.%#:} only work with put).
|
delete and yank) ({.%#:} only work with put).
|
||||||
|
|
||||||
*:reg* *:registers*
|
*:reg* *:registers*
|
||||||
:reg[isters] Display the contents of all numbered and named
|
:reg[isters] Display the type and contents of all numbered and
|
||||||
registers. If a register is written to for |:redir|
|
named registers. If a register is written to for
|
||||||
it will not be listed.
|
|:redir| it will not be listed.
|
||||||
|
Type can be one of:
|
||||||
|
"c" for |characterwise| text
|
||||||
|
"l" for |linewise| text
|
||||||
|
"b" for |blockwise-visual| text
|
||||||
|
|
||||||
|
|
||||||
:reg[isters] {arg} Display the contents of the numbered and named
|
:reg[isters] {arg} Display the contents of the numbered and named
|
||||||
|
|||||||
@@ -89,6 +89,10 @@ static inline bool ascii_iswhite(int)
|
|||||||
REAL_FATTR_CONST
|
REAL_FATTR_CONST
|
||||||
REAL_FATTR_ALWAYS_INLINE;
|
REAL_FATTR_ALWAYS_INLINE;
|
||||||
|
|
||||||
|
static inline bool ascii_iswhite_or_nul(int)
|
||||||
|
REAL_FATTR_CONST
|
||||||
|
REAL_FATTR_ALWAYS_INLINE;
|
||||||
|
|
||||||
static inline bool ascii_isdigit(int)
|
static inline bool ascii_isdigit(int)
|
||||||
REAL_FATTR_CONST
|
REAL_FATTR_CONST
|
||||||
REAL_FATTR_ALWAYS_INLINE;
|
REAL_FATTR_ALWAYS_INLINE;
|
||||||
@@ -117,6 +121,14 @@ static inline bool ascii_iswhite(int c)
|
|||||||
return c == ' ' || c == '\t';
|
return c == ' ' || c == '\t';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Checks if `c` is a space or tab character or NUL.
|
||||||
|
///
|
||||||
|
/// @see {ascii_isdigit}
|
||||||
|
static inline bool ascii_iswhite_or_nul(int c)
|
||||||
|
{
|
||||||
|
return ascii_iswhite(c) || c == NUL;
|
||||||
|
}
|
||||||
|
|
||||||
/// Check whether character is a decimal digit.
|
/// Check whether character is a decimal digit.
|
||||||
///
|
///
|
||||||
/// Library isdigit() function is officially locale-dependent and, for
|
/// Library isdigit() function is officially locale-dependent and, for
|
||||||
|
|||||||
@@ -2556,6 +2556,7 @@ void free_for_info(void *fi_void)
|
|||||||
|
|
||||||
|
|
||||||
void set_context_for_expression(expand_T *xp, char_u *arg, cmdidx_T cmdidx)
|
void set_context_for_expression(expand_T *xp, char_u *arg, cmdidx_T cmdidx)
|
||||||
|
FUNC_ATTR_NONNULL_ALL
|
||||||
{
|
{
|
||||||
int got_eq = FALSE;
|
int got_eq = FALSE;
|
||||||
int c;
|
int c;
|
||||||
@@ -2638,6 +2639,23 @@ void set_context_for_expression(expand_T *xp, char_u *arg, cmdidx_T cmdidx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ":exe one two" completes "two"
|
||||||
|
if ((cmdidx == CMD_execute
|
||||||
|
|| cmdidx == CMD_echo
|
||||||
|
|| cmdidx == CMD_echon
|
||||||
|
|| cmdidx == CMD_echomsg)
|
||||||
|
&& xp->xp_context == EXPAND_EXPRESSION) {
|
||||||
|
for (;;) {
|
||||||
|
char_u *const n = skiptowhite(arg);
|
||||||
|
|
||||||
|
if (n == arg || ascii_iswhite_or_nul(*skipwhite(n))) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
arg = skipwhite(n);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
xp->xp_pattern = arg;
|
xp->xp_pattern = arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3554,15 +3554,21 @@ void ex_display(exarg_T *eap)
|
|||||||
int name;
|
int name;
|
||||||
char_u *arg = eap->arg;
|
char_u *arg = eap->arg;
|
||||||
int clen;
|
int clen;
|
||||||
|
char_u type[2];
|
||||||
|
|
||||||
if (arg != NULL && *arg == NUL)
|
if (arg != NULL && *arg == NUL)
|
||||||
arg = NULL;
|
arg = NULL;
|
||||||
int attr = HL_ATTR(HLF_8);
|
int attr = HL_ATTR(HLF_8);
|
||||||
|
|
||||||
/* Highlight title */
|
// Highlight title
|
||||||
MSG_PUTS_TITLE(_("\n--- Registers ---"));
|
msg_puts_title(_("\nType Name Content"));
|
||||||
for (int i = -1; i < NUM_REGISTERS && !got_int; i++) {
|
for (int i = -1; i < NUM_REGISTERS && !got_int; i++) {
|
||||||
name = get_register_name(i);
|
name = get_register_name(i);
|
||||||
|
switch (get_reg_type(name, NULL)) {
|
||||||
|
case kMTLineWise: type[0] = 'l'; break;
|
||||||
|
case kMTCharWise: type[0] = 'c'; break;
|
||||||
|
default: type[0] = 'b'; break;
|
||||||
|
}
|
||||||
|
|
||||||
if (arg != NULL && vim_strchr(arg, name) == NULL) {
|
if (arg != NULL && vim_strchr(arg, name) == NULL) {
|
||||||
continue; /* did not ask for this register */
|
continue; /* did not ask for this register */
|
||||||
@@ -3587,11 +3593,14 @@ void ex_display(exarg_T *eap)
|
|||||||
|
|
||||||
if (yb->y_array != NULL) {
|
if (yb->y_array != NULL) {
|
||||||
msg_putchar('\n');
|
msg_putchar('\n');
|
||||||
|
msg_puts(" ");
|
||||||
|
msg_putchar(type[0]);
|
||||||
|
msg_puts(" ");
|
||||||
msg_putchar('"');
|
msg_putchar('"');
|
||||||
msg_putchar(name);
|
msg_putchar(name);
|
||||||
MSG_PUTS(" ");
|
MSG_PUTS(" ");
|
||||||
|
|
||||||
int n = Columns - 6;
|
int n = Columns - 11;
|
||||||
for (size_t j = 0; j < yb->y_size && n > 1; j++) {
|
for (size_t j = 0; j < yb->y_size && n > 1; j++) {
|
||||||
if (j) {
|
if (j) {
|
||||||
MSG_PUTS_ATTR("^J", attr);
|
MSG_PUTS_ATTR("^J", attr);
|
||||||
@@ -3616,8 +3625,8 @@ void ex_display(exarg_T *eap)
|
|||||||
*/
|
*/
|
||||||
if ((p = get_last_insert()) != NULL
|
if ((p = get_last_insert()) != NULL
|
||||||
&& (arg == NULL || vim_strchr(arg, '.') != NULL) && !got_int) {
|
&& (arg == NULL || vim_strchr(arg, '.') != NULL) && !got_int) {
|
||||||
MSG_PUTS("\n\". ");
|
msg_puts("\n c \". ");
|
||||||
dis_msg(p, TRUE);
|
dis_msg(p, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -3625,8 +3634,8 @@ void ex_display(exarg_T *eap)
|
|||||||
*/
|
*/
|
||||||
if (last_cmdline != NULL && (arg == NULL || vim_strchr(arg, ':') != NULL)
|
if (last_cmdline != NULL && (arg == NULL || vim_strchr(arg, ':') != NULL)
|
||||||
&& !got_int) {
|
&& !got_int) {
|
||||||
MSG_PUTS("\n\": ");
|
msg_puts("\n c \": ");
|
||||||
dis_msg(last_cmdline, FALSE);
|
dis_msg(last_cmdline, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -3634,8 +3643,8 @@ void ex_display(exarg_T *eap)
|
|||||||
*/
|
*/
|
||||||
if (curbuf->b_fname != NULL
|
if (curbuf->b_fname != NULL
|
||||||
&& (arg == NULL || vim_strchr(arg, '%') != NULL) && !got_int) {
|
&& (arg == NULL || vim_strchr(arg, '%') != NULL) && !got_int) {
|
||||||
MSG_PUTS("\n\"% ");
|
msg_puts("\n c \"% ");
|
||||||
dis_msg(curbuf->b_fname, FALSE);
|
dis_msg(curbuf->b_fname, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -3646,8 +3655,8 @@ void ex_display(exarg_T *eap)
|
|||||||
linenr_T dummy;
|
linenr_T dummy;
|
||||||
|
|
||||||
if (buflist_name_nr(0, &fname, &dummy) != FAIL) {
|
if (buflist_name_nr(0, &fname, &dummy) != FAIL) {
|
||||||
MSG_PUTS("\n\"# ");
|
msg_puts("\n c \"# ");
|
||||||
dis_msg(fname, FALSE);
|
dis_msg(fname, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3656,8 +3665,8 @@ void ex_display(exarg_T *eap)
|
|||||||
*/
|
*/
|
||||||
if (last_search_pat() != NULL
|
if (last_search_pat() != NULL
|
||||||
&& (arg == NULL || vim_strchr(arg, '/') != NULL) && !got_int) {
|
&& (arg == NULL || vim_strchr(arg, '/') != NULL) && !got_int) {
|
||||||
MSG_PUTS("\n\"/ ");
|
msg_puts("\n c \"/ ");
|
||||||
dis_msg(last_search_pat(), FALSE);
|
dis_msg(last_search_pat(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -3665,8 +3674,8 @@ void ex_display(exarg_T *eap)
|
|||||||
*/
|
*/
|
||||||
if (expr_line != NULL && (arg == NULL || vim_strchr(arg, '=') != NULL)
|
if (expr_line != NULL && (arg == NULL || vim_strchr(arg, '=') != NULL)
|
||||||
&& !got_int) {
|
&& !got_int) {
|
||||||
MSG_PUTS("\n\"= ");
|
msg_puts("\n c \"= ");
|
||||||
dis_msg(expr_line, FALSE);
|
dis_msg(expr_line, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3676,9 +3685,10 @@ void ex_display(exarg_T *eap)
|
|||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
dis_msg(
|
dis_msg(
|
||||||
char_u *p,
|
const char_u *p,
|
||||||
int skip_esc /* if TRUE, ignore trailing ESC */
|
bool skip_esc // if true, ignore trailing ESC
|
||||||
)
|
)
|
||||||
|
FUNC_ATTR_NONNULL_ALL
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
int l;
|
int l;
|
||||||
|
|||||||
@@ -548,6 +548,13 @@ func Test_cmdline_complete_user_names()
|
|||||||
endif
|
endif
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_cmdline_complete_bang()
|
||||||
|
if executable('whoami')
|
||||||
|
call feedkeys(":!whoam\<C-A>\<C-B>\"\<CR>", 'tx')
|
||||||
|
call assert_match('^".*\<whoami\>', @:)
|
||||||
|
endif
|
||||||
|
endfunc
|
||||||
|
|
||||||
funct Test_cmdline_complete_languages()
|
funct Test_cmdline_complete_languages()
|
||||||
let lang = substitute(execute('language messages'), '.*"\(.*\)"$', '\1', '')
|
let lang = substitute(execute('language messages'), '.*"\(.*\)"$', '\1', '')
|
||||||
|
|
||||||
@@ -570,6 +577,17 @@ funct Test_cmdline_complete_languages()
|
|||||||
endif
|
endif
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_cmdline_complete_expression()
|
||||||
|
let g:SomeVar = 'blah'
|
||||||
|
for cmd in ['exe', 'echo', 'echon', 'echomsg']
|
||||||
|
call feedkeys(":" .. cmd .. " SomeV\<Tab>\<C-B>\"\<CR>", 'tx')
|
||||||
|
call assert_match('"' .. cmd .. ' SomeVar', @:)
|
||||||
|
call feedkeys(":" .. cmd .. " foo SomeV\<Tab>\<C-B>\"\<CR>", 'tx')
|
||||||
|
call assert_match('"' .. cmd .. ' foo SomeVar', @:)
|
||||||
|
endfor
|
||||||
|
unlet g:SomeVar
|
||||||
|
endfunc
|
||||||
|
|
||||||
func Test_cmdline_write_alternatefile()
|
func Test_cmdline_write_alternatefile()
|
||||||
new
|
new
|
||||||
call setline('.', ['one', 'two'])
|
call setline('.', ['one', 'two'])
|
||||||
|
|||||||
@@ -2,6 +2,9 @@
|
|||||||
" Tests for register operations
|
" Tests for register operations
|
||||||
"
|
"
|
||||||
|
|
||||||
|
source check.vim
|
||||||
|
source view_util.vim
|
||||||
|
|
||||||
" This test must be executed first to check for empty and unset registers.
|
" This test must be executed first to check for empty and unset registers.
|
||||||
func Test_aaa_empty_reg_test()
|
func Test_aaa_empty_reg_test()
|
||||||
call assert_fails('normal @@', 'E748:')
|
call assert_fails('normal @@', 'E748:')
|
||||||
@@ -52,31 +55,44 @@ func Test_display_registers()
|
|||||||
let b = execute('registers')
|
let b = execute('registers')
|
||||||
|
|
||||||
call assert_equal(a, b)
|
call assert_equal(a, b)
|
||||||
call assert_match('^\n--- Registers ---\n'
|
call assert_match('^\nType Name Content\n'
|
||||||
\ . '"" a\n'
|
\ . ' c "" a\n'
|
||||||
\ . '"0 ba\n'
|
\ . ' c "0 ba\n'
|
||||||
\ . '"1 b\n'
|
\ . ' c "1 b\n'
|
||||||
\ . '"a b\n'
|
\ . ' c "a b\n'
|
||||||
\ . '.*'
|
\ . '.*'
|
||||||
\ . '"- a\n'
|
\ . ' c "- a\n'
|
||||||
\ . '.*'
|
\ . '.*'
|
||||||
\ . '": ls\n'
|
\ . ' c ": ls\n'
|
||||||
\ . '"% file2\n'
|
\ . ' c "% file2\n'
|
||||||
\ . '"# file1\n'
|
\ . ' c "# file1\n'
|
||||||
\ . '"/ bar\n'
|
\ . ' c "/ bar\n'
|
||||||
\ . '"= 2\*4', a)
|
\ . ' c "= 2\*4', a)
|
||||||
|
|
||||||
let a = execute('registers a')
|
let a = execute('registers a')
|
||||||
call assert_match('^\n--- Registers ---\n'
|
call assert_match('^\nType Name Content\n'
|
||||||
\ . '"a b', a)
|
\ . ' c "a b', a)
|
||||||
|
|
||||||
let a = execute('registers :')
|
let a = execute('registers :')
|
||||||
call assert_match('^\n--- Registers ---\n'
|
call assert_match('^\nType Name Content\n'
|
||||||
\ . '": ls', a)
|
\ . ' c ": ls', a)
|
||||||
|
|
||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_recording_status_in_ex_line()
|
||||||
|
norm qx
|
||||||
|
redraw!
|
||||||
|
call assert_equal('recording @x', Screenline(&lines))
|
||||||
|
set shortmess=q
|
||||||
|
redraw!
|
||||||
|
call assert_equal('recording', Screenline(&lines))
|
||||||
|
set shortmess&
|
||||||
|
norm q
|
||||||
|
redraw!
|
||||||
|
call assert_equal('', Screenline(&lines))
|
||||||
|
endfunc
|
||||||
|
|
||||||
" Check that replaying a typed sequence does not use an Esc and following
|
" Check that replaying a typed sequence does not use an Esc and following
|
||||||
" characters as an escape sequence.
|
" characters as an escape sequence.
|
||||||
func Test_recording_esc_sequence()
|
func Test_recording_esc_sequence()
|
||||||
|
|||||||
@@ -605,10 +605,10 @@ describe('clipboard (with fake clipboard.vim)', function()
|
|||||||
{0:~ }|
|
{0:~ }|
|
||||||
{4: }|
|
{4: }|
|
||||||
:registers |
|
:registers |
|
||||||
{1:--- Registers ---} |
|
{1:Type Name Content} |
|
||||||
"* some{2:^J}star data{2:^J} |
|
l "* some{2:^J}star data{2:^J} |
|
||||||
"+ such{2:^J}plus{2:^J}stuff |
|
c "+ such{2:^J}plus{2:^J}stuff |
|
||||||
": let g:test_clip['+'] = ['such', 'plus', 'stuff'] |
|
c ": let g:test_clip['+'] = ['such', 'plus', 'stuff'] |
|
||||||
{3:Press ENTER or type command to continue}^ |
|
{3:Press ENTER or type command to continue}^ |
|
||||||
]], {
|
]], {
|
||||||
[0] = {bold = true, foreground = Screen.colors.Blue},
|
[0] = {bold = true, foreground = Screen.colors.Blue},
|
||||||
|
|||||||
Reference in New Issue
Block a user