aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xci/common/submit_coverage.sh2
-rw-r--r--ci/common/suite.sh3
-rw-r--r--ci/common/test.sh1
-rw-r--r--runtime/doc/builtin.txt3
-rw-r--r--runtime/lua/vim/treesitter/query.lua12
-rw-r--r--scripts/lintcommit.lua26
-rw-r--r--src/nvim/buffer.c10
-rw-r--r--src/nvim/option.c4
-rw-r--r--src/nvim/testdir/test_highlight.vim25
-rw-r--r--src/nvim/window.c2
-rw-r--r--test/functional/treesitter/parser_spec.lua19
-rw-r--r--test/functional/ui/highlight_spec.lua101
12 files changed, 183 insertions, 25 deletions
diff --git a/ci/common/submit_coverage.sh b/ci/common/submit_coverage.sh
index cb6ab62b5b..f781ca8e5e 100755
--- a/ci/common/submit_coverage.sh
+++ b/ci/common/submit_coverage.sh
@@ -4,7 +4,7 @@
# Args:
# $1: Flag(s) for codecov, separated by comma.
-set -ex
+set -e
# Change to grandparent dir (POSIXly).
CDPATH='' cd -P -- "$(dirname -- "$0")/../.." || exit
diff --git a/ci/common/suite.sh b/ci/common/suite.sh
index 8f6d81e264..f33f8b89d1 100644
--- a/ci/common/suite.sh
+++ b/ci/common/suite.sh
@@ -29,17 +29,14 @@ ci_fold() {
}
enter_suite() {
- set +x
FAILED=0
rm -f "${END_MARKER}"
local suite_name="$1"
export NVIM_TEST_CURRENT_SUITE="${NVIM_TEST_CURRENT_SUITE}/$suite_name"
ci_fold "start" "$suite_name"
- set -x
}
exit_suite() {
- set +x
if test $FAILED -ne 0 ; then
echo "Suite ${NVIM_TEST_CURRENT_SUITE} failed, summary:"
echo "${FAIL_SUMMARY}"
diff --git a/ci/common/test.sh b/ci/common/test.sh
index c5f67edd2c..f211a2e7aa 100644
--- a/ci/common/test.sh
+++ b/ci/common/test.sh
@@ -119,7 +119,6 @@ run_oldtests() {(
)}
check_runtime_files() {(
- set +x
local test_name="$1" ; shift
local message="$1" ; shift
local tst="$1" ; shift
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt
index 6195dd4a0b..f371ad92cc 100644
--- a/runtime/doc/builtin.txt
+++ b/runtime/doc/builtin.txt
@@ -7433,6 +7433,9 @@ stdioopen({opts}) *stdioopen()*
{opts} is a dictionary with these keys:
|on_stdin| : callback invoked when stdin is written to.
+ on_print : callback invoked when Nvim needs to print a
+ message, with the message (whose type is string)
+ as sole argument.
stdin_buffered : read stdin in |channel-buffered| mode.
rpc : If set, |msgpack-rpc| will be used to communicate
over stdio
diff --git a/runtime/lua/vim/treesitter/query.lua b/runtime/lua/vim/treesitter/query.lua
index b3036ea679..14940332d6 100644
--- a/runtime/lua/vim/treesitter/query.lua
+++ b/runtime/lua/vim/treesitter/query.lua
@@ -199,11 +199,13 @@ function M.get_node_text(node, source)
lines = a.nvim_buf_get_lines(source, start_row, end_row + 1, true)
end
- if #lines == 1 then
- lines[1] = string.sub(lines[1], start_col+1, end_col)
- else
- lines[1] = string.sub(lines[1], start_col+1)
- lines[#lines] = string.sub(lines[#lines], 1, end_col)
+ if #lines > 0 then
+ if #lines == 1 then
+ lines[1] = string.sub(lines[1], start_col+1, end_col)
+ else
+ lines[1] = string.sub(lines[1], start_col+1)
+ lines[#lines] = string.sub(lines[#lines], 1, end_col)
+ end
end
return table.concat(lines, "\n")
diff --git a/scripts/lintcommit.lua b/scripts/lintcommit.lua
index 0a7da4d4ef..6871858a0b 100644
--- a/scripts/lintcommit.lua
+++ b/scripts/lintcommit.lua
@@ -94,10 +94,24 @@ local function validate_commit(commit_message)
return [[Description ends with a period (".").]]
end
- -- Check that description has exactly one whitespace after colon, followed by
- -- a lowercase letter and then any number of letters.
- if not string.match(after_colon, '^ %l%a*') then
- return [[There should be one whitespace after the colon and the first letter should lowercase.]]
+ -- Check that description starts with a whitespace.
+ if after_colon:sub(1,1) ~= " " then
+ return [[There should be a whitespace after the colon.]]
+ end
+
+ -- Check that description doesn't start with multiple whitespaces.
+ if after_colon:sub(1,2) == " " then
+ return [[There should only be one whitespace after the colon.]]
+ end
+
+ -- Check that first character after space isn't uppercase.
+ if string.match(after_colon:sub(2,2), '%u') then
+ return [[First character should not be uppercase.]]
+ end
+
+ -- Check that description isn't just whitespaces
+ if vim.trim(after_colon) == "" then
+ return [[Description shouldn't be empty.]]
end
return nil
@@ -168,12 +182,14 @@ function M._test()
['ci(tui)!: message with scope and breaking change'] = true,
['vim-patch:8.2.3374: Pyret files are not recognized (#15642)'] = true,
['vim-patch:8.1.1195,8.2.{3417,3419}'] = true,
+ ['revert: "ci: use continue-on-error instead of "|| true""'] = true,
[':no type before colon 1'] = false,
[' :no type before colon 2'] = false,
[' :no type before colon 3'] = false,
['ci(empty description):'] = false,
- ['ci(whitespace as description): '] = false,
+ ['ci(only whitespace as description): '] = false,
['docs(multiple whitespaces as description): '] = false,
+ ['revert(multiple whitespaces and then characters as description): description'] = false,
['ci no colon after type'] = false,
['test: extra space after colon'] = false,
['ci: tab after colon'] = false,
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index a9addc0e68..ee704bd1bd 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -1497,6 +1497,11 @@ void set_curbuf(buf_T *buf, int action)
*/
void enter_buffer(buf_T *buf)
{
+ // Get the buffer in the current window.
+ curwin->w_buffer = buf;
+ curbuf = buf;
+ curbuf->b_nwindows++;
+
// Copy buffer and window local option values. Not for a help buffer.
buf_copy_options(buf, BCO_ENTER | BCO_NOHELP);
if (!buf->b_help) {
@@ -1507,11 +1512,6 @@ void enter_buffer(buf_T *buf)
}
foldUpdateAll(curwin); // update folds (later).
- // Get the buffer in the current window.
- curwin->w_buffer = buf;
- curbuf = buf;
- curbuf->b_nwindows++;
-
if (curwin->w_p_diff) {
diff_buf_add(curbuf);
}
diff --git a/src/nvim/option.c b/src/nvim/option.c
index b9fed8b378..dddf926b9a 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -1984,10 +1984,9 @@ static void didset_options(void)
(void)did_set_spell_option(true);
// set cedit_key
(void)check_cedit();
- briopt_check(curwin);
// initialize the table for 'breakat'.
fill_breakat_flags();
- fill_culopt_flags(NULL, curwin);
+ didset_window_options(curwin);
}
// More side effects of setting options.
@@ -6174,6 +6173,7 @@ void win_copy_options(win_T *wp_from, win_T *wp_to)
{
copy_winopt(&wp_from->w_onebuf_opt, &wp_to->w_onebuf_opt);
copy_winopt(&wp_from->w_allbuf_opt, &wp_to->w_allbuf_opt);
+ didset_window_options(wp_to);
}
/// Copy the options from one winopt_T to another.
diff --git a/src/nvim/testdir/test_highlight.vim b/src/nvim/testdir/test_highlight.vim
index 899eb530ec..6971ecd357 100644
--- a/src/nvim/testdir/test_highlight.vim
+++ b/src/nvim/testdir/test_highlight.vim
@@ -597,6 +597,31 @@ func Test_cursorline_with_visualmode()
call delete('Xtest_cursorline_with_visualmode')
endfunc
+func Test_colorcolumn()
+ CheckScreendump
+
+ " check that setting 'colorcolumn' when entering a buffer works
+ let lines =<< trim END
+ split
+ edit X
+ call setline(1, ["1111111111","22222222222","3333333333"])
+ set nomodified
+ set colorcolumn=3,9
+ set number cursorline cursorlineopt=number
+ wincmd w
+ buf X
+ END
+ call writefile(lines, 'Xtest_colorcolumn')
+ let buf = RunVimInTerminal('-S Xtest_colorcolumn', {'rows': 10})
+ call term_sendkeys(buf, ":\<CR>")
+ call term_wait(buf)
+ call VerifyScreenDump(buf, 'Test_colorcolumn_1', {})
+
+ " clean up
+ call StopVimInTerminal(buf)
+ call delete('Xtest_colorcolumn')
+endfunc
+
func Test_colorcolumn_bri()
CheckScreendump
diff --git a/src/nvim/window.c b/src/nvim/window.c
index 83d5910400..4861b71995 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -1482,8 +1482,6 @@ static void win_init(win_T *newp, win_T *oldp, int flags)
copyFoldingState(oldp, newp);
win_init_some(newp, oldp);
-
- didset_window_options(newp);
}
/*
diff --git a/test/functional/treesitter/parser_spec.lua b/test/functional/treesitter/parser_spec.lua
index 396fe5feab..599c74102c 100644
--- a/test/functional/treesitter/parser_spec.lua
+++ b/test/functional/treesitter/parser_spec.lua
@@ -285,6 +285,25 @@ end]]
eq(true, result)
end)
+ it('support getting empty text if node range is zero width', function()
+ local text = [[
+```lua
+{}
+```]]
+ insert(text)
+ local result = exec_lua([[
+ local fake_node = {}
+ function fake_node:start()
+ return 1, 0, 7
+ end
+ function fake_node:end_()
+ return 1, 0, 7
+ end
+ return vim.treesitter.get_node_text(fake_node, 0) == ''
+ ]])
+ eq(true, result)
+ end)
+
it('can match special regex characters like \\ * + ( with `vim-match?`', function()
insert('char* astring = "\\n"; (1 + 1) * 2 != 2;')
diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua
index 0983d0d4ad..12643eec1e 100644
--- a/test/functional/ui/highlight_spec.lua
+++ b/test/functional/ui/highlight_spec.lua
@@ -2,7 +2,7 @@ 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 command, exec = helpers.command, helpers.exec
local eval, exc_exec = helpers.eval, helpers.exc_exec
local feed_command, eq = helpers.feed_command, helpers.eq
local curbufmeths = helpers.curbufmeths
@@ -1172,6 +1172,105 @@ describe('CursorLine highlight', function()
end)
end)
+describe('ColorColumn highlight', function()
+ local screen
+
+ before_each(function()
+ clear()
+ screen = Screen.new(40, 15)
+ Screen:set_default_attr_ids({
+ [1] = {background = Screen.colors.LightRed}, -- ColorColumn
+ [2] = {background = Screen.colors.Grey90}, -- CursorLine
+ [3] = {foreground = Screen.colors.Brown}, -- LineNr
+ [4] = {foreground = Screen.colors.Brown, bold = true}, -- CursorLineNr
+ [5] = {foreground = Screen.colors.Blue, bold = true}, -- NonText
+ -- NonText and ColorColumn
+ [6] = {foreground = Screen.colors.Blue, background = Screen.colors.LightRed, bold = true},
+ [7] = {reverse = true, bold = true}, -- StatusLine
+ [8] = {reverse = true}, -- StatusLineNC
+ })
+ screen:attach()
+ end)
+
+ it('when entering a buffer vim-patch:8.1.2073', function()
+ exec([[
+ set nohidden
+ split
+ edit X
+ call setline(1, ["1111111111","22222222222","3333333333"])
+ set nomodified
+ set colorcolumn=3,9
+ set number cursorline cursorlineopt=number
+ wincmd w
+ buf X
+ ]])
+ screen:expect([[
+ {4: 1 }11{1:1}11111{1:1}1 |
+ {3: 2 }22{1:2}22222{1:2}22 |
+ {3: 3 }33{1:3}33333{1:3}3 |
+ {5:~ }|
+ {5:~ }|
+ {5:~ }|
+ {8:X }|
+ {4: 1 }^11{1:1}11111{1:1}1 |
+ {3: 2 }22{1:2}22222{1:2}22 |
+ {3: 3 }33{1:3}33333{1:3}3 |
+ {5:~ }|
+ {5:~ }|
+ {5:~ }|
+ {7:X }|
+ |
+ ]])
+ end)
+
+ it("in 'breakindent' vim-patch:8.2.1689", function()
+ exec([[
+ call setline(1, 'The quick brown fox jumped over the lazy dogs')
+ set co=40 linebreak bri briopt=shift:2 cc=40,41,43
+ ]])
+ screen:expect([[
+ ^The quick brown fox jumped over the {1: }|
+ {1: } {1:l}azy dogs |
+ {5:~ }|
+ {5:~ }|
+ {5:~ }|
+ {5:~ }|
+ {5:~ }|
+ {5:~ }|
+ {5:~ }|
+ {5:~ }|
+ {5:~ }|
+ {5:~ }|
+ {5:~ }|
+ {5:~ }|
+ |
+ ]])
+ end)
+
+ it("in 'showbreak' vim-patch:8.2.1689", function()
+ exec([[
+ call setline(1, 'The quick brown fox jumped over the lazy dogs')
+ set co=40 showbreak=+++>\\ cc=40,41,43
+ ]])
+ screen:expect([[
+ ^The quick brown fox jumped over the laz{1:y}|
+ {6:+}{5:+}{6:+}{5:>\} dogs |
+ {5:~ }|
+ {5:~ }|
+ {5:~ }|
+ {5:~ }|
+ {5:~ }|
+ {5:~ }|
+ {5:~ }|
+ {5:~ }|
+ {5:~ }|
+ {5:~ }|
+ {5:~ }|
+ {5:~ }|
+ |
+ ]])
+ end)
+end)
describe("MsgSeparator highlight and msgsep fillchar", function()
local screen