Fix cmd hisotry correctly (#1594)

This commit is contained in:
phanium
2025-06-20 16:04:48 +08:00
committed by GitHub
parent 98dcd77a18
commit 3725f364cc

View File

@@ -669,9 +669,8 @@ function! s:history_sink(type, lines)
let key = a:lines[0] let key = a:lines[0]
let item = matchstr(a:lines[1], ' *[0-9]\+ *\zs.*') let item = matchstr(a:lines[1], ' *[0-9]\+ *\zs.*')
if key == 'ctrl-e' if key == 'ctrl-e'
call histadd(a:type, item)
redraw redraw
call feedkeys(a:type."\<up>", 'n') call feedkeys(a:type.item, 'nt')
else else
if a:type == ':' if a:type == ':'
call histadd(a:type, item) call histadd(a:type, item)
@@ -1236,9 +1235,9 @@ function! s:command_sink(lines)
endif endif
let cmd = matchstr(a:lines[1], s:tab.'\zs\S*\ze'.s:tab) let cmd = matchstr(a:lines[1], s:tab.'\zs\S*\ze'.s:tab)
if empty(a:lines[0]) if empty(a:lines[0])
call feedkeys(':'.cmd.(a:lines[1][0] == '!' ? '' : ' '), 'n') call feedkeys(':'.cmd.(a:lines[1][0] == '!' ? '' : ' '), 'nt')
else else
call feedkeys(':'.cmd."\<cr>", 'n') call feedkeys(':'.cmd."\<cr>", 'nt')
endif endif
endfunction endfunction