mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
ext_cmdline: interact with cmdline window
This commit is contained in:
parent
bed0a3a842
commit
91d8e26bc7
@ -2810,7 +2810,10 @@ void cmdline_screen_cleared(void)
|
|||||||
CmdlineInfo *prev_ccline = ccline.prev_ccline;
|
CmdlineInfo *prev_ccline = ccline.prev_ccline;
|
||||||
while (prev_level > 0 && prev_ccline) {
|
while (prev_level > 0 && prev_ccline) {
|
||||||
if (prev_ccline->level == prev_level) {
|
if (prev_ccline->level == prev_level) {
|
||||||
ui_ext_cmdline_show(prev_ccline);
|
// don't redraw a cmdline already shown in the cmdline window
|
||||||
|
if (prev_level != cmdwin_level) {
|
||||||
|
ui_ext_cmdline_show(prev_ccline);
|
||||||
|
}
|
||||||
prev_level--;
|
prev_level--;
|
||||||
}
|
}
|
||||||
prev_ccline = prev_ccline->prev_ccline;
|
prev_ccline = prev_ccline->prev_ccline;
|
||||||
@ -5781,6 +5784,7 @@ static int ex_window(void)
|
|||||||
return K_IGNORE;
|
return K_IGNORE;
|
||||||
}
|
}
|
||||||
cmdwin_type = get_cmdline_type();
|
cmdwin_type = get_cmdline_type();
|
||||||
|
cmdwin_level = ccline.level;
|
||||||
|
|
||||||
// Create empty command-line buffer.
|
// Create empty command-line buffer.
|
||||||
buf_open_scratch(0, "[Command Line]");
|
buf_open_scratch(0, "[Command Line]");
|
||||||
@ -5833,6 +5837,9 @@ static int ex_window(void)
|
|||||||
curwin->w_cursor.col = ccline.cmdpos;
|
curwin->w_cursor.col = ccline.cmdpos;
|
||||||
changed_line_abv_curs();
|
changed_line_abv_curs();
|
||||||
invalidate_botline();
|
invalidate_botline();
|
||||||
|
if (ui_is_external(kUICmdline)) {
|
||||||
|
ui_call_cmdline_hide(ccline.level);
|
||||||
|
}
|
||||||
redraw_later(SOME_VALID);
|
redraw_later(SOME_VALID);
|
||||||
|
|
||||||
// Save the command line info, can be used recursively.
|
// Save the command line info, can be used recursively.
|
||||||
@ -5875,6 +5882,7 @@ static int ex_window(void)
|
|||||||
// Restore the command line info.
|
// Restore the command line info.
|
||||||
restore_cmdline(&save_ccline);
|
restore_cmdline(&save_ccline);
|
||||||
cmdwin_type = 0;
|
cmdwin_type = 0;
|
||||||
|
cmdwin_level = 0;
|
||||||
|
|
||||||
exmode_active = save_exmode;
|
exmode_active = save_exmode;
|
||||||
|
|
||||||
|
@ -981,9 +981,10 @@ EXTERN int fill_diff INIT(= '-');
|
|||||||
EXTERN int km_stopsel INIT(= FALSE);
|
EXTERN int km_stopsel INIT(= FALSE);
|
||||||
EXTERN int km_startsel INIT(= FALSE);
|
EXTERN int km_startsel INIT(= FALSE);
|
||||||
|
|
||||||
EXTERN int cedit_key INIT(= -1); /* key value of 'cedit' option */
|
EXTERN int cedit_key INIT(= -1); ///< key value of 'cedit' option
|
||||||
EXTERN int cmdwin_type INIT(= 0); /* type of cmdline window or 0 */
|
EXTERN int cmdwin_type INIT(= 0); ///< type of cmdline window or 0
|
||||||
EXTERN int cmdwin_result INIT(= 0); /* result of cmdline window or 0 */
|
EXTERN int cmdwin_result INIT(= 0); ///< result of cmdline window or 0
|
||||||
|
EXTERN int cmdwin_level INIT(= 0); ///< cmdline level of cmdline window or 0
|
||||||
|
|
||||||
EXTERN char_u no_lines_msg[] INIT(= N_("--No lines in buffer--"));
|
EXTERN char_u no_lines_msg[] INIT(= N_("--No lines in buffer--"));
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ describe('external cmdline', function()
|
|||||||
indent = 0,
|
indent = 0,
|
||||||
pos = 3,
|
pos = 3,
|
||||||
prompt = "",
|
prompt = "",
|
||||||
}}
|
}}
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
^ |
|
^ |
|
||||||
~ |
|
~ |
|
||||||
@ -345,19 +345,116 @@ describe('external cmdline', function()
|
|||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
pending("works with cmdline window", function()
|
it("works with cmdline window", function()
|
||||||
feed(':sign<c-f>')
|
feed(':make')
|
||||||
|
screen:expect([[
|
||||||
|
^ |
|
||||||
|
~ |
|
||||||
|
~ |
|
||||||
|
~ |
|
||||||
|
|
|
||||||
|
]], nil, nil, function()
|
||||||
|
eq({{
|
||||||
|
content = { { {}, "make" } },
|
||||||
|
firstc = ":",
|
||||||
|
indent = 0,
|
||||||
|
pos = 4,
|
||||||
|
prompt = ""
|
||||||
|
}}, cmdline)
|
||||||
|
end)
|
||||||
|
|
||||||
|
feed('<c-f>')
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
|
|
|
|
||||||
[No Name] |
|
[No Name] |
|
||||||
:sign^ |
|
:make^ |
|
||||||
[Command Line] |
|
[Command Line] |
|
||||||
|
|
|
|
||||||
]], nil, nil, function()
|
]], nil, nil, function()
|
||||||
eq({}, cmdline)
|
eq({}, cmdline)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
feed(":blargh")
|
-- nested cmdline
|
||||||
|
feed(':yank')
|
||||||
|
screen:expect([[
|
||||||
|
|
|
||||||
|
[No Name] |
|
||||||
|
:make^ |
|
||||||
|
[Command Line] |
|
||||||
|
|
|
||||||
|
]], nil, nil, function()
|
||||||
|
eq({nil, {
|
||||||
|
content = { { {}, "yank" } },
|
||||||
|
firstc = ":",
|
||||||
|
indent = 0,
|
||||||
|
pos = 4,
|
||||||
|
prompt = ""
|
||||||
|
}}, cmdline)
|
||||||
|
end)
|
||||||
|
|
||||||
|
cmdline = {}
|
||||||
|
command("redraw!")
|
||||||
|
screen:expect([[
|
||||||
|
|
|
||||||
|
[No Name] |
|
||||||
|
:make |
|
||||||
|
[Command Line] |
|
||||||
|
^ |
|
||||||
|
]], nil, nil, function()
|
||||||
|
eq({nil, {
|
||||||
|
content = { { {}, "yank" } },
|
||||||
|
firstc = ":",
|
||||||
|
indent = 0,
|
||||||
|
pos = 4,
|
||||||
|
prompt = ""
|
||||||
|
}}, cmdline)
|
||||||
|
end)
|
||||||
|
|
||||||
|
feed("<c-c>")
|
||||||
|
screen:expect([[
|
||||||
|
|
|
||||||
|
[No Name] |
|
||||||
|
:make^ |
|
||||||
|
[Command Line] |
|
||||||
|
|
|
||||||
|
]], nil, nil, function()
|
||||||
|
eq({}, cmdline)
|
||||||
|
end)
|
||||||
|
|
||||||
|
feed("<c-c>")
|
||||||
|
screen:expect([[
|
||||||
|
|
|
||||||
|
[No Name] |
|
||||||
|
:make^ |
|
||||||
|
[Command Line] |
|
||||||
|
|
|
||||||
|
]], nil, nil, function()
|
||||||
|
eq({{
|
||||||
|
content = { { {}, "make" } },
|
||||||
|
firstc = ":",
|
||||||
|
indent = 0,
|
||||||
|
pos = 4,
|
||||||
|
prompt = ""
|
||||||
|
}}, cmdline)
|
||||||
|
end)
|
||||||
|
|
||||||
|
cmdline = {}
|
||||||
|
command("redraw!")
|
||||||
|
screen:expect([[
|
||||||
|
|
|
||||||
|
~ |
|
||||||
|
~ |
|
||||||
|
~ |
|
||||||
|
^ |
|
||||||
|
]], nil, nil, function()
|
||||||
|
eq({{
|
||||||
|
content = { { {}, "make" } },
|
||||||
|
firstc = ":",
|
||||||
|
indent = 0,
|
||||||
|
pos = 4,
|
||||||
|
prompt = ""
|
||||||
|
}}, cmdline)
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('works with highlighted cmdline', function()
|
it('works with highlighted cmdline', function()
|
||||||
|
Loading…
Reference in New Issue
Block a user