mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 11:28:22 +00:00
Merge #8461 from bfredl/scrollstatus
This commit is contained in:
@@ -295,10 +295,7 @@ static uint8_t *command_line_enter(int firstc, long count, int indent)
|
|||||||
|
|
||||||
redir_off = true; // don't redirect the typed command
|
redir_off = true; // don't redirect the typed command
|
||||||
if (!cmd_silent) {
|
if (!cmd_silent) {
|
||||||
s->i = msg_scrolled;
|
|
||||||
msg_scrolled = 0; // avoid wait_return message
|
|
||||||
gotocmdline(true);
|
gotocmdline(true);
|
||||||
msg_scrolled += s->i;
|
|
||||||
redrawcmdprompt(); // draw prompt or indent
|
redrawcmdprompt(); // draw prompt or indent
|
||||||
set_cmdspos();
|
set_cmdspos();
|
||||||
}
|
}
|
||||||
@@ -349,7 +346,7 @@ static uint8_t *command_line_enter(int firstc, long count, int indent)
|
|||||||
|
|
||||||
// redraw the statusline for statuslines that display the current mode
|
// redraw the statusline for statuslines that display the current mode
|
||||||
// using the mode() function.
|
// using the mode() function.
|
||||||
if (KeyTyped) {
|
if (KeyTyped && msg_scrolled == 0) {
|
||||||
curwin->w_redr_status = true;
|
curwin->w_redr_status = true;
|
||||||
redraw_statuslines();
|
redraw_statuslines();
|
||||||
}
|
}
|
||||||
|
110
test/functional/ex_cmds/debug_spec.lua
Normal file
110
test/functional/ex_cmds/debug_spec.lua
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
|
local Screen = require('test.functional.ui.screen')
|
||||||
|
local feed = helpers.feed
|
||||||
|
local clear = helpers.clear
|
||||||
|
|
||||||
|
describe(':debug', function()
|
||||||
|
local screen
|
||||||
|
before_each(function()
|
||||||
|
clear()
|
||||||
|
screen = Screen.new(50, 14)
|
||||||
|
screen:set_default_attr_ids({
|
||||||
|
[1] = {bold = true, foreground = Screen.colors.Blue1},
|
||||||
|
[2] = {bold = true, reverse = true},
|
||||||
|
[3] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red},
|
||||||
|
[4] = {bold = true, foreground = Screen.colors.SeaGreen4},
|
||||||
|
})
|
||||||
|
screen:attach()
|
||||||
|
end)
|
||||||
|
it('scrolls messages correctly', function()
|
||||||
|
feed(':echoerr bork<cr>')
|
||||||
|
screen:expect([[
|
||||||
|
|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{2: }|
|
||||||
|
{3:E121: Undefined variable: bork} |
|
||||||
|
{3:E15: Invalid expression: bork} |
|
||||||
|
{4:Press ENTER or type command to continue}^ |
|
||||||
|
]])
|
||||||
|
|
||||||
|
feed(':debug echo "aa"| echo "bb"<cr>')
|
||||||
|
screen:expect([[
|
||||||
|
|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{2: }|
|
||||||
|
{3:E121: Undefined variable: bork} |
|
||||||
|
{3:E15: Invalid expression: bork} |
|
||||||
|
Entering Debug mode. Type "cont" to continue. |
|
||||||
|
cmd: echo "aa"| echo "bb" |
|
||||||
|
>^ |
|
||||||
|
]])
|
||||||
|
|
||||||
|
feed('step<cr>')
|
||||||
|
screen:expect([[
|
||||||
|
|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{2: }|
|
||||||
|
{3:E121: Undefined variable: bork} |
|
||||||
|
{3:E15: Invalid expression: bork} |
|
||||||
|
Entering Debug mode. Type "cont" to continue. |
|
||||||
|
cmd: echo "aa"| echo "bb" |
|
||||||
|
>step |
|
||||||
|
aa |
|
||||||
|
cmd: echo "bb" |
|
||||||
|
>^ |
|
||||||
|
]])
|
||||||
|
|
||||||
|
feed('step<cr>')
|
||||||
|
screen:expect([[
|
||||||
|
|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{2: }|
|
||||||
|
{3:E121: Undefined variable: bork} |
|
||||||
|
{3:E15: Invalid expression: bork} |
|
||||||
|
Entering Debug mode. Type "cont" to continue. |
|
||||||
|
cmd: echo "aa"| echo "bb" |
|
||||||
|
>step |
|
||||||
|
aa |
|
||||||
|
cmd: echo "bb" |
|
||||||
|
>step |
|
||||||
|
bb |
|
||||||
|
{4:Press ENTER or type command to continue}^ |
|
||||||
|
]])
|
||||||
|
|
||||||
|
feed('<cr>')
|
||||||
|
screen:expect([[
|
||||||
|
^ |
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
|
|
||||||
|
]])
|
||||||
|
end)
|
||||||
|
end)
|
@@ -22,6 +22,8 @@ describe('external cmdline', function()
|
|||||||
[1] = {bold = true, foreground = Screen.colors.Blue1},
|
[1] = {bold = true, foreground = Screen.colors.Blue1},
|
||||||
[2] = {reverse = true},
|
[2] = {reverse = true},
|
||||||
[3] = {bold = true, reverse = true},
|
[3] = {bold = true, reverse = true},
|
||||||
|
[4] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red},
|
||||||
|
[5] = {bold = true, foreground = Screen.colors.SeaGreen4},
|
||||||
})
|
})
|
||||||
screen:set_on_event_handler(function(name, data)
|
screen:set_on_event_handler(function(name, data)
|
||||||
if name == "cmdline_show" then
|
if name == "cmdline_show" then
|
||||||
@@ -157,24 +159,87 @@ describe('external cmdline', function()
|
|||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("redraws statusline on entering", function()
|
describe("redraws statusline on entering", function()
|
||||||
command('set laststatus=2')
|
before_each(function()
|
||||||
command('set statusline=%{mode()}')
|
command('set laststatus=2')
|
||||||
feed(':')
|
command('set statusline=%{mode()}')
|
||||||
screen:expect([[
|
end)
|
||||||
|
|
|
||||||
{1:~ }|
|
it('from normal mode', function()
|
||||||
{1:~ }|
|
feed(':')
|
||||||
{3:c^ }|
|
screen:expect([[
|
||||||
|
|
|
|
||||||
]], nil, nil, function()
|
{1:~ }|
|
||||||
eq({{
|
{1:~ }|
|
||||||
content = { { {}, "" } },
|
{3:c^ }|
|
||||||
firstc = ":",
|
|
|
||||||
indent = 0,
|
]], nil, nil, function()
|
||||||
pos = 0,
|
eq({{
|
||||||
prompt = ""
|
content = { { {}, "" } },
|
||||||
}}, cmdline)
|
firstc = ":",
|
||||||
|
indent = 0,
|
||||||
|
pos = 0,
|
||||||
|
prompt = ""
|
||||||
|
}}, cmdline)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
|
||||||
|
it('but not with scrolled messages', function()
|
||||||
|
screen:try_resize(50,10)
|
||||||
|
feed(':echoerr doesnotexist<cr>')
|
||||||
|
screen:expect([[
|
||||||
|
|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{3: }|
|
||||||
|
{4:E121: Undefined variable: doesnotexist} |
|
||||||
|
{4:E15: Invalid expression: doesnotexist} |
|
||||||
|
{5:Press ENTER or type command to continue}^ |
|
||||||
|
]])
|
||||||
|
feed(':echoerr doesnotexist<cr>')
|
||||||
|
screen:expect([[
|
||||||
|
|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{3: }|
|
||||||
|
{4:E121: Undefined variable: doesnotexist} |
|
||||||
|
{4:E15: Invalid expression: doesnotexist} |
|
||||||
|
{4:E121: Undefined variable: doesnotexist} |
|
||||||
|
{4:E15: Invalid expression: doesnotexist} |
|
||||||
|
{5:Press ENTER or type command to continue}^ |
|
||||||
|
]])
|
||||||
|
|
||||||
|
feed(':echoerr doesnotexist<cr>')
|
||||||
|
screen:expect([[
|
||||||
|
|
|
||||||
|
{1:~ }|
|
||||||
|
{3: }|
|
||||||
|
{4:E121: Undefined variable: doesnotexist} |
|
||||||
|
{4:E15: Invalid expression: doesnotexist} |
|
||||||
|
{4:E121: Undefined variable: doesnotexist} |
|
||||||
|
{4:E15: Invalid expression: doesnotexist} |
|
||||||
|
{4:E121: Undefined variable: doesnotexist} |
|
||||||
|
{4:E15: Invalid expression: doesnotexist} |
|
||||||
|
{5:Press ENTER or type command to continue}^ |
|
||||||
|
]])
|
||||||
|
|
||||||
|
feed('<cr>')
|
||||||
|
screen:expect([[
|
||||||
|
^ |
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{3:n }|
|
||||||
|
|
|
||||||
|
]])
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user