mirror of
https://github.com/neovim/neovim.git
synced 2025-09-23 11:38:31 +00:00
screen: truncate showmode messages
Before this, bottom of screen got messed up when modemsg (+ one extra space to not force terminal scroll) didn't fit on one line.
This commit is contained in:
@@ -6396,6 +6396,13 @@ int showmode(void)
|
|||||||
/* Position on the last line in the window, column 0 */
|
/* Position on the last line in the window, column 0 */
|
||||||
msg_pos_mode();
|
msg_pos_mode();
|
||||||
attr = HL_ATTR(HLF_CM); // Highlight mode
|
attr = HL_ATTR(HLF_CM); // Highlight mode
|
||||||
|
|
||||||
|
// When the screen is too narrow to show the entire mode messsage,
|
||||||
|
// avoid scrolling and truncate instead.
|
||||||
|
msg_no_more = true;
|
||||||
|
int save_lines_left = lines_left;
|
||||||
|
lines_left = 0;
|
||||||
|
|
||||||
if (do_mode) {
|
if (do_mode) {
|
||||||
MSG_PUTS_ATTR("--", attr);
|
MSG_PUTS_ATTR("--", attr);
|
||||||
// CTRL-X in Insert mode
|
// CTRL-X in Insert mode
|
||||||
@@ -6495,10 +6502,13 @@ int showmode(void)
|
|||||||
msg_didout = FALSE; /* overwrite this message */
|
msg_didout = FALSE; /* overwrite this message */
|
||||||
length = msg_col;
|
length = msg_col;
|
||||||
msg_col = 0;
|
msg_col = 0;
|
||||||
need_wait_return = nwr_save; /* never ask for hit-return for this */
|
msg_no_more = false;
|
||||||
} else if (clear_cmdline && msg_silent == 0)
|
lines_left = save_lines_left;
|
||||||
/* Clear the whole command line. Will reset "clear_cmdline". */
|
need_wait_return = nwr_save; // never ask for hit-return for this
|
||||||
|
} else if (clear_cmdline && msg_silent == 0) {
|
||||||
|
// Clear the whole command line. Will reset "clear_cmdline".
|
||||||
msg_clr_cmdline();
|
msg_clr_cmdline();
|
||||||
|
}
|
||||||
|
|
||||||
/* In Visual mode the size of the selected area must be redrawn. */
|
/* In Visual mode the size of the selected area must be redrawn. */
|
||||||
if (VIsual_active)
|
if (VIsual_active)
|
||||||
|
@@ -651,9 +651,10 @@ describe('Screen', function()
|
|||||||
it('has minimum width/height values', function()
|
it('has minimum width/height values', function()
|
||||||
screen:try_resize(1, 1)
|
screen:try_resize(1, 1)
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
{2:-- INS^ERT --}|
|
resize^ |
|
||||||
|
|
{2:-- INSERT -} |
|
||||||
]])
|
]])
|
||||||
|
|
||||||
feed('<esc>:ls')
|
feed('<esc>:ls')
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
resize |
|
resize |
|
||||||
|
Reference in New Issue
Block a user