mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #27867 from bfredl/intro_multigrid
fix(ui): startup intro message should be visible with ext_multigrid
This commit is contained in:
commit
b7779c5146
@ -32,6 +32,7 @@
|
|||||||
#include "nvim/option_vars.h"
|
#include "nvim/option_vars.h"
|
||||||
#include "nvim/os/os.h"
|
#include "nvim/os/os.h"
|
||||||
#include "nvim/strings.h"
|
#include "nvim/strings.h"
|
||||||
|
#include "nvim/ui.h"
|
||||||
#include "nvim/version.h"
|
#include "nvim/version.h"
|
||||||
|
|
||||||
// for ":version", ":intro", and "nvim --version"
|
// for ":version", ":intro", and "nvim --version"
|
||||||
@ -2724,7 +2725,7 @@ bool may_show_intro(void)
|
|||||||
/// Or with the ":intro" command (for Sven :-).
|
/// Or with the ":intro" command (for Sven :-).
|
||||||
///
|
///
|
||||||
/// @param colon true for ":intro"
|
/// @param colon true for ":intro"
|
||||||
void intro_message(int colon)
|
void intro_message(bool colon)
|
||||||
{
|
{
|
||||||
static char *(lines[]) = {
|
static char *(lines[]) = {
|
||||||
N_(NVIM_VERSION_LONG),
|
N_(NVIM_VERSION_LONG),
|
||||||
@ -2801,7 +2802,7 @@ void intro_message(int colon)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (*mesg != NUL) {
|
if (*mesg != NUL) {
|
||||||
do_intro_line(row, mesg, 0);
|
do_intro_line(row, mesg, colon);
|
||||||
}
|
}
|
||||||
row++;
|
row++;
|
||||||
|
|
||||||
@ -2812,7 +2813,7 @@ void intro_message(int colon)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void do_intro_line(int row, char *mesg, int attr)
|
static void do_intro_line(int row, char *mesg, bool colon)
|
||||||
{
|
{
|
||||||
int l;
|
int l;
|
||||||
|
|
||||||
@ -2825,7 +2826,12 @@ static void do_intro_line(int row, char *mesg, int attr)
|
|||||||
col = 0;
|
col = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
grid_line_start(&default_grid, row);
|
ScreenGrid *grid = &default_grid;
|
||||||
|
if (!colon && ui_has(kUIMultigrid)) {
|
||||||
|
grid = &firstwin->w_grid;
|
||||||
|
}
|
||||||
|
|
||||||
|
grid_line_start(grid, row);
|
||||||
// Split up in parts to highlight <> items differently.
|
// Split up in parts to highlight <> items differently.
|
||||||
for (char *p = mesg; *p != NUL; p += l) {
|
for (char *p = mesg; *p != NUL; p += l) {
|
||||||
for (l = 0;
|
for (l = 0;
|
||||||
@ -2834,7 +2840,7 @@ static void do_intro_line(int row, char *mesg, int attr)
|
|||||||
l += utfc_ptr2len(p + l) - 1;
|
l += utfc_ptr2len(p + l) - 1;
|
||||||
}
|
}
|
||||||
assert(row <= INT_MAX && col <= INT_MAX);
|
assert(row <= INT_MAX && col <= INT_MAX);
|
||||||
col += grid_line_puts(col, p, l, *p == '<' ? HL_ATTR(HLF_8) : attr);
|
col += grid_line_puts(col, p, l, *p == '<' ? HL_ATTR(HLF_8) : 0);
|
||||||
}
|
}
|
||||||
grid_line_flush();
|
grid_line_flush();
|
||||||
}
|
}
|
||||||
|
@ -1751,6 +1751,82 @@ describe('ui/ext_messages', function()
|
|||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('ui/ext_multigrid supports intro screen', function()
|
||||||
|
clear { args_rm = { '--headless' }, args = { '--cmd', 'set shortmess-=I' } }
|
||||||
|
local screen = Screen.new(80, 24)
|
||||||
|
screen:attach({ rgb = true, ext_multigrid = true })
|
||||||
|
screen:set_default_attr_ids {
|
||||||
|
[1] = { bold = true, foreground = Screen.colors.Blue1 },
|
||||||
|
[2] = { foreground = Screen.colors.Grey100, background = Screen.colors.Red },
|
||||||
|
[3] = { bold = true },
|
||||||
|
[4] = { bold = true, foreground = Screen.colors.SeaGreen4 },
|
||||||
|
[5] = { foreground = Screen.colors.Blue1 },
|
||||||
|
}
|
||||||
|
|
||||||
|
screen:expect {
|
||||||
|
grid = [[
|
||||||
|
## grid 1
|
||||||
|
[2:--------------------------------------------------------------------------------]|*23
|
||||||
|
[3:--------------------------------------------------------------------------------]|
|
||||||
|
## grid 2
|
||||||
|
^ |
|
||||||
|
{1:~ }|*4
|
||||||
|
{MATCH:.*}|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }Nvim is open source and freely distributable{1: }|
|
||||||
|
{1:~ }https://neovim.io/#chat{1: }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }type :help nvim{5:<Enter>} if you are new! {1: }|
|
||||||
|
{1:~ }type :checkhealth{5:<Enter>} to optimize Nvim{1: }|
|
||||||
|
{1:~ }type :q{5:<Enter>} to exit {1: }|
|
||||||
|
{1:~ }type :help{5:<Enter>} for help {1: }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~{MATCH: +}}type :help news{5:<Enter>} to see changes in v{MATCH:%d+%.%d+}{1:{MATCH: +}}|
|
||||||
|
{1:~ }|
|
||||||
|
{MATCH:.*}|*2
|
||||||
|
{1:~ }|*4
|
||||||
|
## grid 3
|
||||||
|
|
|
||||||
|
]],
|
||||||
|
win_viewport = {
|
||||||
|
[2] = {
|
||||||
|
win = 1000,
|
||||||
|
topline = 0,
|
||||||
|
botline = 2,
|
||||||
|
curline = 0,
|
||||||
|
curcol = 0,
|
||||||
|
linecount = 1,
|
||||||
|
sum_scroll_delta = 0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
feed 'ix'
|
||||||
|
screen:expect {
|
||||||
|
grid = [[
|
||||||
|
## grid 1
|
||||||
|
[2:--------------------------------------------------------------------------------]|*23
|
||||||
|
[3:--------------------------------------------------------------------------------]|
|
||||||
|
## grid 2
|
||||||
|
x^ |
|
||||||
|
{1:~ }|*22
|
||||||
|
## grid 3
|
||||||
|
{3:-- INSERT --} |
|
||||||
|
]],
|
||||||
|
win_viewport = {
|
||||||
|
[2] = {
|
||||||
|
win = 1000,
|
||||||
|
topline = 0,
|
||||||
|
botline = 2,
|
||||||
|
curline = 0,
|
||||||
|
curcol = 1,
|
||||||
|
linecount = 1,
|
||||||
|
sum_scroll_delta = 0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end)
|
||||||
|
|
||||||
describe('ui/msg_puts_printf', function()
|
describe('ui/msg_puts_printf', function()
|
||||||
it('output multibyte characters correctly', function()
|
it('output multibyte characters correctly', function()
|
||||||
local screen
|
local screen
|
||||||
|
Loading…
Reference in New Issue
Block a user