aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/eval.c4
-rw-r--r--src/nvim/fold.c11
-rw-r--r--src/nvim/syntax.c2
-rw-r--r--test/functional/normal/fold_spec.lua19
-rw-r--r--test/functional/ui/highlight_spec.lua45
5 files changed, 55 insertions, 26 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 7c5b23f567..dcbd7ab152 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -12776,11 +12776,11 @@ static void f_nr2char(typval_T *argvars, typval_T *rettv, FunPtr fptr)
return;
}
if (num < 0) {
- emsgf(_("E5070: Character number could not be less then zero"));
+ emsgf(_("E5070: Character number must not be less than zero"));
return;
}
if (num > INT_MAX) {
- emsgf(_("E5071: Character number could not be greater then INT_MAX (%i)"),
+ emsgf(_("E5071: Character number must not be greater than INT_MAX (%i)"),
INT_MAX);
return;
}
diff --git a/src/nvim/fold.c b/src/nvim/fold.c
index d810aee0ce..34db4d2171 100644
--- a/src/nvim/fold.c
+++ b/src/nvim/fold.c
@@ -2765,10 +2765,13 @@ void foldMoveRange(garray_T *gap, const linenr_T line1, const linenr_T line2,
}
dest_index = FOLD_INDEX(fp, gap);
- // All folds are now correct, but they are not necessarily in the correct
- // order.
- // We have to swap folds in the range [move_end, dest_index) with those in
- // the range [move_start, move_end).
+ // All folds are now correct, but not necessarily in the correct order.
+ // We must swap folds in the range [move_end, dest_index) with those in the
+ // range [move_start, move_end).
+ if (move_end == 0) {
+ // There are no folds after those moved, so none were moved out of order.
+ return;
+ }
reverse_fold_order(gap, move_start, dest_index - 1);
reverse_fold_order(gap, move_start, move_start + dest_index - move_end - 1);
reverse_fold_order(gap, move_start + dest_index - move_end, dest_index - 1);
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index 1ed65ec52a..d5ff3707e8 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -5898,6 +5898,8 @@ static void syntime_report(void)
static char *highlight_init_both[] =
{
"Conceal ctermbg=DarkGrey ctermfg=LightGrey guibg=DarkGrey guifg=LightGrey",
+ "Cursor guibg=fg guifg=bg",
+ "lCursor guibg=fg guifg=bg",
"DiffText cterm=bold ctermbg=Red gui=bold guibg=Red",
"ErrorMsg ctermbg=DarkRed ctermfg=White guibg=Red guifg=White",
"IncSearch cterm=reverse gui=reverse",
diff --git a/test/functional/normal/fold_spec.lua b/test/functional/normal/fold_spec.lua
index 85e4631b61..00e83bedc8 100644
--- a/test/functional/normal/fold_spec.lua
+++ b/test/functional/normal/fold_spec.lua
@@ -232,6 +232,25 @@ a
a]], '2,3m0')
eq({1, 2, 0, 0, 0}, get_folds())
end)
+ it('handles shifting all remaining folds', function()
+ test_move_indent([[
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+a]], '13m7')
+ eq({1, 2, 2, 2, 1, 2, 2, 1, 1, 1, 2, 2, 2, 1, 0}, get_folds())
+ end)
end)
it('updates correctly on :read', function()
-- luacheck: ignore 621
diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua
index 5f8fafef07..2bda907c33 100644
--- a/test/functional/ui/highlight_spec.lua
+++ b/test/functional/ui/highlight_spec.lua
@@ -2,23 +2,23 @@ local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local os = require('os')
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
+local command = helpers.command
+local eval = helpers.eval
local feed_command, request, eq = helpers.feed_command, helpers.request, helpers.eq
-if helpers.pending_win32(pending) then return end
-
-describe('color scheme compatibility', function()
+describe('colorscheme compatibility', function()
before_each(function()
clear()
end)
it('t_Co is set to 256 by default', function()
- eq('256', request('vim_eval', '&t_Co'))
+ eq('256', eval('&t_Co'))
request('nvim_set_option', 't_Co', '88')
- eq('88', request('vim_eval', '&t_Co'))
+ eq('88', eval('&t_Co'))
end)
end)
-describe('manual syntax highlight', function()
+describe('highlight: `:syntax manual`', function()
-- When using manual syntax highlighting, it should be preserved even when
-- switching buffers... bug did only occur without :set hidden
-- Ref: vim patch 7.4.1236
@@ -63,32 +63,32 @@ describe('manual syntax highlight', function()
end)
it("works with buffer switch and 'nohidden'", function()
- feed_command('e tmp1.vim')
- feed_command('e Xtest-functional-ui-highlight.tmp.vim')
- feed_command('filetype on')
- feed_command('syntax manual')
- feed_command('set ft=vim')
- feed_command('set syntax=ON')
+ command('e tmp1.vim')
+ command('e Xtest-functional-ui-highlight.tmp.vim')
+ command('filetype on')
+ command('syntax manual')
+ command('set filetype=vim fileformat=unix')
+ command('set syntax=ON')
feed('iecho 1<esc>0')
- feed_command('set nohidden')
- feed_command('w')
- feed_command('bn')
- feed_command('bp')
+ command('set nohidden')
+ command('w')
+ command('silent bn')
+ eq("tmp1.vim", eval("fnamemodify(bufname('%'), ':t')"))
+ feed_command('silent bp')
+ eq("Xtest-functional-ui-highlight.tmp.vim", eval("fnamemodify(bufname('%'), ':t')"))
screen:expect([[
{1:^echo} 1 |
{0:~ }|
{0:~ }|
{0:~ }|
- <ht.tmp.vim" 1L, 7C |
+ :silent bp |
]])
end)
end)
-describe('Default highlight groups', function()
- -- Test the default attributes for highlight groups shown by the :highlight
- -- command
+describe('highlight defaults', function()
local screen
before_each(function()
@@ -281,6 +281,11 @@ describe('Default highlight groups', function()
]], {[0] = {bold=true, foreground=Screen.colors.Blue}})
end)
+ it('Cursor after `:hi clear|syntax reset` #6508', function()
+ command('highlight clear|syntax reset')
+ eq('guifg=bg guibg=fg', eval([[matchstr(execute('hi Cursor'), '\v(gui|cterm).*$')]]))
+ end)
+
it('Whitespace highlight', function()
screen:try_resize(53, 4)
feed_command('highlight NonText gui=NONE guifg=#FF0000')