mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge #11674 'vim-patch:8.0.1786,8.1.{851,1308,1309,1579}'
This commit is contained in:
commit
83b0054b87
@ -4920,6 +4920,8 @@ Conceal placeholder characters substituted for concealed
|
||||
text (see 'conceallevel')
|
||||
*hl-Cursor*
|
||||
Cursor character under the cursor
|
||||
lCursor the character under the cursor when |language-mapping|
|
||||
is used (see 'guicursor')
|
||||
*hl-CursorIM*
|
||||
CursorIM like Cursor, but used when in IME mode |CursorIM|
|
||||
*hl-CursorColumn*
|
||||
|
@ -241,15 +241,15 @@ void nvim_feedkeys(String keys, String mode, Boolean escape_csi)
|
||||
keys_esc = keys.data;
|
||||
}
|
||||
ins_typebuf((char_u *)keys_esc, (remap ? REMAP_YES : REMAP_NONE),
|
||||
insert ? 0 : typebuf.tb_len, !typed, false);
|
||||
insert ? 0 : typebuf.tb_len, !typed, false);
|
||||
if (vgetc_busy) {
|
||||
typebuf_was_filled = true;
|
||||
}
|
||||
|
||||
if (escape_csi) {
|
||||
xfree(keys_esc);
|
||||
}
|
||||
|
||||
if (vgetc_busy) {
|
||||
typebuf_was_filled = true;
|
||||
}
|
||||
if (execute) {
|
||||
int save_msg_scroll = msg_scroll;
|
||||
|
||||
|
@ -5920,7 +5920,7 @@ static int dict_get_tv(char_u **arg, typval_T *rettv, int evaluate)
|
||||
if (**arg != '}') {
|
||||
EMSG2(_("E723: Missing end of Dictionary '}': %s"), *arg);
|
||||
failret:
|
||||
if (evaluate) {
|
||||
if (d != NULL) {
|
||||
tv_dict_free(d);
|
||||
}
|
||||
return FAIL;
|
||||
|
@ -1306,7 +1306,7 @@ void tv_dict_item_remove(dict_T *const dict, dictitem_T *const item)
|
||||
dict_T *tv_dict_alloc(void)
|
||||
FUNC_ATTR_NONNULL_RET FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
{
|
||||
dict_T *const d = xmalloc(sizeof(dict_T));
|
||||
dict_T *const d = xcalloc(1, sizeof(dict_T));
|
||||
|
||||
// Add the dict to the list of dicts for garbage collection.
|
||||
if (gc_first_dict != NULL) {
|
||||
|
@ -1518,7 +1518,7 @@ int vgetc(void)
|
||||
* collection in the first next vgetc(). It's disabled after that to
|
||||
* avoid internally used Lists and Dicts to be freed.
|
||||
*/
|
||||
may_garbage_collect = FALSE;
|
||||
may_garbage_collect = false;
|
||||
|
||||
return c;
|
||||
}
|
||||
@ -1562,7 +1562,7 @@ int vpeekc(void)
|
||||
{
|
||||
if (old_char != -1)
|
||||
return old_char;
|
||||
return vgetorpeek(FALSE);
|
||||
return vgetorpeek(false);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1615,20 +1615,20 @@ vungetc ( /* unget one character (can only be done once!) */
|
||||
/// Also stores the result of mappings.
|
||||
/// Also used for the ":normal" command.
|
||||
/// 3. from the user
|
||||
/// This may do a blocking wait if "advance" is TRUE.
|
||||
/// This may do a blocking wait if "advance" is true.
|
||||
///
|
||||
/// if "advance" is TRUE (vgetc()):
|
||||
/// if "advance" is true (vgetc()):
|
||||
/// Really get the character.
|
||||
/// KeyTyped is set to TRUE in the case the user typed the key.
|
||||
/// KeyStuffed is TRUE if the character comes from the stuff buffer.
|
||||
/// if "advance" is FALSE (vpeekc()):
|
||||
/// if "advance" is false (vpeekc()):
|
||||
/// Just look whether there is a character available.
|
||||
/// Return NUL if not.
|
||||
///
|
||||
/// When `no_mapping` (global) is zero, checks for mappings in the current mode.
|
||||
/// Only returns one byte (of a multi-byte character).
|
||||
/// K_SPECIAL and CSI may be escaped, need to get two more bytes then.
|
||||
static int vgetorpeek(int advance)
|
||||
static int vgetorpeek(bool advance)
|
||||
{
|
||||
int c, c1;
|
||||
int keylen;
|
||||
@ -1721,7 +1721,7 @@ static int vgetorpeek(int advance)
|
||||
// flush all input
|
||||
c = inchar(typebuf.tb_buf, typebuf.tb_buflen - 1, 0L);
|
||||
// If inchar() returns TRUE (script file was active) or we
|
||||
// are inside a mapping, get out of insert mode.
|
||||
// are inside a mapping, get out of Insert mode.
|
||||
// Otherwise we behave like having gotten a CTRL-C.
|
||||
// As a result typing CTRL-C in insert mode will
|
||||
// really insert a CTRL-C.
|
||||
@ -2324,7 +2324,7 @@ static int vgetorpeek(int advance)
|
||||
} /* for (;;) */
|
||||
} /* if (!character from stuffbuf) */
|
||||
|
||||
/* if advance is FALSE don't loop on NULs */
|
||||
// if advance is false don't loop on NULs
|
||||
} while (c < 0 || (advance && c == NUL));
|
||||
|
||||
/*
|
||||
|
@ -325,7 +325,7 @@ EXTERN except_T *caught_stack INIT(= NULL);
|
||||
/// we do garbage collection before waiting for a char at the toplevel.
|
||||
/// "garbage_collect_at_exit" indicates garbagecollect(1) was called.
|
||||
///
|
||||
EXTERN int may_garbage_collect INIT(= false);
|
||||
EXTERN bool may_garbage_collect INIT(= false);
|
||||
EXTERN int want_garbage_collect INIT(= false);
|
||||
EXTERN int garbage_collect_at_exit INIT(= false);
|
||||
|
||||
|
@ -5959,6 +5959,7 @@ static const char *highlight_init_both[] = {
|
||||
"IncSearch cterm=reverse gui=reverse",
|
||||
"ModeMsg cterm=bold gui=bold",
|
||||
"NonText ctermfg=Blue gui=bold guifg=Blue",
|
||||
"Normal cterm=NONE gui=NONE",
|
||||
"PmenuSbar ctermbg=Grey guibg=Grey",
|
||||
"StatusLine cterm=reverse,bold gui=reverse,bold",
|
||||
"StatusLineNC cterm=reverse gui=reverse",
|
||||
@ -6010,7 +6011,6 @@ static const char *highlight_init_light[] = {
|
||||
"Title ctermfg=DarkMagenta gui=bold guifg=Magenta",
|
||||
"Visual guibg=LightGrey",
|
||||
"WarningMsg ctermfg=DarkRed guifg=Red",
|
||||
"Normal gui=NONE",
|
||||
NULL
|
||||
};
|
||||
|
||||
@ -6044,7 +6044,6 @@ static const char *highlight_init_dark[] = {
|
||||
"Title ctermfg=LightMagenta gui=bold guifg=Magenta",
|
||||
"Visual guibg=DarkGrey",
|
||||
"WarningMsg ctermfg=LightRed guifg=Red",
|
||||
"Normal gui=NONE",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@ -52,7 +52,7 @@ if has('timers')
|
||||
au CursorHoldI * let g:triggered += 1
|
||||
set updatetime=500
|
||||
call job_start(has('win32') ? 'cmd /c echo:' : 'echo',
|
||||
\ {'exit_cb': {j, s -> timer_start(1000, 'ExitInsertMode')}})
|
||||
\ {'exit_cb': {-> timer_start(1000, 'ExitInsertMode')}})
|
||||
call feedkeys('a', 'x!')
|
||||
call assert_equal(1, g:triggered)
|
||||
unlet g:triggered
|
||||
|
@ -591,3 +591,13 @@ func Test_cursorline_with_visualmode()
|
||||
call StopVimInTerminal(buf)
|
||||
call delete('Xtest_cursorline_with_visualmode')
|
||||
endfunc
|
||||
|
||||
" This test must come before the Test_cursorline test, as it appears this
|
||||
" defines the Normal highlighting group anyway.
|
||||
func Test_1_highlight_Normalgroup_exists()
|
||||
" MS-Windows GUI sets the font
|
||||
if !has('win32') || !has('gui_running')
|
||||
let hlNormal = HighlightArgs('Normal')
|
||||
call assert_match('hi Normal\s*clear', hlNormal)
|
||||
endif
|
||||
endfunc
|
||||
|
@ -287,7 +287,7 @@ func Test_map_timeout_with_timer_interrupt()
|
||||
set timeout timeoutlen=200
|
||||
|
||||
func ExitCb(job, status)
|
||||
let g:timer = timer_start(1, {_ -> feedkeys("3\<Esc>", 't')})
|
||||
let g:timer = timer_start(1, {-> feedkeys("3\<Esc>", 't')})
|
||||
endfunc
|
||||
|
||||
call job_start([&shell, &shellcmdflag, 'echo'], {'exit_cb': 'ExitCb'})
|
||||
|
@ -254,15 +254,14 @@ func Test_peek_and_get_char()
|
||||
endfunc
|
||||
|
||||
func Test_getchar_zero()
|
||||
if has('win32')
|
||||
if has('win32') && !has('gui_running')
|
||||
" Console: no low-level input
|
||||
" GUI: somehow doesn't work
|
||||
return
|
||||
endif
|
||||
|
||||
" Measure the elapsed time to avoid a hang when it fails.
|
||||
let start = reltime()
|
||||
let id = timer_start(20, {id -> feedkeys('x', 'L')})
|
||||
let id = timer_start(20, {-> feedkeys('x', 'L')})
|
||||
let c = 0
|
||||
while c == 0 && reltimefloat(reltime(start)) < 0.2
|
||||
let c = getchar(0)
|
||||
@ -314,4 +313,30 @@ func Test_restore_count()
|
||||
call delete('Xtrctext')
|
||||
endfunc
|
||||
|
||||
" Test that the garbage collector isn't triggered if a timer callback invokes
|
||||
" vgetc().
|
||||
func Test_nocatch_garbage_collect()
|
||||
" skipped: Nvim does not support test_garbagecollect_soon(), test_override()
|
||||
return
|
||||
" 'uptimetime. must be bigger than the timer timeout
|
||||
set ut=200
|
||||
call test_garbagecollect_soon()
|
||||
call test_override('no_wait_return', 0)
|
||||
func CauseAnError(id)
|
||||
" This will show an error and wait for Enter.
|
||||
let a = {'foo', 'bar'}
|
||||
endfunc
|
||||
func FeedChar(id)
|
||||
call feedkeys('x', 't')
|
||||
endfunc
|
||||
call timer_start(300, 'FeedChar')
|
||||
call timer_start(100, 'CauseAnError')
|
||||
let x = getchar()
|
||||
|
||||
set ut&
|
||||
call test_override('no_wait_return', 1)
|
||||
delfunc CauseAnError
|
||||
delfunc FeedChar
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
@ -987,7 +987,7 @@ describe('Screen default colors', function()
|
||||
it('can be set to light', function()
|
||||
startup(true, false)
|
||||
screen:expect{condition=function()
|
||||
eq({rgb_bg=Screen.colors.White, rgb_fg=0, rgb_sp=Screen.colors.Red,
|
||||
eq({rgb_fg=Screen.colors.White, rgb_bg=0, rgb_sp=Screen.colors.Red,
|
||||
cterm_bg=0, cterm_fg=0}, screen.default_colors)
|
||||
end}
|
||||
end)
|
||||
|
@ -406,7 +406,7 @@ end
|
||||
local alloc_logging_helpers = {
|
||||
list = function(l) return {func='calloc', args={1, ffi.sizeof('list_T')}, ret=void(l)} end,
|
||||
li = function(li) return {func='malloc', args={ffi.sizeof('listitem_T')}, ret=void(li)} end,
|
||||
dict = function(d) return {func='malloc', args={ffi.sizeof('dict_T')}, ret=void(d)} end,
|
||||
dict = function(d) return {func='calloc', args={1, ffi.sizeof('dict_T')}, ret=void(d)} end,
|
||||
di = function(di, size)
|
||||
size = alloc_len(size, function() return di.di_key end)
|
||||
return {func='malloc', args={ffi.offsetof('dictitem_T', 'di_key') + size + 1}, ret=void(di)}
|
||||
|
Loading…
Reference in New Issue
Block a user