msg: do not scroll entire screen (#8088)

This commit is contained in:
Björn Linse 2018-03-31 11:12:27 +02:00 committed by Justin M. Keyes
parent 362346f563
commit 98e7112390
27 changed files with 247 additions and 86 deletions

View File

@ -2036,6 +2036,11 @@ A jump table for the options with a short description can be found at |Q_op|.
column of the last screen line. Overrules "lastline". column of the last screen line. Overrules "lastline".
uhex Show unprintable characters hexadecimal as <xx> uhex Show unprintable characters hexadecimal as <xx>
instead of using ^C and ~C. instead of using ^C and ~C.
msgsep When showing messages longer than 'cmdheight' lines,
only scroll the message lines and not the entire
screen. This also shows a separator line filled with
chars determined by 'fillchars' option, and
highlighted with the |MsgSeparator| group.
When neither "lastline" nor "truncate" is included, a last line that When neither "lastline" nor "truncate" is included, a last line that
doesn't fit is replaced with "@" lines. doesn't fit is replaced with "@" lines.
@ -2390,6 +2395,7 @@ A jump table for the options with a short description can be found at |Q_op|.
vert:c '│' or '|' vertical separators |:vsplit| vert:c '│' or '|' vertical separators |:vsplit|
fold:c '·' or '-' filling 'foldtext' fold:c '·' or '-' filling 'foldtext'
diff:c '-' deleted lines of the 'diff' option diff:c '-' deleted lines of the 'diff' option
msgsep:c ' ' message separator 'display'
Any one that is omitted will fall back to the default. For "stl" and Any one that is omitted will fall back to the default. For "stl" and
"stlnc" the space will be used when there is highlighting, '^' or '=' "stlnc" the space will be used when there is highlighting, '^' or '='

View File

@ -4909,6 +4909,8 @@ MatchParen The character under the cursor or just before it, if it
*hl-ModeMsg* *hl-ModeMsg*
ModeMsg 'showmode' message (e.g., "-- INSERT --") ModeMsg 'showmode' message (e.g., "-- INSERT --")
*hl-MsgSeparator*
MsgSeparator Separator for scrolled messages, `msgsep` flag of 'display'
*hl-MoreMsg* *hl-MoreMsg*
MoreMsg |more-prompt| MoreMsg |more-prompt|
*hl-NonText* *hl-NonText*

View File

@ -34,7 +34,7 @@ a complete and centralized reference of those differences.
- 'complete' doesn't include "i" - 'complete' doesn't include "i"
- 'cscopeverbose' is enabled - 'cscopeverbose' is enabled
- 'directory' defaults to ~/.local/share/nvim/swap// (|xdg|), auto-created - 'directory' defaults to ~/.local/share/nvim/swap// (|xdg|), auto-created
- 'display' defaults to "lastline" - 'display' defaults to "lastline,msgsep"
- 'fillchars' defaults (in effect) to "vert:│,fold:·" - 'fillchars' defaults (in effect) to "vert:│,fold:·"
- 'formatoptions' defaults to "tcqj" - 'formatoptions' defaults to "tcqj"
- 'history' defaults to 10000 (the maximum) - 'history' defaults to 10000 (the maximum)
@ -130,7 +130,9 @@ Some `CTRL-SHIFT-...` key chords are distinguished from `CTRL-...` variants
Options: Options:
'cpoptions' flags: |cpo-_| 'cpoptions' flags: |cpo-_|
'display' flag `msgsep` to minimize scrolling when showing messages
'guicursor' works in the terminal 'guicursor' works in the terminal
'fillchars' flag `msgsep` (see 'display' above)
'inccommand' shows interactive results for |:substitute|-like commands 'inccommand' shows interactive results for |:substitute|-like commands
'scrollback' 'scrollback'
'statusline' supports unlimited alignment sections 'statusline' supports unlimited alignment sections
@ -164,6 +166,7 @@ Events:
Highlight groups: Highlight groups:
|hl-NormalNC| highlights non-current windows |hl-NormalNC| highlights non-current windows
|hl-MsgSeparator| highlights separator for scrolled messages
|hl-QuickFixLine| |hl-QuickFixLine|
|hl-Substitute| |hl-Substitute|
|hl-TermCursor| |hl-TermCursor|

View File

@ -947,6 +947,7 @@ EXTERN int fill_stlnc INIT(= ' ');
EXTERN int fill_vert INIT(= 9474); // │ EXTERN int fill_vert INIT(= 9474); // │
EXTERN int fill_fold INIT(= 183); // · EXTERN int fill_fold INIT(= 183); // ·
EXTERN int fill_diff INIT(= '-'); EXTERN int fill_diff INIT(= '-');
EXTERN int fill_msgsep INIT(= ' ');
/* Whether 'keymodel' contains "stopsel" and "startsel". */ /* Whether 'keymodel' contains "stopsel" and "startsel". */
EXTERN int km_stopsel INIT(= FALSE); EXTERN int km_stopsel INIT(= FALSE);

View File

@ -87,6 +87,7 @@ typedef enum {
, HLF_QFL // selected quickfix line , HLF_QFL // selected quickfix line
, HLF_0 // Whitespace , HLF_0 // Whitespace
, HLF_INACTIVE // NormalNC: Normal text in non-current windows , HLF_INACTIVE // NormalNC: Normal text in non-current windows
, HLF_MSGSEP // message separator line
, HLF_COUNT // MUST be the last one , HLF_COUNT // MUST be the last one
} hlf_T; } hlf_T;
@ -137,7 +138,8 @@ EXTERN const char *hlf_names[] INIT(= {
[HLF_MC] = "ColorColumn", [HLF_MC] = "ColorColumn",
[HLF_QFL] = "QuickFixLine", [HLF_QFL] = "QuickFixLine",
[HLF_0] = "Whitespace", [HLF_0] = "Whitespace",
[HLF_INACTIVE] = "NormalNC" [HLF_INACTIVE] = "NormalNC",
[HLF_MSGSEP] = "MsgSeparator",
}); });

View File

@ -1875,14 +1875,30 @@ bool message_filtered(char_u *msg)
return cmdmod.filter_force ? match : !match; return cmdmod.filter_force ? match : !match;
} }
/// including horizontal separator
int msg_scrollsize(void)
{
return msg_scrolled + p_ch + 1;
}
/* /*
* Scroll the screen up one line for displaying the next message line. * Scroll the screen up one line for displaying the next message line.
*/ */
static void msg_scroll_up(void) static void msg_scroll_up(void)
{ {
/* scrolling up always works */ if (dy_flags & DY_MSGSEP) {
if (msg_scrolled == 0) {
screen_fill(Rows-p_ch-1, Rows-p_ch, 0, (int)Columns,
fill_msgsep, fill_msgsep, hl_attr(HLF_MSGSEP));
}
int nscroll = MIN(msg_scrollsize()+1, Rows);
ui_call_set_scroll_region(Rows-nscroll, Rows-1, 0, Columns-1);
screen_del_lines(Rows-nscroll, 0, 1, nscroll, NULL);
ui_reset_scroll_region();
} else {
screen_del_lines(0, 0, 1, (int)Rows, NULL); screen_del_lines(0, 0, 1, (int)Rows, NULL);
} }
}
/* /*
* Increment "msg_scrolled". * Increment "msg_scrolled".

View File

@ -3411,6 +3411,7 @@ static char_u *set_chars_option(char_u **varp)
{ &fill_vert, "vert" , 9474 }, // │ { &fill_vert, "vert" , 9474 }, // │
{ &fill_fold, "fold" , 183 }, // · { &fill_fold, "fold" , 183 }, // ·
{ &fill_diff, "diff" , '-' }, { &fill_diff, "diff" , '-' },
{ &fill_msgsep, "msgsep", ' ' },
}; };
static struct charstab lcstab[] = { static struct charstab lcstab[] = {
{ &lcs_eol, "eol", NUL }, { &lcs_eol, "eol", NUL },

View File

@ -394,11 +394,13 @@ EXTERN char_u *p_dir; /* 'directory' */
EXTERN char_u *p_dy; /* 'display' */ EXTERN char_u *p_dy; /* 'display' */
EXTERN unsigned dy_flags; EXTERN unsigned dy_flags;
#ifdef IN_OPTION_C #ifdef IN_OPTION_C
static char *(p_dy_values[]) = { "lastline", "truncate", "uhex", NULL }; static char *(p_dy_values[]) = { "lastline", "truncate", "uhex", "msgsep",
NULL };
#endif #endif
#define DY_LASTLINE 0x001 #define DY_LASTLINE 0x001
#define DY_TRUNCATE 0x002 #define DY_TRUNCATE 0x002
#define DY_UHEX 0x004 #define DY_UHEX 0x004
#define DY_MSGSEP 0x008
EXTERN int p_ed; // 'edcompatible' EXTERN int p_ed; // 'edcompatible'
EXTERN int p_emoji; // 'emoji' EXTERN int p_emoji; // 'emoji'
EXTERN char_u *p_ead; // 'eadirection' EXTERN char_u *p_ead; // 'eadirection'

View File

@ -642,7 +642,7 @@ return {
vim=true, vim=true,
redraw={'all_windows'}, redraw={'all_windows'},
varname='p_dy', varname='p_dy',
defaults={if_true={vi="", vim="lastline"}} defaults={if_true={vi="", vim="lastline,msgsep"}}
}, },
{ {
full_name='eadirection', abbreviation='ead', full_name='eadirection', abbreviation='ead',

View File

@ -300,13 +300,25 @@ void update_screen(int type)
* if the screen was scrolled up when displaying a message, scroll it down * if the screen was scrolled up when displaying a message, scroll it down
*/ */
if (msg_scrolled) { if (msg_scrolled) {
clear_cmdline = TRUE; clear_cmdline = true;
if (msg_scrolled > Rows - 5) /* clearing is faster */ if (dy_flags & DY_MSGSEP) {
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
int valid = Rows - msg_scrollsize();
if (wp->w_winrow + wp->w_height > valid) {
wp->w_redr_type = NOT_VALID;
wp->w_lines_valid = 0;
}
if (wp->w_winrow + wp->w_height + wp->w_status_height > valid) {
wp->w_redr_status = true;
}
}
} else if (msg_scrolled > Rows - 5) { // clearing is faster
type = CLEAR; type = CLEAR;
else if (type != CLEAR) { } else if (type != CLEAR) {
check_for_delay(FALSE); check_for_delay(false);
if (screen_ins_lines(0, 0, msg_scrolled, (int)Rows, NULL) == FAIL) if (screen_ins_lines(0, 0, msg_scrolled, (int)Rows, NULL) == FAIL) {
type = CLEAR; type = CLEAR;
}
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) { FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
if (wp->w_winrow < msg_scrolled) { if (wp->w_winrow < msg_scrolled) {
if (wp->w_winrow + wp->w_height > msg_scrolled if (wp->w_winrow + wp->w_height > msg_scrolled

View File

@ -5999,6 +5999,7 @@ static const char *highlight_init_both[] = {
"default link QuickFixLine Search", "default link QuickFixLine Search",
"default link Substitute Search", "default link Substitute Search",
"default link Whitespace NonText", "default link Whitespace NonText",
"default link MsgSeparator StatusLine",
NULL NULL
}; };

View File

@ -579,7 +579,8 @@ describe('api', function()
screen:set_default_attr_ids({ screen:set_default_attr_ids({
[0] = {bold=true, foreground=Screen.colors.Blue}, [0] = {bold=true, foreground=Screen.colors.Blue},
[1] = {foreground = Screen.colors.White, background = Screen.colors.Red}, [1] = {foreground = Screen.colors.White, background = Screen.colors.Red},
[2] = {bold = true, foreground = Screen.colors.SeaGreen} [2] = {bold = true, foreground = Screen.colors.SeaGreen},
[3] = {bold = true, reverse = true},
}) })
end) end)
@ -600,11 +601,11 @@ describe('api', function()
it('shows return prompt when more than &cmdheight lines', function() it('shows return prompt when more than &cmdheight lines', function()
nvim_async('err_write', 'something happened\nvery bad\n') nvim_async('err_write', 'something happened\nvery bad\n')
screen:expect([[ screen:expect([[
|
{0:~ }| {0:~ }|
{0:~ }| {0:~ }|
{0:~ }| {0:~ }|
{0:~ }| {3: }|
{0:~ }|
{1:something happened} | {1:something happened} |
{1:very bad} | {1:very bad} |
{2:Press ENTER or type command to continue}^ | {2:Press ENTER or type command to continue}^ |
@ -614,9 +615,9 @@ describe('api', function()
it('shows return prompt after all lines are shown', function() it('shows return prompt after all lines are shown', function()
nvim_async('err_write', 'FAILURE\nERROR\nEXCEPTION\nTRACEBACK\n') nvim_async('err_write', 'FAILURE\nERROR\nEXCEPTION\nTRACEBACK\n')
screen:expect([[ screen:expect([[
|
{0:~ }| {0:~ }|
{0:~ }| {3: }|
{0:~ }|
{1:FAILURE} | {1:FAILURE} |
{1:ERROR} | {1:ERROR} |
{1:EXCEPTION} | {1:EXCEPTION} |
@ -644,11 +645,11 @@ describe('api', function()
-- shows up to &cmdheight lines -- shows up to &cmdheight lines
nvim_async('err_write', 'more fail\ntoo fail\n') nvim_async('err_write', 'more fail\ntoo fail\n')
screen:expect([[ screen:expect([[
|
{0:~ }| {0:~ }|
{0:~ }| {0:~ }|
{0:~ }| {0:~ }|
{0:~ }| {3: }|
{0:~ }|
{1:more fail} | {1:more fail} |
{1:too fail} | {1:too fail} |
{2:Press ENTER or type command to continue}^ | {2:Press ENTER or type command to continue}^ |

View File

@ -59,24 +59,25 @@ describe('cmdline autocommands', function()
[1] = {bold = true, foreground = Screen.colors.Blue1}, [1] = {bold = true, foreground = Screen.colors.Blue1},
[2] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red}, [2] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red},
[3] = {bold = true, foreground = Screen.colors.SeaGreen4}, [3] = {bold = true, foreground = Screen.colors.SeaGreen4},
[4] = {bold = true, reverse = true},
}) })
command("autocmd CmdlineEnter * echoerr 'FAIL'") command("autocmd CmdlineEnter * echoerr 'FAIL'")
command("autocmd CmdlineLeave * echoerr 'very error'") command("autocmd CmdlineLeave * echoerr 'very error'")
feed(':') feed(':')
screen:expect([[ screen:expect([[
|
{1:~ }| {1:~ }|
{1:~ }| {1:~ }|
{1:~ }| {1:~ }|
{1:~ }| {4: }|
{1:~ }|
: | : |
{2:E5500: autocmd has thrown an exception: Vim(echoerr):FAIL} | {2:E5500: autocmd has thrown an exception: Vim(echoerr):FAIL} |
:^ | :^ |
]]) ]])
feed("put ='lorem ipsum'<cr>") feed("put ='lorem ipsum'<cr>")
screen:expect([[ screen:expect([[
{1:~ }| |
{1:~ }| {4: }|
: | : |
{2:E5500: autocmd has thrown an exception: Vim(echoerr):FAIL} | {2:E5500: autocmd has thrown an exception: Vim(echoerr):FAIL} |
:put ='lorem ipsum' | :put ='lorem ipsum' |

View File

@ -83,7 +83,14 @@ local function basic_register_test(noblock)
end end
describe('clipboard', function() describe('clipboard', function()
before_each(clear) local screen
before_each(function()
clear()
screen = Screen.new(72, 4)
screen:attach()
command("set display-=msgsep")
end)
it('unnamed register works without provider', function() it('unnamed register works without provider', function()
eq('"', eval('v:register')) eq('"', eval('v:register'))
@ -92,8 +99,6 @@ describe('clipboard', function()
it('`:redir @+>` with invalid g:clipboard shows exactly one error #7184', it('`:redir @+>` with invalid g:clipboard shows exactly one error #7184',
function() function()
local screen = Screen.new(72, 4)
screen:attach()
command("let g:clipboard = 'bogus'") command("let g:clipboard = 'bogus'")
feed_command('redir @+> | :silent echo system("cat CONTRIBUTING.md") | redir END') feed_command('redir @+> | :silent echo system("cat CONTRIBUTING.md") | redir END')
screen:expect([[ screen:expect([[
@ -106,8 +111,6 @@ describe('clipboard', function()
it('`:redir @+>|bogus_cmd|redir END` + invalid g:clipboard must not recurse #7184', it('`:redir @+>|bogus_cmd|redir END` + invalid g:clipboard must not recurse #7184',
function() function()
local screen = Screen.new(72, 4)
screen:attach()
command("let g:clipboard = 'bogus'") command("let g:clipboard = 'bogus'")
feed_command('redir @+> | bogus_cmd | redir END') feed_command('redir @+> | bogus_cmd | redir END')
screen:expect([[ screen:expect([[
@ -123,8 +126,6 @@ describe('clipboard', function()
eq('', eval('provider#clipboard#Executable()')) eq('', eval('provider#clipboard#Executable()'))
eq('clipboard: invalid g:clipboard', eval('provider#clipboard#Error()')) eq('clipboard: invalid g:clipboard', eval('provider#clipboard#Error()'))
local screen = Screen.new(72, 4)
screen:attach()
command("let g:clipboard = 'bogus'") command("let g:clipboard = 'bogus'")
-- Explicit clipboard attempt, should show a hint message. -- Explicit clipboard attempt, should show a hint message.
feed_command('let @+="foo"') feed_command('let @+="foo"')
@ -493,10 +494,10 @@ describe('clipboard', function()
feed_command("let g:test_clip['+'] = ['such', 'plus', 'stuff']") feed_command("let g:test_clip['+'] = ['such', 'plus', 'stuff']")
feed_command("registers") feed_command("registers")
screen:expect([[ screen:expect([[
~ | |
~ | {0:~ }|
~ | {0:~ }|
~ | {4: }|
:registers | :registers |
{1:--- Registers ---} | {1:--- Registers ---} |
"* some{2:^J}star data{2:^J} | "* some{2:^J}star data{2:^J} |
@ -504,10 +505,11 @@ describe('clipboard', function()
": let g:test_clip['+'] = ['such', 'plus', 'stuff'] | ": let g:test_clip['+'] = ['such', 'plus', 'stuff'] |
{3:Press ENTER or type command to continue}^ | {3:Press ENTER or type command to continue}^ |
]], { ]], {
[0] = {bold = true, foreground = Screen.colors.Blue},
[1] = {bold = true, foreground = Screen.colors.Fuchsia}, [1] = {bold = true, foreground = Screen.colors.Fuchsia},
[2] = {foreground = Screen.colors.Blue}, [2] = {foreground = Screen.colors.Blue},
[3] = {bold = true, foreground = Screen.colors.SeaGreen}}, [3] = {bold = true, foreground = Screen.colors.SeaGreen},
{{bold = true, foreground = Screen.colors.Blue}}) [4] = {bold = true, reverse = true}})
feed('<cr>') -- clear out of Press ENTER screen feed('<cr>') -- clear out of Press ENTER screen
end) end)

View File

@ -106,16 +106,22 @@ describe('execute()', function()
end) end)
it('does not corrupt the command display #5422', function() it('does not corrupt the command display #5422', function()
local screen = Screen.new(70, 5) local screen = Screen.new(70, 7)
screen:attach() screen:attach()
feed(':echo execute("hi ErrorMsg")<CR>') feed(':echo execute("hi ErrorMsg")<CR>')
screen:expect([[ screen:expect([[
~ | |
~ | {1:~ }|
{1:~ }|
{2: }|
:echo execute("hi ErrorMsg") | :echo execute("hi ErrorMsg") |
ErrorMsg xxx ctermfg=15 ctermbg=1 guifg=White guibg=Red | ErrorMsg xxx ctermfg=15 ctermbg=1 guifg=White guibg=Red |
Press ENTER or type command to continue^ | {3:Press ENTER or type command to continue}^ |
]]) ]], {
[1] = {bold = true, foreground = Screen.colors.Blue1},
[2] = {bold = true, reverse = true},
[3] = {bold = true, foreground = Screen.colors.SeaGreen4},
})
feed('<CR>') feed('<CR>')
end) end)

View File

@ -58,6 +58,7 @@ before_each(function()
RBP2={background=Screen.colors.Yellow}, RBP2={background=Screen.colors.Yellow},
RBP3={background=Screen.colors.Green}, RBP3={background=Screen.colors.Green},
RBP4={background=Screen.colors.Blue}, RBP4={background=Screen.colors.Blue},
SEP={bold = true, reverse = true},
}) })
end) end)
@ -65,9 +66,9 @@ describe('input()', function()
it('works with multiline prompts', function() it('works with multiline prompts', function()
feed([[:call input("Test\nFoo")<CR>]]) feed([[:call input("Test\nFoo")<CR>]])
screen:expect([[ screen:expect([[
|
{EOB:~ }| {EOB:~ }|
{EOB:~ }| {SEP: }|
{EOB:~ }|
Test | Test |
Foo^ | Foo^ |
]]) ]])
@ -75,9 +76,9 @@ describe('input()', function()
it('works with multiline prompts and :echohl', function() it('works with multiline prompts and :echohl', function()
feed([[:echohl Test | call input("Test\nFoo")<CR>]]) feed([[:echohl Test | call input("Test\nFoo")<CR>]])
screen:expect([[ screen:expect([[
|
{EOB:~ }| {EOB:~ }|
{EOB:~ }| {SEP: }|
{EOB:~ }|
{T:Test} | {T:Test} |
{T:Foo}^ | {T:Foo}^ |
]]) ]])
@ -242,17 +243,17 @@ describe('input()', function()
it('is not hidden by :silent', function() it('is not hidden by :silent', function()
feed([[:silent call input('Foo: ')<CR>]]) feed([[:silent call input('Foo: ')<CR>]])
screen:expect([[ screen:expect([[
|
{EOB:~ }| {EOB:~ }|
{EOB:~ }| {SEP: }|
{EOB:~ }|
Foo: ^ | Foo: ^ |
| |
]]) ]])
feed('Bar') feed('Bar')
screen:expect([[ screen:expect([[
|
{EOB:~ }| {EOB:~ }|
{EOB:~ }| {SEP: }|
{EOB:~ }|
Foo: Bar^ | Foo: Bar^ |
| |
]]) ]])
@ -263,9 +264,9 @@ describe('inputdialog()', function()
it('works with multiline prompts', function() it('works with multiline prompts', function()
feed([[:call inputdialog("Test\nFoo")<CR>]]) feed([[:call inputdialog("Test\nFoo")<CR>]])
screen:expect([[ screen:expect([[
|
{EOB:~ }| {EOB:~ }|
{EOB:~ }| {SEP: }|
{EOB:~ }|
Test | Test |
Foo^ | Foo^ |
]]) ]])
@ -273,9 +274,9 @@ describe('inputdialog()', function()
it('works with multiline prompts and :echohl', function() it('works with multiline prompts and :echohl', function()
feed([[:echohl Test | call inputdialog("Test\nFoo")<CR>]]) feed([[:echohl Test | call inputdialog("Test\nFoo")<CR>]])
screen:expect([[ screen:expect([[
|
{EOB:~ }| {EOB:~ }|
{EOB:~ }| {SEP: }|
{EOB:~ }|
{T:Test} | {T:Test} |
{T:Foo}^ | {T:Foo}^ |
]]) ]])

View File

@ -27,6 +27,7 @@ describe('mappings with <Cmd>', function()
[4] = {bold = true}, [4] = {bold = true},
[5] = {background = Screen.colors.LightGrey}, [5] = {background = Screen.colors.LightGrey},
[6] = {foreground = Screen.colors.Blue1}, [6] = {foreground = Screen.colors.Blue1},
[7] = {bold = true, reverse = true},
}) })
screen:attach() screen:attach()
@ -342,11 +343,11 @@ describe('mappings with <Cmd>', function()
-- error doesn't interrupt visual mode -- error doesn't interrupt visual mode
feed('ggvw<F6>') feed('ggvw<F6>')
screen:expect([[ screen:expect([[
{5:some }short lines |
of test text |
{1:~ }| {1:~ }|
{1:~ }| {1:~ }|
{1:~ }| {7: }|
{1:~ }|
{1:~ }|
{2:Error detected while processing :} | {2:Error detected while processing :} |
{2:E605: Exception not caught: very error} | {2:E605: Exception not caught: very error} |
{3:Press ENTER or type command to continue}^ | {3:Press ENTER or type command to continue}^ |
@ -425,11 +426,11 @@ describe('mappings with <Cmd>', function()
-- error doesn't interrupt temporary visual mode -- error doesn't interrupt temporary visual mode
feed('<esc>ggvw<c-g><F6>') feed('<esc>ggvw<c-g><F6>')
screen:expect([[ screen:expect([[
{5:some }short lines |
of test text |
{1:~ }| {1:~ }|
{1:~ }| {1:~ }|
{1:~ }| {7: }|
{1:~ }|
{1:~ }|
{2:Error detected while processing :} | {2:Error detected while processing :} |
{2:E605: Exception not caught: very error} | {2:E605: Exception not caught: very error} |
{3:Press ENTER or type command to continue}^ | {3:Press ENTER or type command to continue}^ |
@ -453,11 +454,11 @@ describe('mappings with <Cmd>', function()
-- error doesn't interrupt select mode -- error doesn't interrupt select mode
feed('<esc>ggvw<c-g><F1>') feed('<esc>ggvw<c-g><F1>')
screen:expect([[ screen:expect([[
{5:some }short lines |
of test text |
{1:~ }| {1:~ }|
{1:~ }| {1:~ }|
{1:~ }| {7: }|
{1:~ }|
{1:~ }|
{2:Error detected while processing :} | {2:Error detected while processing :} |
{2:E605: Exception not caught: very error} | {2:E605: Exception not caught: very error} |
{3:Press ENTER or type command to continue}^ | {3:Press ENTER or type command to continue}^ |
@ -527,11 +528,11 @@ describe('mappings with <Cmd>', function()
-- error aborts operator-pending, operator not performed -- error aborts operator-pending, operator not performed
feed('d<F6>') feed('d<F6>')
screen:expect([[ screen:expect([[
some short lines |
of test text |
{1:~ }| {1:~ }|
{1:~ }| {1:~ }|
{1:~ }| {7: }|
{1:~ }|
{1:~ }|
{2:Error detected while processing :} | {2:Error detected while processing :} |
{2:E605: Exception not caught: very error} | {2:E605: Exception not caught: very error} |
{3:Press ENTER or type command to continue}^ | {3:Press ENTER or type command to continue}^ |
@ -571,11 +572,11 @@ describe('mappings with <Cmd>', function()
feed('<F6>') feed('<F6>')
screen:expect([[ screen:expect([[
indeed some short little lines |
of test text |
{1:~ }| {1:~ }|
{1:~ }| {1:~ }|
{1:~ }| {7: }|
{1:~ }|
{1:~ }|
{2:Error detected while processing :} | {2:Error detected while processing :} |
{2:E605: Exception not caught: very error} | {2:E605: Exception not caught: very error} |
{3:Press ENTER or type command to continue}^ | {3:Press ENTER or type command to continue}^ |
@ -675,10 +676,10 @@ describe('mappings with <Cmd>', function()
feed(':echo 2<F6>') feed(':echo 2<F6>')
screen:expect([[ screen:expect([[
some short lines |
of test text |
{1:~ }| {1:~ }|
{1:~ }| {7: }|
{1:~ }|
{1:~ }|
:echo 2 | :echo 2 |
{2:Error detected while processing :} | {2:Error detected while processing :} |
{2:E605: Exception not caught: very error} | {2:E605: Exception not caught: very error} |
@ -689,9 +690,9 @@ describe('mappings with <Cmd>', function()
eq('c', eval('mode(1)')) eq('c', eval('mode(1)'))
feed('+2<cr>') feed('+2<cr>')
screen:expect([[ screen:expect([[
{1:~ }| some short lines |
{1:~ }| of test text |
{1:~ }| {7: }|
:echo 2 | :echo 2 |
{2:Error detected while processing :} | {2:Error detected while processing :} |
{2:E605: Exception not caught: very error} | {2:E605: Exception not caught: very error} |

View File

@ -29,6 +29,7 @@ describe(':oldfiles', function()
it('shows most recently used files', function() it('shows most recently used files', function()
local screen = Screen.new(100, 5) local screen = Screen.new(100, 5)
screen:attach() screen:attach()
feed_command("set display-=msgsep")
feed_command('edit testfile1') feed_command('edit testfile1')
feed_command('edit testfile2') feed_command('edit testfile2')
feed_command('wshada') feed_command('wshada')

View File

@ -87,6 +87,7 @@ describe('debug.debug', function()
E = {foreground = Screen.colors.Grey100, background = Screen.colors.Red}, E = {foreground = Screen.colors.Grey100, background = Screen.colors.Red},
cr = {bold = true, foreground = Screen.colors.SeaGreen4}, cr = {bold = true, foreground = Screen.colors.SeaGreen4},
}) })
command("set display-=msgsep")
end) end)
it('works', function() it('works', function()
command([[lua command([[lua

View File

@ -24,6 +24,7 @@ before_each(function()
clear() clear()
screen = Screen.new(40, 8) screen = Screen.new(40, 8)
screen:attach() screen:attach()
command("set display-=msgsep")
source([[ source([[
highlight RBP1 guibg=Red highlight RBP1 guibg=Red
highlight RBP2 guibg=Yellow highlight RBP2 guibg=Yellow

View File

@ -194,8 +194,8 @@ describe('ui/cursor', function()
if m.blinkoff then m.blinkoff = 400 end if m.blinkoff then m.blinkoff = 400 end
if m.blinkwait then m.blinkwait = 700 end if m.blinkwait then m.blinkwait = 700 end
end end
if m.hl_id then m.hl_id = 48 end if m.hl_id then m.hl_id = 49 end
if m.id_lm then m.id_lm = 49 end if m.id_lm then m.id_lm = 50 end
end end
-- Assert the new expectation. -- Assert the new expectation.

View File

@ -94,6 +94,7 @@ describe('highlight defaults', function()
clear() clear()
screen = Screen.new() screen = Screen.new()
screen:attach() screen:attach()
command("set display-=msgsep")
end) end)
after_each(function() after_each(function()
@ -674,6 +675,76 @@ describe("'listchars' highlight", function()
end) end)
end) end)
describe("MsgSeparator highlight and msgsep fillchar", function()
before_each(clear)
it("works", function()
local screen = Screen.new(50,5)
screen:set_default_attr_ids({
[1] = {bold=true, foreground=Screen.colors.Blue},
[2] = {bold=true, reverse=true},
[3] = {bold = true, foreground = Screen.colors.SeaGreen4},
[4] = {background = Screen.colors.Cyan, bold = true, reverse = true},
[5] = {bold = true, background = Screen.colors.Magenta}
})
screen:attach()
-- defaults
feed_command("ls")
screen:expect([[
|
{2: }|
:ls |
1 %a "[No Name]" line 1 |
{3:Press ENTER or type command to continue}^ |
]])
feed('<cr>')
feed_command("set fillchars+=msgsep:-")
feed_command("ls")
screen:expect([[
|
{2:--------------------------------------------------}|
:ls |
1 %a "[No Name]" line 1 |
{3:Press ENTER or type command to continue}^ |
]])
-- linked to StatusLine per default
feed_command("hi StatusLine guibg=Cyan")
feed_command("ls")
screen:expect([[
|
{4:--------------------------------------------------}|
:ls |
1 %a "[No Name]" line 1 |
{3:Press ENTER or type command to continue}^ |
]])
-- but can be unlinked
feed_command("hi clear MsgSeparator")
feed_command("hi MsgSeparator guibg=Magenta gui=bold")
feed_command("ls")
screen:expect([[
|
{5:--------------------------------------------------}|
:ls |
1 %a "[No Name]" line 1 |
{3:Press ENTER or type command to continue}^ |
]])
-- when display doesn't contain msgsep, these options have no effect
feed_command("set display-=msgsep")
feed_command("ls")
screen:expect([[
{1:~ }|
{1:~ }|
:ls |
1 %a "[No Name]" line 1 |
{3:Press ENTER or type command to continue}^ |
]])
end)
end)
describe("'winhighlight' highlight", function() describe("'winhighlight' highlight", function()
local screen local screen

View File

@ -63,6 +63,7 @@ local function common_setup(screen, inccommand, text)
command("syntax on") command("syntax on")
command("set nohlsearch") command("set nohlsearch")
command("hi Substitute guifg=red guibg=yellow") command("hi Substitute guifg=red guibg=yellow")
command("set display-=msgsep")
screen:attach() screen:attach()
screen:set_default_attr_ids({ screen:set_default_attr_ids({
[1] = {foreground = Screen.colors.Fuchsia}, [1] = {foreground = Screen.colors.Fuchsia},

View File

@ -1,6 +1,7 @@
local helpers = require('test.functional.helpers')(after_each) local helpers = require('test.functional.helpers')(after_each)
local clear, feed_command, nvim = helpers.clear, helpers.feed_command, helpers.nvim local clear, feed_command, nvim = helpers.clear, helpers.feed_command, helpers.nvim
local feed, next_msg, eq = helpers.feed, helpers.next_msg, helpers.eq local feed, next_msg, eq = helpers.feed, helpers.next_msg, helpers.eq
local command = helpers.command
local expect = helpers.expect local expect = helpers.expect
local write_file = helpers.write_file local write_file = helpers.write_file
local Screen = require('test.functional.ui.screen') local Screen = require('test.functional.ui.screen')
@ -137,6 +138,7 @@ describe('input non-printable chars', function()
[3] = {bold = true, foreground = Screen.colors.SeaGreen4} [3] = {bold = true, foreground = Screen.colors.SeaGreen4}
}) })
screen:attach() screen:attach()
command("set display-=msgsep")
feed_command("e Xtest-overwrite") feed_command("e Xtest-overwrite")
screen:expect([[ screen:expect([[

View File

@ -26,6 +26,7 @@ describe('ui/mouse/input', function()
[4] = {reverse = true}, [4] = {reverse = true},
[5] = {bold = true, reverse = true}, [5] = {bold = true, reverse = true},
}) })
command("set display-=msgsep")
feed('itesting<cr>mouse<cr>support and selection<esc>') feed('itesting<cr>mouse<cr>support and selection<esc>')
screen:expect([[ screen:expect([[
testing | testing |

View File

@ -40,10 +40,10 @@ describe("shell command :!", function()
-- to avoid triggering a UI flush. -- to avoid triggering a UI flush.
child_session.feed_data(":!printf foo; sleep 200\n") child_session.feed_data(":!printf foo; sleep 200\n")
screen:expect([[ screen:expect([[
|
{4:~ }| {4:~ }|
{4:~ }| {4:~ }|
{4:~ }| {5: }|
{4:~ }|
:!printf foo; sleep 200 | :!printf foo; sleep 200 |
foo | foo |
{3:-- TERMINAL --} | {3:-- TERMINAL --} |
@ -99,6 +99,7 @@ describe("shell command :!", function()
end end
local screen = Screen.new(50, 4) local screen = Screen.new(50, 4)
screen:attach() screen:attach()
command("set display-=msgsep")
-- Print TAB chars. #2958 -- Print TAB chars. #2958
feed([[:!printf '1\t2\t3'<CR>]]) feed([[:!printf '1\t2\t3'<CR>]])
screen:expect([[ screen:expect([[
@ -153,6 +154,7 @@ describe("shell command :!", function()
[1] = {bold = true, foreground = Screen.colors.Blue1}, [1] = {bold = true, foreground = Screen.colors.Blue1},
[2] = {foreground = Screen.colors.Blue1}, [2] = {foreground = Screen.colors.Blue1},
[3] = {bold = true, foreground = Screen.colors.SeaGreen4}, [3] = {bold = true, foreground = Screen.colors.SeaGreen4},
[4] = {bold = true, reverse = true},
}) })
screen:attach() screen:attach()
end) end)
@ -170,10 +172,10 @@ describe("shell command :!", function()
or [[:!ls bang_filter_spec ]]) or [[:!ls bang_filter_spec ]])
feed([[\l]]) feed([[\l]])
screen:expect([[ screen:expect([[
|
{1:~ }| {1:~ }|
{1:~ }| {1:~ }|
{1:~ }| {4: }|
{1:~ }|
]]..result..[[ | ]]..result..[[ |
f1 | f1 |
f2 | f2 |
@ -187,9 +189,9 @@ describe("shell command :!", function()
feed_command('!cat test/functional/fixtures/shell_data.txt') feed_command('!cat test/functional/fixtures/shell_data.txt')
screen.bell = false screen.bell = false
screen:expect([[ screen:expect([[
|
{1:~ }| {1:~ }|
{1:~ }| {4: }|
{1:~ }|
:!cat test/functional/fixtures/shell_data.txt | :!cat test/functional/fixtures/shell_data.txt |
{2:^@^A^B^C^D^E^F^H} | {2:^@^A^B^C^D^E^F^H} |
{2:^N^O^P^Q^R^S^T^U^V^W^X^Y^Z^[^\^]^^^_} | {2:^N^O^P^Q^R^S^T^U^V^W^X^Y^Z^[^\^]^^^_} |
@ -213,8 +215,8 @@ describe("shell command :!", function()
feed_command(cmd) feed_command(cmd)
-- Note: only the first example of split composed char works -- Note: only the first example of split composed char works
screen:expect([[ screen:expect([[
{1:~ }| |
{1:~ }| {4: }|
:]]..cmd..[[ | :]]..cmd..[[ |
å | å |
ref: å̲ | ref: å̲ |

View File

@ -355,7 +355,8 @@ describe('Screen', function()
]]) ]])
end) end)
it('execute command with multi-line output', function() it('execute command with multi-line output without msgsep', function()
command("set display-=msgsep")
feed(':ls<cr>') feed(':ls<cr>')
screen:expect([[ screen:expect([[
{0:~ }| {0:~ }|
@ -375,6 +376,28 @@ describe('Screen', function()
]]) ]])
feed('<cr>') -- skip the "Press ENTER..." state or tests will hang feed('<cr>') -- skip the "Press ENTER..." state or tests will hang
end) end)
it('execute command with multi-line output and with msgsep', function()
command("set display+=msgsep")
feed(':ls<cr>')
screen:expect([[
|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{1: }|
:ls |
1 %a "[No Name]" line 1 |
{7:Press ENTER or type command to continue}^ |
]])
feed('<cr>') -- skip the "Press ENTER..." state or tests will hang
end)
end) end)
describe('scrolling and clearing', function() describe('scrolling and clearing', function()
@ -573,6 +596,7 @@ describe('Screen', function()
command('nnoremap <F1> :echo "TEST"<CR>') command('nnoremap <F1> :echo "TEST"<CR>')
feed(':ls<CR>') feed(':ls<CR>')
screen:expect([[ screen:expect([[
|
{0:~ }| {0:~ }|
{0:~ }| {0:~ }|
{0:~ }| {0:~ }|
@ -582,8 +606,7 @@ describe('Screen', function()
{0:~ }| {0:~ }|
{0:~ }| {0:~ }|
{0:~ }| {0:~ }|
{0:~ }| {1: }|
{0:~ }|
:ls | :ls |
1 %a "[No Name]" line 1 | 1 %a "[No Name]" line 1 |
{7:Press ENTER or type command to continue}^ | {7:Press ENTER or type command to continue}^ |