diff options
-rw-r--r-- | runtime/autoload/health.vim | 22 | ||||
-rw-r--r-- | runtime/autoload/health/nvim.vim | 6 | ||||
-rw-r--r-- | runtime/doc/message.txt | 6 | ||||
-rw-r--r-- | runtime/doc/pi_health.txt | 8 | ||||
-rw-r--r-- | runtime/doc/vim_diff.txt | 4 | ||||
-rw-r--r-- | src/nvim/ex_getln.c | 6 | ||||
-rw-r--r-- | src/nvim/menu.c | 12 | ||||
-rw-r--r-- | src/nvim/ops.c | 26 | ||||
-rw-r--r-- | src/nvim/screen.c | 37 | ||||
-rw-r--r-- | src/nvim/syntax.c | 9 | ||||
-rw-r--r-- | src/nvim/testdir/test_syntax.vim | 78 | ||||
-rw-r--r-- | src/nvim/version.c | 6 | ||||
-rw-r--r-- | test/functional/clipboard/clipboard_provider_spec.lua | 7 | ||||
-rw-r--r-- | test/functional/eval/input_spec.lua | 19 | ||||
-rw-r--r-- | test/functional/ex_cmds/menu_spec.lua | 250 | ||||
-rw-r--r-- | test/functional/plugin/health_spec.lua | 43 | ||||
-rw-r--r-- | test/functional/ui/highlight_spec.lua | 6 |
17 files changed, 479 insertions, 66 deletions
diff --git a/runtime/autoload/health.vim b/runtime/autoload/health.vim index bd99a0e104..d0ad7729ab 100644 --- a/runtime/autoload/health.vim +++ b/runtime/autoload/health.vim @@ -1,15 +1,15 @@ function! s:enhance_syntax() abort syntax case match - syntax keyword healthError ERROR + syntax keyword healthError ERROR[:] \ containedin=markdownCodeBlock,mkdListItemLine highlight link healthError Error - syntax keyword healthWarning WARNING + syntax keyword healthWarning WARNING[:] \ containedin=markdownCodeBlock,mkdListItemLine highlight link healthWarning WarningMsg - syntax keyword healthSuccess SUCCESS + syntax keyword healthSuccess OK[:] \ containedin=markdownCodeBlock,mkdListItemLine highlight healthSuccess guibg=#5fff00 guifg=#080808 ctermbg=82 ctermfg=232 @@ -96,21 +96,21 @@ endfunction " Format a message for a specific report item function! s:format_report_message(status, msg, ...) abort " {{{ let output = ' - ' . a:status . ': ' . s:indent_after_line1(a:msg, 4) - let suggestions = [] + let advice = [] " Optional parameters if a:0 > 0 - let suggestions = type(a:1) == type("") ? [a:1] : a:1 - if type(suggestions) != type([]) - echoerr "Expected String or List" + let advice = type(a:1) == type("") ? [a:1] : a:1 + if type(advice) != type([]) + throw "Expected String or List" endif endif " Report each suggestion - if len(suggestions) > 0 - let output .= "\n - SUGGESTIONS:" + if len(advice) > 0 + let output .= "\n - ADVICE:" endif - for suggestion in suggestions + for suggestion in advice let output .= "\n - " . s:indent_after_line1(suggestion, 10) endfor @@ -124,7 +124,7 @@ endfunction " }}} " Reports a successful healthcheck. function! health#report_ok(msg) abort " {{{ - echo s:format_report_message('SUCCESS', a:msg) + echo s:format_report_message('OK', a:msg) endfunction " }}} " Reports a health warning. diff --git a/runtime/autoload/health/nvim.vim b/runtime/autoload/health/nvim.vim index 3834cbd054..6c6a5e8543 100644 --- a/runtime/autoload/health/nvim.vim +++ b/runtime/autoload/health/nvim.vim @@ -10,6 +10,12 @@ function! s:check_config() abort \ [ "Use the 'guicursor' option to configure cursor shape. :help 'guicursor'", \ 'https://github.com/neovim/neovim/wiki/Following-HEAD#20170402' ]) endif + if &paste + let ok = v:false + call health#report_error("'paste' is enabled. This option is only for pasting text.\nIt should not be set in your config.", + \ [ 'Remove `set paste` from your init.vim, if applicable.', + \ 'Check `:verbose set paste?` to see if a plugin or script set the option.', ]) + endif if ok call health#report_ok('no issues found') diff --git a/runtime/doc/message.txt b/runtime/doc/message.txt index c6c6f49026..58ababf229 100644 --- a/runtime/doc/message.txt +++ b/runtime/doc/message.txt @@ -449,12 +449,6 @@ changed. To avoid the message reset the 'warn' option. Something inside Vim went wrong and resulted in a NULL pointer. If you know how to reproduce this problem, please report it. |bugs| - *E172* > - Only one file name allowed - -The ":edit" command only accepts one file name. When you want to specify -several files for editing use ":next" |:next|. - *E41* *E82* *E83* *E342* > Out of memory! Out of memory! (allocating {number} bytes) diff --git a/runtime/doc/pi_health.txt b/runtime/doc/pi_health.txt index 8354c0470f..f77267288c 100644 --- a/runtime/doc/pi_health.txt +++ b/runtime/doc/pi_health.txt @@ -64,11 +64,11 @@ health#report_info({msg}) *health#report_info* health#report_ok({msg}) *health#report_ok* Displays a "success" message. -health#report_warn({msg}, [{suggestions}]) *health#report_warn* - Displays a warning. {suggestions} is an optional List of suggestions. +health#report_warn({msg}, [{advice}]) *health#report_warn* + Displays a warning. {advice} is an optional List of suggestions. -health#report_error({msg}, [{suggestions}]) *health#report_error* - Displays an error. {suggestions} is an optional List of suggestions. +health#report_error({msg}, [{advice}]) *health#report_error* + Displays an error. {advice} is an optional List of suggestions. health#{plugin}#check() *health.user_checker* This is the form of a healthcheck definition. Call the above functions diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index 861fa65c3a..5df3852d8e 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -281,8 +281,8 @@ other arguments if used). |input()| and |inputdialog()| support user-defined cmdline highlighting. Highlight groups: - |hl-ColorColumn|, |hl-CursorColumn|, |hl-CursorLine| are lower priority than - (overridden by) most other highlight groups. + |hl-ColorColumn|, |hl-CursorColumn| are lower priority than most other + groups ============================================================================== 5. Missing legacy features *nvim-features-missing* diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index fd7ad7a4b5..54e5bcb9ff 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -1863,9 +1863,13 @@ char *getcmdline_prompt(const char firstc, const char *const prompt, ccline.input_fn = (firstc == '@'); ccline.highlight_callback = highlight_callback; + int msg_silent_saved = msg_silent; + msg_silent = 0; + char *const ret = (char *)getcmdline(firstc, 1L, 0); restore_cmdline(&save_ccline); + msg_silent = msg_silent_saved; // Restore msg_col, the prompt from input() may have changed it. // But only if called recursively and the commandline is therefore being // restored to an old one; if not, the input() prompt stays on the screen, @@ -5714,6 +5718,7 @@ static int ex_window(void) i = RedrawingDisabled; RedrawingDisabled = 0; + int save_count = save_batch_count(); /* * Call the main loop until <CR> or CTRL-C is typed. @@ -5722,6 +5727,7 @@ static int ex_window(void) normal_enter(true, false); RedrawingDisabled = i; + restore_batch_count(save_count); int save_KeyTyped = KeyTyped; diff --git a/src/nvim/menu.c b/src/nvim/menu.c index 0db250d111..88d968704b 100644 --- a/src/nvim/menu.c +++ b/src/nvim/menu.c @@ -682,6 +682,10 @@ static dict_T *menu_get_recursive(const vimmenu_T *menu, int modes) tv_dict_add_str(dict, S_LEN("shortcut"), buf); } + if (menu->actext) { + tv_dict_add_str(dict, S_LEN("actext"), (char *)menu->actext); + } + if (menu->modes & MENU_TIP_MODE && menu->strings[MENU_INDEX_TIP]) { tv_dict_add_str(dict, S_LEN("tooltip"), (char *)menu->strings[MENU_INDEX_TIP]); @@ -695,11 +699,9 @@ static dict_T *menu_get_recursive(const vimmenu_T *menu, int modes) for (int bit = 0; bit < MENU_MODES; bit++) { if ((menu->modes & modes & (1 << bit)) != 0) { dict_T *impl = tv_dict_alloc(); - if (*menu->strings[bit] == NUL) { - tv_dict_add_str(impl, S_LEN("rhs"), (char *)"<Nop>"); - } else { - tv_dict_add_str(impl, S_LEN("rhs"), (char *)menu->strings[bit]); - } + tv_dict_add_allocated_str(impl, S_LEN("rhs"), + str2special_save((char *)menu->strings[bit], + false, false)); tv_dict_add_nr(impl, S_LEN("silent"), menu->silent[bit]); tv_dict_add_nr(impl, S_LEN("enabled"), (menu->enabled & (1 << bit)) ? 1 : 0); diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 99dc4670f1..e7bc20698b 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -5755,7 +5755,6 @@ void start_batch_changes(void) return; } clipboard_delay_update = true; - clipboard_needs_update = false; } /// Counterpart to start_batch_changes(). @@ -5767,12 +5766,37 @@ void end_batch_changes(void) } clipboard_delay_update = false; if (clipboard_needs_update) { + // must be before, as set_clipboard will invoke + // start/end_batch_changes recursively + clipboard_needs_update = false; // unnamed ("implicit" clipboard) set_clipboard(NUL, y_previous); + } +} + +int save_batch_count(void) +{ + int save_count = batch_change_count; + batch_change_count = 0; + clipboard_delay_update = false; + if (clipboard_needs_update) { clipboard_needs_update = false; + // unnamed ("implicit" clipboard) + set_clipboard(NUL, y_previous); } + return save_count; } +void restore_batch_count(int save_count) +{ + assert(batch_change_count == 0); + batch_change_count = save_count; + if (batch_change_count > 0) { + clipboard_delay_update = true; + } +} + + /// Check whether register is empty static inline bool reg_empty(const yankreg_T *const reg) FUNC_ATTR_PURE diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 5659f30f64..f5730cf70a 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -2202,7 +2202,6 @@ win_line ( colnr_T trailcol = MAXCOL; /* start of trailing spaces */ int need_showbreak = false; // overlong line, skip first x chars int line_attr = 0; // attribute for the whole line - int line_attr_low_priority = 0; // current line, lowest priority matchitem_T *cur; // points to the match list match_T *shl; // points to search_hl or a match int shl_flag; // flag to indicate whether search_hl @@ -2428,13 +2427,7 @@ win_line ( filler_lines = wp->w_topfill; filler_todo = filler_lines; - // 'cursorline' highlighting for the current window. Not when Visual mode is - // active, because it's not clear what is selected then. - if (wp->w_p_cul && lnum == wp->w_cursor.lnum - && !(wp == curwin && VIsual_active)) { - line_attr_low_priority = win_hl_attr(wp, HLF_CUL); - } - + // If this line has a sign with line highlighting set line_attr. v = buf_getsigntype(wp->w_buffer, lnum, SIGN_LINEHL); if (v != 0) { line_attr = sign_get_attr((int)v, true); @@ -2449,7 +2442,7 @@ win_line ( line_attr = hl_combine_attr(wp->w_hl_attr_normal, line_attr); } - if (line_attr_low_priority || line_attr) { + if (line_attr != 0) { area_highlighting = true; } @@ -2671,6 +2664,20 @@ win_line ( cur = cur->next; } + // Cursor line highlighting for 'cursorline' in the current window. Not + // when Visual mode is active, because it's not clear what is selected + // then. + if (wp->w_p_cul && lnum == wp->w_cursor.lnum + && !(wp == curwin && VIsual_active)) { + if (line_attr != 0 && !(State & INSERT) && bt_quickfix(wp->w_buffer) + && qf_current_entry(wp) == lnum) { + line_attr = hl_combine_attr(win_hl_attr(wp, HLF_CUL), line_attr); + } else { + line_attr = win_hl_attr(wp, HLF_CUL); + } + area_highlighting = true; + } + off = (unsigned)(current_ScreenLine - ScreenLines); col = 0; if (wp->w_p_rl) { @@ -3589,9 +3596,7 @@ win_line ( // Display a '$' after the line or highlight an extra // character if the line break is included. // For a diff line the highlighting continues after the "$". - if (diff_hlf == (hlf_T)0 - && line_attr == 0 - && line_attr_low_priority == 0) { + if (diff_hlf == (hlf_T)0 && line_attr == 0) { // In virtualedit, visual selections may extend beyond end of line. if (area_highlighting && virtual_active() && tocol != MAXCOL && vcol < tocol) { @@ -3655,7 +3660,7 @@ win_line ( (col < wp->w_width))) { c = ' '; ptr--; // put it back at the NUL - } else if ((diff_hlf != (hlf_T)0 || line_attr_low_priority || line_attr) + } else if ((diff_hlf != (hlf_T)0 || line_attr != 0) && (wp->w_p_rl ? (col >= 0) : (col - boguscols < wp->w_width))) { @@ -3667,8 +3672,7 @@ win_line ( did_line_attr++; // don't do search HL for the rest of the line - if ((line_attr_low_priority || line_attr) - && char_attr == search_attr && col > 0) { + if (line_attr != 0 && char_attr == search_attr && col > 0) { char_attr = line_attr; } if (diff_hlf == HLF_TXD) { @@ -4037,9 +4041,6 @@ win_line ( } } - // Apply `line_attr_low_priority` now, so that everthing can override it. - char_attr = hl_combine_attr(line_attr_low_priority, char_attr); - /* * Store character to be displayed. * Skip characters that are left of the screen for 'nowrap'. diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index 0224b28c2a..70bda42d83 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -5868,9 +5868,12 @@ static void syntime_report(void) } } - /* sort on total time */ - qsort(ga.ga_data, (size_t)ga.ga_len, sizeof(time_entry_T), - syn_compare_syntime); + // Sort on total time. Skip if there are no items to avoid passing NULL + // pointer to qsort(). + if (ga.ga_len > 1) { + qsort(ga.ga_data, (size_t)ga.ga_len, sizeof(time_entry_T), + syn_compare_syntime); + } MSG_PUTS_TITLE(_( " TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN")); diff --git a/src/nvim/testdir/test_syntax.vim b/src/nvim/testdir/test_syntax.vim index 05e930d984..6c084dd2a7 100644 --- a/src/nvim/testdir/test_syntax.vim +++ b/src/nvim/testdir/test_syntax.vim @@ -50,7 +50,7 @@ func Test_syn_iskeyword() setlocal isk-=_ call assert_equal('DLTD_BY', GetSyntaxItem('DLTD')) /\<D\k\+\>/:norm! ygn - let b2=@0 + let b2 = @0 call assert_equal('DLTD', @0) syn iskeyword clear @@ -77,10 +77,84 @@ func Test_syntax_after_reload() call delete('Xsomefile') endfunc +func Test_syntime() + if !has('profile') + return + endif + + syntax on + syntime on + let a = execute('syntime report') + call assert_equal("\nNo Syntax items defined for this buffer", a) + + view ../memfile_test.c + setfiletype cpp + redraw + let a = execute('syntime report') + call assert_match('^ TOTAL *COUNT *MATCH *SLOWEST *AVERAGE *NAME *PATTERN', a) + call assert_match(' \d*\.\d* \+[^0]\d* .* cppRawString ', a) + call assert_match(' \d*\.\d* \+[^0]\d* .* cppNumber ', a) + + syntime off + syntime clear + let a = execute('syntime report') + call assert_match('^ TOTAL *COUNT *MATCH *SLOWEST *AVERAGE *NAME *PATTERN', a) + call assert_notmatch('.* cppRawString *', a) + call assert_notmatch('.* cppNumber*', a) + call assert_notmatch('[1-9]', a) + + call assert_fails('syntime abc', 'E475') + + syntax clear + let a = execute('syntime report') + call assert_equal("\nNo Syntax items defined for this buffer", a) + + bd +endfunc + +func Test_syntax_list() + syntax on + let a = execute('syntax list') + call assert_equal("\nNo Syntax items defined for this buffer", a) + + view ../memfile_test.c + setfiletype c + + let a = execute('syntax list') + call assert_match('cInclude*', a) + call assert_match('cDefine', a) + + let a = execute('syntax list cDefine') + call assert_notmatch('cInclude*', a) + call assert_match('cDefine', a) + call assert_match(' links to Macro$', a) + + call assert_fails('syntax list ABCD', 'E28:') + call assert_fails('syntax list @ABCD', 'E392:') + + syntax clear + let a = execute('syntax list') + call assert_equal("\nNo Syntax items defined for this buffer", a) + + bd +endfunc + func Test_syntax_completion() + call feedkeys(":syn \<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"syn case clear cluster conceal enable include iskeyword keyword list manual match off on region reset spell sync', @:) + + call feedkeys(":syn case \<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"syn case ignore match', @:) + call feedkeys(":syn spell \<C-A>\<C-B>\"\<CR>", 'tx') call assert_equal('"syn spell default notoplevel toplevel', @:) call feedkeys(":syn sync \<C-A>\<C-B>\"\<CR>", 'tx') call assert_equal('"syn sync ccomment clear fromstart linebreaks= linecont lines= match maxlines= minlines= region', @:) -endfunc + + call feedkeys(":syn list \<C-A>\<C-B>\"\<CR>", 'tx') + call assert_match('^"syn list Boolean Character ', @:) + + call feedkeys(":syn match \<C-A>\<C-B>\"\<CR>", 'tx') + call assert_match('^"syn match Boolean Character ', @:) +endfunc
\ No newline at end of file diff --git a/src/nvim/version.c b/src/nvim/version.c index 6729adaff3..635314352d 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -948,7 +948,7 @@ static const int included_patches[] = { 158, 157, 156, - // 155, + 155, // 154, // 153, // 152 NA @@ -971,8 +971,8 @@ static const int included_patches[] = { 135, 134, 133, - // 132, - // 131, + 132, + 131, // 130 NA // 129 NA 128, diff --git a/test/functional/clipboard/clipboard_provider_spec.lua b/test/functional/clipboard/clipboard_provider_spec.lua index f66fbf7c94..b90335e70a 100644 --- a/test/functional/clipboard/clipboard_provider_spec.lua +++ b/test/functional/clipboard/clipboard_provider_spec.lua @@ -392,6 +392,13 @@ describe('clipboard', function() eq('---', eval('getreg("*")')) end) + it('works in the cmdline window', function() + feed('q:itext<esc>yy') + eq({{'text', ''}, 'V'}, eval("g:test_clip['*']")) + command("let g:test_clip['*'] = [['star'], 'c']") + feed('p') + eq('textstar', meths.get_current_line()) + end) end) describe('clipboard=unnamedplus', function() diff --git a/test/functional/eval/input_spec.lua b/test/functional/eval/input_spec.lua index 5ae23e17d0..1e6b107c60 100644 --- a/test/functional/eval/input_spec.lua +++ b/test/functional/eval/input_spec.lua @@ -239,6 +239,25 @@ describe('input()', function() {RBP1:(}{RBP2:()}{RBP1:)}^ | ]]) end) + it('is not hidden by :silent', function() + feed([[:silent call input('Foo: ')<CR>]]) + screen:expect([[ + {EOB:~ }| + {EOB:~ }| + {EOB:~ }| + Foo: ^ | + | + ]]) + feed('Bar') + screen:expect([[ + {EOB:~ }| + {EOB:~ }| + {EOB:~ }| + Foo: Bar^ | + | + ]]) + feed('<CR>') + end) end) describe('inputdialog()', function() it('works with multiline prompts', function() diff --git a/test/functional/ex_cmds/menu_spec.lua b/test/functional/ex_cmds/menu_spec.lua index 55da8da8dc..2c0535acda 100644 --- a/test/functional/ex_cmds/menu_spec.lua +++ b/test/functional/ex_cmds/menu_spec.lua @@ -107,7 +107,7 @@ describe('menu_get', function() sid = 1, noremap = 1, enabled = 1, - rhs = "inormal\27", + rhs = "inormal<Esc>", silent = 0 }, v = { @@ -242,7 +242,7 @@ describe('menu_get', function() sid = 1, noremap = 1, enabled = 1, - rhs = "\18\"", + rhs = "<C-R>\"", silent = 0 }, n = { @@ -379,5 +379,251 @@ describe('menu_get', function() } eq(expected, m) end) +end) + +describe('menu_get', function() + + before_each(function() + clear() + end) + + it('returns <keycode> representation of special keys', function() + command('nnoremenu &Test.Test inormal<ESC>') + command('inoremenu &Test.Test2 <Tab><Esc>') + command('vnoremenu &Test.Test3 yA<C-R>0<Tab>xyz<Esc>') + command('inoremenu &Test.Test4 <c-r>*') + command('inoremenu &Test.Test5 <c-R>+') + command('nnoremenu &Test.Test6 <Nop>') + command('nnoremenu &Test.Test7 <NOP>') + command('nnoremenu &Test.Test8 <NoP>') + command('nnoremenu &Test.Test9 ""') + + local m = funcs.menu_get(""); + local expected = { + { + shortcut = "T", + hidden = 0, + submenus = { + { + priority = 500, + mappings = { + n = { + sid = 1, + noremap = 1, + enabled = 1, + rhs = "inormal<Esc>", + silent = 0 + } + }, + name = "Test", + hidden = 0 + }, + { + priority = 500, + mappings = { + i = { + sid = 1, + noremap = 1, + enabled = 1, + rhs = "<Tab><Esc>", + silent = 0 + } + }, + name = "Test2", + hidden = 0 + }, + { + priority = 500, + mappings = { + s = { + sid = 1, + noremap = 1, + enabled = 1, + rhs = "yA<C-R>0<Tab>xyz<Esc>", + silent = 0 + }, + v = { + sid = 1, + noremap = 1, + enabled = 1, + rhs = "yA<C-R>0<Tab>xyz<Esc>", + silent = 0 + } + }, + name = "Test3", + hidden = 0 + }, + { + priority = 500, + mappings = { + i = { + sid = 1, + noremap = 1, + enabled = 1, + rhs = "<C-R>*", + silent = 0 + } + }, + name = "Test4", + hidden = 0 + }, + { + priority = 500, + mappings = { + i = { + sid = 1, + noremap = 1, + enabled = 1, + rhs = "<C-R>+", + silent = 0 + } + }, + name = "Test5", + hidden = 0 + }, + { + priority = 500, + mappings = { + n = { + sid = 1, + noremap = 1, + enabled = 1, + rhs = "", + silent = 0 + } + }, + name = "Test6", + hidden = 0 + }, + { + priority = 500, + mappings = { + n = { + sid = 1, + noremap = 1, + enabled = 1, + rhs = "", + silent = 0 + } + }, + name = "Test7", + hidden = 0 + }, + { + priority = 500, + mappings = { + n = { + sid = 1, + noremap = 1, + enabled = 1, + rhs = "", + silent = 0 + } + }, + name = "Test8", + hidden = 0 + }, + { + priority = 500, + mappings = { + n = { + sid = 1, + noremap = 1, + enabled = 1, + rhs = "\"\"", + silent = 0 + } + }, + name = "Test9", + hidden = 0 + } + }, + priority = 500, + name = "Test" + } + } + + eq(m, expected) + end) + + it('works with right-aligned text and spaces', function() + command('nnoremenu &Test<Tab>Y.Test<Tab>X\\ x inormal<Alt-j>') + command('nnoremenu &Test\\ 1.Test\\ 2 Wargl') + command('nnoremenu &Test4.Test<Tab>3 i space<Esc>') + + local m = funcs.menu_get(""); + local expected = { + { + shortcut = "T", + hidden = 0, + actext = "Y", + submenus = { + { + mappings = { + n = { + sid = 1, + noremap = 1, + enabled = 1, + rhs = "inormal<Alt-j>", + silent = 0 + } + }, + hidden = 0, + actext = "X x", + priority = 500, + name = "Test" + } + }, + priority = 500, + name = "Test" + }, + { + shortcut = "T", + hidden = 0, + submenus = { + { + priority = 500, + mappings = { + n = { + sid = 1, + noremap = 1, + enabled = 1, + rhs = "Wargl", + silent = 0 + } + }, + name = "Test 2", + hidden = 0 + } + }, + priority = 500, + name = "Test 1" + }, + { + shortcut = "T", + hidden = 0, + submenus = { + { + mappings = { + n = { + sid = 1, + noremap = 1, + enabled = 1, + rhs = "i space<Esc>", + silent = 0 + } + }, + hidden = 0, + actext = "3", + priority = 500, + name = "Test" + } + }, + priority = 500, + name = "Test4" + } + } + eq(m, expected) + end) end) diff --git a/test/functional/plugin/health_spec.lua b/test/functional/plugin/health_spec.lua index 3739540b09..8646ec98bf 100644 --- a/test/functional/plugin/health_spec.lua +++ b/test/functional/plugin/health_spec.lua @@ -1,4 +1,5 @@ local helpers = require('test.functional.helpers')(after_each) +local Screen = require('test.functional.ui.screen') local plugin_helpers = require('test.functional.plugin.helpers') local command = helpers.command @@ -30,13 +31,13 @@ describe('health.vim', function() ## Check Bar - - SUCCESS: Bar status - - SUCCESS: Other Bar status + - OK: Bar status + - OK: Other Bar status - WARNING: Zub ## Baz - WARNING: Zim - - SUGGESTIONS: + - ADVICE: - suggestion 1 - suggestion 2]]), result) @@ -51,15 +52,15 @@ describe('health.vim', function() health#success1#check ======================================================================== ## report 1 - - SUCCESS: everything is fine + - OK: everything is fine ## report 2 - - SUCCESS: nothing to see here + - OK: nothing to see here health#success2#check ======================================================================== ## another 1 - - SUCCESS: ok + - OK: ok ]]) end) @@ -75,6 +76,36 @@ describe('health.vim', function() ]]) end) + it("highlights OK, ERROR", function() + local screen = Screen.new(72, 10) + screen:attach() + screen:set_default_attr_ids({ + Ok = { foreground = Screen.colors.Grey3, background = 6291200 }, + Error = { foreground = Screen.colors.Grey100, background = Screen.colors.Red }, + }) + screen:set_default_attr_ignore({ + Heading = { bold=true, foreground=Screen.colors.Magenta }, + Heading2 = { foreground = Screen.colors.SlateBlue }, + Bar = { foreground=Screen.colors.Purple }, + Bullet = { bold=true, foreground=Screen.colors.Brown }, + }) + command("CheckHealth foo success1") + command("1tabclose") + command("set laststatus=0") + screen:expect([[ + ^ | + health#foo#check | + ========================================================================| + - {Error:ERROR:} No healthcheck found for "foo" plugin. | + | + health#success1#check | + ========================================================================| + ## report 1 | + - {Ok:OK:} everything is fine | + | + ]]) + end) + it("gracefully handles invalid healthcheck", function() command("CheckHealth non_existent_healthcheck") helpers.expect([[ diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua index 077b0ec14c..d1357ea525 100644 --- a/test/functional/ui/highlight_spec.lua +++ b/test/functional/ui/highlight_spec.lua @@ -518,7 +518,7 @@ describe("'listchars' highlight", function() ]]) feed_command('set cursorline') screen:expect([[ - {2:^>-------.}{1:abcd}{2:.}{1:Lorem}{3:>}| + {2:^>-------.}{1:abcd}{2:.}{1:Lorem}{4:>}| {5:>-------.}abcd{5:*}{4:¬} | {4:¬} | {4:~ }| @@ -526,7 +526,7 @@ describe("'listchars' highlight", function() ]]) feed('$') screen:expect([[ - {3:<}{1:r}{2:.}{1:sit}{2:.}{1:ame^t}{3:¬}{1: }| + {4:<}{1:r}{2:.}{1:sit}{2:.}{1:ame^t}{3:¬}{1: }| {4:<} | {4:<} | {4:~ }| @@ -607,7 +607,7 @@ describe("'listchars' highlight", function() feed('<esc>$') screen:expect([[ {4:<} | - {3:<}{1:r}{2:.}{1:sit}{2:.}{1:ame^t}{3:¬}{1: }| + {4:<}{1:r}{2:.}{1:sit}{2:.}{1:ame^t}{3:¬}{1: }| {4:<} | {4:~ }| | |