mirror of
https://github.com/neovim/neovim.git
synced 2025-09-24 03:58:32 +00:00
feat: cmdheight=0 #16251
Fix https://github.com/neovim/neovim/issues/1004 Limitation: All outputs need hit-enter prompt. Related: https://github.com/neovim/neovim/pull/6732 https://github.com/neovim/neovim/pull/4382
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
#include "nvim/eval.h"
|
||||
#include "nvim/ex_docmd.h"
|
||||
#include "nvim/ex_eval.h"
|
||||
#include "nvim/ex_getln.h"
|
||||
#include "nvim/fileio.h"
|
||||
#include "nvim/func_attr.h"
|
||||
#include "nvim/garray.h"
|
||||
@@ -163,6 +164,7 @@ void msg_grid_validate(void)
|
||||
{
|
||||
grid_assign_handle(&msg_grid);
|
||||
bool should_alloc = msg_use_grid();
|
||||
int max_rows = Rows - p_ch;
|
||||
if (should_alloc && (msg_grid.rows != Rows || msg_grid.cols != Columns
|
||||
|| !msg_grid.chars)) {
|
||||
// TODO(bfredl): eventually should be set to "invalid". I e all callers
|
||||
@@ -174,7 +176,7 @@ void msg_grid_validate(void)
|
||||
msg_grid.dirty_col = xcalloc(Rows, sizeof(*msg_grid.dirty_col));
|
||||
|
||||
// Tricky: allow resize while pager is active
|
||||
int pos = msg_scrolled ? msg_grid_pos : Rows - p_ch;
|
||||
int pos = msg_scrolled ? msg_grid_pos : max_rows;
|
||||
ui_comp_put_grid(&msg_grid, pos, 0, msg_grid.rows, msg_grid.cols,
|
||||
false, true);
|
||||
ui_call_grid_resize(msg_grid.handle, msg_grid.cols, msg_grid.rows);
|
||||
@@ -184,7 +186,7 @@ void msg_grid_validate(void)
|
||||
msg_grid.focusable = false;
|
||||
msg_grid_adj.target = &msg_grid;
|
||||
if (!msg_scrolled) {
|
||||
msg_grid_set_pos(Rows - p_ch, false);
|
||||
msg_grid_set_pos(max_rows, false);
|
||||
}
|
||||
} else if (!should_alloc && msg_grid.chars) {
|
||||
ui_comp_remove_grid(&msg_grid);
|
||||
@@ -195,8 +197,8 @@ void msg_grid_validate(void)
|
||||
msg_grid_adj.row_offset = 0;
|
||||
msg_grid_adj.target = &default_grid;
|
||||
redraw_cmdline = true;
|
||||
} else if (msg_grid.chars && !msg_scrolled && msg_grid_pos != Rows - p_ch) {
|
||||
msg_grid_set_pos(Rows - p_ch, false);
|
||||
} else if (msg_grid.chars && !msg_scrolled && msg_grid_pos != max_rows) {
|
||||
msg_grid_set_pos(max_rows, false);
|
||||
}
|
||||
|
||||
if (msg_grid.chars && cmdline_row < msg_grid_pos) {
|
||||
@@ -1386,7 +1388,9 @@ void msg_start(void)
|
||||
need_fileinfo = false;
|
||||
}
|
||||
|
||||
if (need_clr_eos) {
|
||||
bool no_msg_area = !ui_has(kUIMessages) && p_ch < 1;
|
||||
|
||||
if (need_clr_eos || (no_msg_area && redrawing_cmdline)) {
|
||||
// Halfway an ":echo" command and getting an (error) message: clear
|
||||
// any text from the command.
|
||||
need_clr_eos = false;
|
||||
@@ -1395,10 +1399,11 @@ void msg_start(void)
|
||||
|
||||
if (!msg_scroll && full_screen) { // overwrite last message
|
||||
msg_row = cmdline_row;
|
||||
msg_col =
|
||||
cmdmsg_rl ? Columns - 1 :
|
||||
0;
|
||||
} else if (msg_didout) { // start message on next line
|
||||
msg_col = cmdmsg_rl ? Columns - 1 : 0;
|
||||
if (no_msg_area && get_cmdprompt() == NULL) {
|
||||
msg_row -= 1;
|
||||
}
|
||||
} else if (msg_didout || no_msg_area) { // start message on next line
|
||||
msg_putchar('\n');
|
||||
did_return = true;
|
||||
cmdline_row = msg_row;
|
||||
@@ -3055,7 +3060,7 @@ void repeat_message(void)
|
||||
/// Skip this when ":silent" was used, no need to clear for redirection.
|
||||
void msg_clr_eos(void)
|
||||
{
|
||||
if (msg_silent == 0) {
|
||||
if (msg_silent == 0 && p_ch > 0) {
|
||||
msg_clr_eos_force();
|
||||
}
|
||||
}
|
||||
@@ -3077,10 +3082,11 @@ void msg_clr_eos_force(void)
|
||||
msg_row = msg_grid_pos;
|
||||
}
|
||||
|
||||
grid_fill(&msg_grid_adj, msg_row, msg_row + 1, msg_startcol, msg_endcol, ' ',
|
||||
' ', HL_ATTR(HLF_MSG));
|
||||
grid_fill(&msg_grid_adj, msg_row + 1, Rows, 0, Columns, ' ', ' ',
|
||||
HL_ATTR(HLF_MSG));
|
||||
grid_fill(&msg_grid_adj, msg_row, msg_row + 1, msg_startcol, msg_endcol,
|
||||
' ', ' ', HL_ATTR(HLF_MSG));
|
||||
if (p_ch > 0) {
|
||||
grid_fill(&msg_grid_adj, msg_row + 1, Rows, 0, Columns, ' ', ' ', HL_ATTR(HLF_MSG));
|
||||
}
|
||||
|
||||
redraw_cmdline = true; // overwritten the command line
|
||||
if (msg_row < Rows - 1 || msg_col == (cmdmsg_rl ? Columns : 0)) {
|
||||
|
Reference in New Issue
Block a user