1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-04-15 08:09:11 +08:00

fix(prompt): fix handle function

This commit is contained in:
wsdjeg 2022-10-05 21:19:34 +08:00
parent a6f5e197ba
commit cbe38a7eea

View File

@ -89,13 +89,16 @@ function M._handle_input(...)
goto continue
elseif char == Key.t('<right>') then
M._prompt.cursor_begin = M._prompt.cursor_begin .. M._prompt.cursor_char
M._prompt.cursor_char = M.__cmp.fn.matchstr(M._prompt.cursor_begin, '^.')
M._prompt.cursor_char = M.__cmp.fn.matchstr(M._prompt.cursor_end, '^.')
M._prompt.cursor_end = M.__cmp.fn.substitute(M._prompt.cursor_end, '^.', '', 'g')
M._build_prompt()
goto continue
elseif char == Key.t('<left>') then
if M._prompt.cursor_begin ~= '' then
M._prompt.cursor_end = M._prompt.cursor_char .. M._prompt.cursor_end
M._prompt.cursor_char = vim.fn.matchstr(M._prompt.cursor_begin, '.$')
M._prompt.cursor_begin = vim.fn.substitute(M._prompt.cursor_begin, '.$', '', 'g')
M._build_prompt()
end
goto continue
elseif char == Key.t('<C-w>') then