mirror of
https://github.com/neovim/neovim.git
synced 2025-10-06 09:56:31 +00:00
vim-patch:8.1.0032: BS in prompt buffer starts new line
Problem: BS in prompt buffer starts new line.
Solution: Do not allows BS over the prompt. Make term_sendkeys() handle
special keys. Add a test.
6b810d92a9
This commit is contained in:
@@ -7092,10 +7092,13 @@ static int check_opt_wim(void)
|
|||||||
*/
|
*/
|
||||||
bool can_bs(int what)
|
bool can_bs(int what)
|
||||||
{
|
{
|
||||||
|
if (what == BS_START && bt_prompt(curbuf)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
switch (*p_bs) {
|
switch (*p_bs) {
|
||||||
case '2': return true;
|
case '2': return true;
|
||||||
case '1': return what != BS_START;
|
case '1': return what != BS_START;
|
||||||
case '0': return false;
|
case '0': return false;
|
||||||
}
|
}
|
||||||
return vim_strchr(p_bs, what) != NULL;
|
return vim_strchr(p_bs, what) != NULL;
|
||||||
}
|
}
|
||||||
|
@@ -28,6 +28,11 @@ describe('prompt buffer', function()
|
|||||||
call append(line("$") - 1, 'Result: "' . a:text .'"')
|
call append(line("$") - 1, 'Result: "' . a:text .'"')
|
||||||
endfunc
|
endfunc
|
||||||
]])
|
]])
|
||||||
|
feed_command("set noshowmode | set laststatus=0")
|
||||||
|
feed_command("call setline(1, 'other buffer')")
|
||||||
|
feed_command("new")
|
||||||
|
feed_command("set buftype=prompt")
|
||||||
|
feed_command("call prompt_setcallback(bufnr(''), function('TextEntered'))")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
after_each(function()
|
after_each(function()
|
||||||
@@ -35,11 +40,6 @@ describe('prompt buffer', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('works', function()
|
it('works', function()
|
||||||
feed_command("set noshowmode | set laststatus=0")
|
|
||||||
feed_command("call setline(1, 'other buffer')")
|
|
||||||
feed_command("new")
|
|
||||||
feed_command("set buftype=prompt")
|
|
||||||
feed_command("call prompt_setcallback(bufnr(''), function('TextEntered'))")
|
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
^ |
|
^ |
|
||||||
~ |
|
~ |
|
||||||
@@ -52,7 +52,7 @@ describe('prompt buffer', function()
|
|||||||
~ |
|
~ |
|
||||||
|
|
|
|
||||||
]])
|
]])
|
||||||
feed_command("startinsert")
|
feed("i")
|
||||||
feed("hello\n")
|
feed("hello\n")
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
% hello |
|
% hello |
|
||||||
@@ -81,4 +81,72 @@ describe('prompt buffer', function()
|
|||||||
]])
|
]])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('editing', function()
|
||||||
|
screen:expect([[
|
||||||
|
^ |
|
||||||
|
~ |
|
||||||
|
~ |
|
||||||
|
~ |
|
||||||
|
[Scratch] |
|
||||||
|
other buffer |
|
||||||
|
~ |
|
||||||
|
~ |
|
||||||
|
~ |
|
||||||
|
|
|
||||||
|
]])
|
||||||
|
feed("i")
|
||||||
|
feed("hello<BS><BS>")
|
||||||
|
screen:expect([[
|
||||||
|
% hel^ |
|
||||||
|
~ |
|
||||||
|
~ |
|
||||||
|
~ |
|
||||||
|
[Scratch] |
|
||||||
|
other buffer |
|
||||||
|
~ |
|
||||||
|
~ |
|
||||||
|
~ |
|
||||||
|
|
|
||||||
|
]])
|
||||||
|
feed("<Left><Left><Left><BS>-")
|
||||||
|
screen:expect([[
|
||||||
|
% -^hel |
|
||||||
|
~ |
|
||||||
|
~ |
|
||||||
|
~ |
|
||||||
|
[Scratch] |
|
||||||
|
other buffer |
|
||||||
|
~ |
|
||||||
|
~ |
|
||||||
|
~ |
|
||||||
|
|
|
||||||
|
]])
|
||||||
|
feed("<End>x")
|
||||||
|
screen:expect([[
|
||||||
|
% -helx^ |
|
||||||
|
~ |
|
||||||
|
~ |
|
||||||
|
~ |
|
||||||
|
[Scratch] |
|
||||||
|
other buffer |
|
||||||
|
~ |
|
||||||
|
~ |
|
||||||
|
~ |
|
||||||
|
|
|
||||||
|
]])
|
||||||
|
feed("<C-U>exit\n")
|
||||||
|
screen:expect([[
|
||||||
|
^other buffer |
|
||||||
|
~ |
|
||||||
|
~ |
|
||||||
|
~ |
|
||||||
|
~ |
|
||||||
|
~ |
|
||||||
|
~ |
|
||||||
|
~ |
|
||||||
|
~ |
|
||||||
|
|
|
||||||
|
]])
|
||||||
|
end)
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
Reference in New Issue
Block a user