aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/scripts/reviews.js4
-rw-r--r--cmake.deps/CMakeLists.txt4
-rw-r--r--cmake.packaging/CMakeLists.txt9
-rw-r--r--cmake.packaging/WixPatch.xml31
-rw-r--r--runtime/doc/news.txt2
-rw-r--r--runtime/doc/options.txt2
-rw-r--r--runtime/doc/vim_diff.txt1
-rw-r--r--runtime/ftplugin/c.lua1
-rw-r--r--runtime/ftplugin/calender.lua1
-rw-r--r--runtime/ftplugin/css.lua1
-rw-r--r--runtime/ftplugin/indent.lua1
-rw-r--r--runtime/ftplugin/xdefaults.lua1
-rw-r--r--runtime/lua/vim/_inspector.lua22
-rw-r--r--src/nvim/autocmd.c4
-rw-r--r--src/nvim/options.lua2
-rw-r--r--src/nvim/window.c2
-rw-r--r--test/functional/api/buffer_updates_spec.lua2
-rw-r--r--test/functional/legacy/prompt_buffer_spec.lua45
-rw-r--r--test/functional/legacy/window_cmd_spec.lua1
-rw-r--r--test/functional/lua/inspector_spec.lua41
-rw-r--r--test/functional/ui/fold_spec.lua7
-rw-r--r--test/old/testdir/setup.vim1
-rw-r--r--test/old/testdir/test_prompt_buffer.vim41
-rw-r--r--test/unit/helpers.lua6
24 files changed, 187 insertions, 45 deletions
diff --git a/.github/scripts/reviews.js b/.github/scripts/reviews.js
index 0ed382ac30..2aeedd0c81 100644
--- a/.github/scripts/reviews.js
+++ b/.github/scripts/reviews.js
@@ -10,12 +10,10 @@ module.exports = async ({github, context}) => {
const team_reviewers = new Array()
if (labels.includes('api')) {
reviewers.add("bfredl")
- reviewers.add("muniter")
}
if (labels.includes('build')) {
- reviewers.add("jamessan")
- reviewers.add("justinmk")
+ team_reviewers.push('ci');
}
if (labels.includes('ci')) {
diff --git a/cmake.deps/CMakeLists.txt b/cmake.deps/CMakeLists.txt
index 4659183d19..48e3cef487 100644
--- a/cmake.deps/CMakeLists.txt
+++ b/cmake.deps/CMakeLists.txt
@@ -194,8 +194,8 @@ set(TREESITTER_LUA_SHA256 930d0370dc15b66389869355c8e14305b9ba7aafd36edbfdb468c8
set(TREESITTER_VIM_URL https://github.com/vigoux/tree-sitter-viml/archive/e39a7bbcfdcfc7900629962b785c7e14503ae590.tar.gz)
set(TREESITTER_VIM_SHA256 7ca85fa1a5a9e4d057ff3b7ae53d13d31371973e734ada87a83f3f6cbe9c0e32)
-set(TREESITTER_VIMDOC_URL https://github.com/neovim/tree-sitter-vimdoc/archive/b2ec4ec5f7be24cb6f7ccffafd7204477fe5784a.tar.gz)
-set(TREESITTER_VIMDOC_SHA256 0689a57d455243de6c6a6c8737a8ce137e225eb8f32676a7037f7dd13dfaec5d)
+set(TREESITTER_VIMDOC_URL https://github.com/neovim/tree-sitter-vimdoc/archive/v2.0.0.tar.gz)
+set(TREESITTER_VIMDOC_SHA256 1ff8f4afd3a9599dd4c3ce87c155660b078c1229704d1a254433e33794b8f274)
set(TREESITTER_QUERY_URL https://github.com/nvim-treesitter/tree-sitter-query/archive/v0.1.0.tar.gz)
set(TREESITTER_QUERY_SHA256 e2b806f80e8bf1c4f4e5a96248393fe6622fc1fc6189d6896d269658f67f914c)
diff --git a/cmake.packaging/CMakeLists.txt b/cmake.packaging/CMakeLists.txt
index df43f2806a..b5c91ac457 100644
--- a/cmake.packaging/CMakeLists.txt
+++ b/cmake.packaging/CMakeLists.txt
@@ -34,8 +34,13 @@ if(WIN32)
set(CPACK_WIX_UPGRADE_GUID "207A1A70-7B0C-418A-A153-CA6883E38F4D")
set(CPACK_WIX_PRODUCT_ICON ${PROJECT_SOURCE_DIR}/runtime/neovim.ico)
- # We use a wix patch to add further options to the installer. At present, it's just to add neovim to the path
- # on installation, however, it can be extended.
+ # Create start menu and desktop shortcuts
+ set(CPACK_WIX_PROGRAM_MENU_FOLDER "${CPACK_PACKAGE_NAME}")
+ set(CPACK_PACKAGE_EXECUTABLES "nvim" "Neovim" "nvim-qt" "Neovim Qt")
+ set(CPACK_CREATE_DESKTOP_LINKS "nvim-qt")
+
+ # We use a wix patch to add further options to the installer. At present, it just adds neovim to the path
+ # on installation and defines per-user installation, however, it can be extended.
# See: https://cmake.org/cmake/help/v3.7/module/CPackWIX.html#variable:CPACK_WIX_PATCH_FILE
list(APPEND CPACK_WIX_EXTENSIONS WixUtilExtension)
list(APPEND CPACK_WIX_PATCH_FILE ${CMAKE_CURRENT_LIST_DIR}/WixPatch.xml)
diff --git a/cmake.packaging/WixPatch.xml b/cmake.packaging/WixPatch.xml
index 3cbbb04850..1179292636 100644
--- a/cmake.packaging/WixPatch.xml
+++ b/cmake.packaging/WixPatch.xml
@@ -1,14 +1,21 @@
<CPackWiXPatch>
- <!-- Fragment ID is from: <your build dir>/_CPack_Packages/win64/WIX/files.wxs -->
- <CPackWiXFragment Id="CM_CP_bin.nvim.exe">
- <Environment
- Id='UpdatePath'
- Name='PATH'
- Action='set'
- Permanent='no'
- System='yes'
- Part='last'
- Value='[INSTALL_ROOT]bin'
- />
- </CPackWiXFragment>
+ <!-- Fragment ID is from: <your build dir>/_CPack_Packages/win64/WIX/files.wxs -->
+ <CPackWiXFragment Id="CM_CP_bin.nvim.exe">
+ <Environment
+ Id='UpdatePath'
+ Name='PATH'
+ Action='set'
+ Permanent='no'
+ System='no'
+ Part='last'
+ Value='[INSTALL_ROOT]bin'
+ />
+ </CPackWiXFragment>
+
+ <!-- Allow installation by non-administrative users -->
+ <!-- https://learn.microsoft.com/windows/win32/msi/allusers -->
+ <CPackWiXFragment Id="#PRODUCT">
+ <Property Id="ALLUSERS" Value="2" />
+ <Property Id="MSIINSTALLPERUSER" Value="1" />
+ </CPackWiXFragment>
</CPackWiXPatch>
diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt
index 7b71b53b29..3ef6451ef9 100644
--- a/runtime/doc/news.txt
+++ b/runtime/doc/news.txt
@@ -66,6 +66,8 @@ The following changes may require adaptations in user config or plugins.
change is that language-specific highlight groups need to be renamed from
`@foo.help` to `@foo.vimdoc`.
+• The default value of 'commentstring' is now empty instead of "/*%s*/".
+
==============================================================================
NEW FEATURES *news-features*
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 36c02fa3cb..096b334cda 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -1390,7 +1390,7 @@ A jump table for the options with a short description can be found at |Q_op|.
insert a space.
*'commentstring'* *'cms'* *E537*
-'commentstring' 'cms' string (default "/*%s*/")
+'commentstring' 'cms' string (default "")
local to buffer
A template for a comment. The "%s" in the value is replaced with the
comment text. Currently only used to add markers for folding, see
diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt
index cd93e4d17a..d6ad9107b3 100644
--- a/runtime/doc/vim_diff.txt
+++ b/runtime/doc/vim_diff.txt
@@ -34,6 +34,7 @@ Defaults *nvim-defaults*
- 'backspace' defaults to "indent,eol,start"
- 'backupdir' defaults to .,~/.local/state/nvim/backup// (|xdg|), auto-created
- 'belloff' defaults to "all"
+- 'commentstring' defaults to ""
- 'compatible' is always disabled
- 'complete' excludes "i"
- 'directory' defaults to ~/.local/state/nvim/swap// (|xdg|), auto-created
diff --git a/runtime/ftplugin/c.lua b/runtime/ftplugin/c.lua
new file mode 100644
index 0000000000..b4e68148f5
--- /dev/null
+++ b/runtime/ftplugin/c.lua
@@ -0,0 +1 @@
+vim.bo.commentstring = '/*%s*/'
diff --git a/runtime/ftplugin/calender.lua b/runtime/ftplugin/calender.lua
new file mode 100644
index 0000000000..b4e68148f5
--- /dev/null
+++ b/runtime/ftplugin/calender.lua
@@ -0,0 +1 @@
+vim.bo.commentstring = '/*%s*/'
diff --git a/runtime/ftplugin/css.lua b/runtime/ftplugin/css.lua
new file mode 100644
index 0000000000..b4e68148f5
--- /dev/null
+++ b/runtime/ftplugin/css.lua
@@ -0,0 +1 @@
+vim.bo.commentstring = '/*%s*/'
diff --git a/runtime/ftplugin/indent.lua b/runtime/ftplugin/indent.lua
new file mode 100644
index 0000000000..b4e68148f5
--- /dev/null
+++ b/runtime/ftplugin/indent.lua
@@ -0,0 +1 @@
+vim.bo.commentstring = '/*%s*/'
diff --git a/runtime/ftplugin/xdefaults.lua b/runtime/ftplugin/xdefaults.lua
new file mode 100644
index 0000000000..b4e68148f5
--- /dev/null
+++ b/runtime/ftplugin/xdefaults.lua
@@ -0,0 +1 @@
+vim.bo.commentstring = '/*%s*/'
diff --git a/runtime/lua/vim/_inspector.lua b/runtime/lua/vim/_inspector.lua
index 92d380b08c..05983d3f0d 100644
--- a/runtime/lua/vim/_inspector.lua
+++ b/runtime/lua/vim/_inspector.lua
@@ -81,6 +81,12 @@ function vim.inspect_pos(bufnr, row, col, filter)
end
end
+ -- namespace id -> name map
+ local nsmap = {}
+ for name, id in pairs(vim.api.nvim_get_namespaces()) do
+ nsmap[id] = name
+ end
+
--- Convert an extmark tuple into a map-like table
--- @private
local function to_map(extmark)
@@ -90,6 +96,8 @@ function vim.inspect_pos(bufnr, row, col, filter)
col = extmark[3],
opts = resolve_hl(extmark[4]),
}
+ extmark.ns_id = extmark.opts.ns_id
+ extmark.ns = nsmap[extmark.ns_id] or ''
extmark.end_row = extmark.opts.end_row or extmark.row -- inclusive
extmark.end_col = extmark.opts.end_col or (extmark.col + 1) -- exclusive
return extmark
@@ -104,17 +112,9 @@ function vim.inspect_pos(bufnr, row, col, filter)
end
-- all extmarks at this position
- local extmarks = {}
- for ns, nsid in pairs(vim.api.nvim_get_namespaces()) do
- local ns_marks = vim.api.nvim_buf_get_extmarks(bufnr, nsid, 0, -1, { details = true })
- ns_marks = vim.tbl_map(to_map, ns_marks)
- ns_marks = vim.tbl_filter(is_here, ns_marks)
- for _, mark in ipairs(ns_marks) do
- mark.ns_id = nsid
- mark.ns = ns
- end
- vim.list_extend(extmarks, ns_marks)
- end
+ local extmarks = vim.api.nvim_buf_get_extmarks(bufnr, -1, 0, -1, { details = true })
+ extmarks = vim.tbl_map(to_map, extmarks)
+ extmarks = vim.tbl_filter(is_here, extmarks)
if filter.semantic_tokens then
results.semantic_tokens = vim.tbl_filter(function(extmark)
diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c
index 578542adfe..9b4cb336bc 100644
--- a/src/nvim/autocmd.c
+++ b/src/nvim/autocmd.c
@@ -1495,7 +1495,9 @@ void aucmd_restbuf(aco_save_T *aco)
}
}
win_found:
-
+ // May need to stop Insert mode if we were in a prompt buffer.
+ leaving_window(curwin);
+ // Remove the window.
win_remove(curwin, NULL);
pmap_del(handle_T)(&window_handles, curwin->handle);
if (curwin->w_grid_alloc.chars != NULL) {
diff --git a/src/nvim/options.lua b/src/nvim/options.lua
index 7be8f568b5..dffebcf14e 100644
--- a/src/nvim/options.lua
+++ b/src/nvim/options.lua
@@ -413,7 +413,7 @@ return {
alloced=true,
redraw={'curswant'},
varname='p_cms',
- defaults={if_true="/*%s*/"}
+ defaults={if_true=""}
},
{
full_name='compatible', abbreviation='cp',
diff --git a/src/nvim/window.c b/src/nvim/window.c
index 762ad13ba3..48663c5a20 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -2417,7 +2417,7 @@ static void win_equal_rec(win_T *next_curwin, bool current, frame_T *topfr, int
}
}
-static void leaving_window(win_T *const win)
+void leaving_window(win_T *const win)
FUNC_ATTR_NONNULL_ALL
{
// Only matters for a prompt window.
diff --git a/test/functional/api/buffer_updates_spec.lua b/test/functional/api/buffer_updates_spec.lua
index 25b838a4af..80e29c1ff2 100644
--- a/test/functional/api/buffer_updates_spec.lua
+++ b/test/functional/api/buffer_updates_spec.lua
@@ -75,7 +75,7 @@ local function reopenwithfolds(b)
local tick = reopen(b, origlines)
-- use markers for folds, make all folds open by default
- command('setlocal foldmethod=marker foldlevel=20')
+ command('setlocal foldmethod=marker foldlevel=20 commentstring=/*%s*/')
-- add a fold
command('2,4fold')
diff --git a/test/functional/legacy/prompt_buffer_spec.lua b/test/functional/legacy/prompt_buffer_spec.lua
index 602593d632..6c72cde855 100644
--- a/test/functional/legacy/prompt_buffer_spec.lua
+++ b/test/functional/legacy/prompt_buffer_spec.lua
@@ -3,9 +3,11 @@ local Screen = require('test.functional.ui.screen')
local feed = helpers.feed
local source = helpers.source
local clear = helpers.clear
+local command = helpers.command
local poke_eventloop = helpers.poke_eventloop
local meths = helpers.meths
local eq = helpers.eq
+local neq = helpers.neq
describe('prompt buffer', function()
local screen
@@ -14,9 +16,11 @@ describe('prompt buffer', function()
clear()
screen = Screen.new(25, 10)
screen:attach()
- source([[
- set laststatus=0 nohidden
+ command('set laststatus=0 nohidden')
+ end)
+ local function source_script()
+ source([[
func TextEntered(text)
if a:text == "exit"
" Reset &modified to allow the buffer to be closed.
@@ -63,7 +67,7 @@ describe('prompt buffer', function()
~ |
-- INSERT -- |
]])
- end)
+ end
after_each(function()
screen:detach()
@@ -71,6 +75,7 @@ describe('prompt buffer', function()
-- oldtest: Test_prompt_basic()
it('works', function()
+ source_script()
feed("hello\n")
screen:expect([[
cmd: hello |
@@ -101,6 +106,7 @@ describe('prompt buffer', function()
-- oldtest: Test_prompt_editing()
it('editing', function()
+ source_script()
feed("hello<BS><BS>")
screen:expect([[
cmd: hel^ |
@@ -170,6 +176,7 @@ describe('prompt buffer', function()
-- oldtest: Test_prompt_switch_windows()
it('switch windows', function()
+ source_script()
feed("<C-O>:call SwitchWindows()<CR>")
screen:expect{grid=[[
cmd: |
@@ -213,11 +220,41 @@ describe('prompt buffer', function()
-- oldtest: Test_prompt_while_writing_to_hidden_buffer()
it('keeps insert mode after aucmd_restbuf in callback', function()
+ source_script()
source [[
let s:buf = nvim_create_buf(1, 1)
call timer_start(0, {-> nvim_buf_set_lines(s:buf, -1, -1, 0, ['walrus'])})
]]
poke_eventloop()
- eq({ mode = "i", blocking = false }, meths.get_mode())
+ eq({ mode = 'i', blocking = false }, meths.get_mode())
+ end)
+
+ -- oldtest: Test_prompt_appending_while_hidden()
+ it('accessing hidden prompt buffer does not start insert mode', function()
+ local prev_win = meths.get_current_win()
+ source([[
+ new prompt
+ set buftype=prompt
+ set bufhidden=hide
+
+ func s:TextEntered(text)
+ if a:text == 'exit'
+ close
+ endif
+ let g:entered = a:text
+ endfunc
+ call prompt_setcallback(bufnr(), function('s:TextEntered'))
+
+ func DoAppend()
+ call appendbufline('prompt', '$', 'Test')
+ endfunc
+ ]])
+ feed('asomething<CR>')
+ eq('something', meths.get_var('entered'))
+ neq(prev_win, meths.get_current_win())
+ feed('exit<CR>')
+ eq(prev_win, meths.get_current_win())
+ command('call DoAppend()')
+ eq({ mode = 'n', blocking = false }, meths.get_mode())
end)
end)
diff --git a/test/functional/legacy/window_cmd_spec.lua b/test/functional/legacy/window_cmd_spec.lua
index 0e9775060d..c7b5878b92 100644
--- a/test/functional/legacy/window_cmd_spec.lua
+++ b/test/functional/legacy/window_cmd_spec.lua
@@ -116,6 +116,7 @@ describe('splitkeep', function()
-- oldtest: Test_splitkeep_fold()
it('does not scroll when window has closed folds', function()
exec([[
+ set commentstring=/*%s*/
set splitkeep=screen
set foldmethod=marker
set number
diff --git a/test/functional/lua/inspector_spec.lua b/test/functional/lua/inspector_spec.lua
index 5e488bb082..edc0519471 100644
--- a/test/functional/lua/inspector_spec.lua
+++ b/test/functional/lua/inspector_spec.lua
@@ -12,9 +12,13 @@ describe('vim.inspect_pos', function()
it('it returns items', function()
local ret = exec_lua([[
local buf = vim.api.nvim_create_buf(true, false)
+ local ns1 = vim.api.nvim_create_namespace("ns1")
+ local ns2 = vim.api.nvim_create_namespace("")
vim.api.nvim_set_current_buf(buf)
vim.api.nvim_buf_set_lines(0, 0, -1, false, {"local a = 123"})
vim.api.nvim_buf_set_option(buf, "filetype", "lua")
+ vim.api.nvim_buf_set_extmark(buf, ns1, 0, 10, { hl_group = "Normal" })
+ vim.api.nvim_buf_set_extmark(buf, ns2, 0, 10, { hl_group = "Normal" })
vim.cmd("syntax on")
return {buf, vim.inspect_pos(0, 0, 10)}
]])
@@ -24,7 +28,42 @@ describe('vim.inspect_pos', function()
buffer = buf,
col = 10,
row = 0,
- extmarks = {},
+ extmarks = {
+ {
+ col = 10,
+ end_col = 11,
+ end_row = 0,
+ id = 1,
+ ns = 'ns1',
+ ns_id = 1,
+ opts = {
+ hl_eol = false,
+ hl_group = 'Normal',
+ hl_group_link = 'Normal',
+ ns_id = 1,
+ priority = 4096,
+ right_gravity = true
+ },
+ row = 0
+ },
+ {
+ col = 10,
+ end_col = 11,
+ end_row = 0,
+ id = 1,
+ ns = '',
+ ns_id = 2,
+ opts = {
+ hl_eol = false,
+ hl_group = 'Normal',
+ hl_group_link = 'Normal',
+ ns_id = 2,
+ priority = 4096,
+ right_gravity = true
+ },
+ row = 0
+ }
+ },
treesitter = {},
semantic_tokens = {},
syntax = {
diff --git a/test/functional/ui/fold_spec.lua b/test/functional/ui/fold_spec.lua
index c8a3397a86..96e28c1978 100644
--- a/test/functional/ui/fold_spec.lua
+++ b/test/functional/ui/fold_spec.lua
@@ -2032,8 +2032,11 @@ describe("folded lines", function()
end)
it('multibyte fold markers work #20438', function()
- meths.win_set_option(0, 'foldmethod', 'marker')
- meths.win_set_option(0, 'foldmarker', '«,»')
+ exec([[
+ setlocal foldmethod=marker
+ setlocal foldmarker=«,»
+ setlocal commentstring=/*%s*/
+ ]])
insert([[
bbbbb
bbbbb
diff --git a/test/old/testdir/setup.vim b/test/old/testdir/setup.vim
index 25ac2d1239..473c7c7510 100644
--- a/test/old/testdir/setup.vim
+++ b/test/old/testdir/setup.vim
@@ -1,6 +1,7 @@
if exists('s:did_load')
" Align Nvim defaults to Vim.
set backspace=
+ set commentstring=/*%s*/
set complete=.,w,b,u,t,i
set directory&
set directory^=.
diff --git a/test/old/testdir/test_prompt_buffer.vim b/test/old/testdir/test_prompt_buffer.vim
index b1288b4892..43d8bb4789 100644
--- a/test/old/testdir/test_prompt_buffer.vim
+++ b/test/old/testdir/test_prompt_buffer.vim
@@ -238,7 +238,7 @@ func Test_prompt_while_writing_to_hidden_buffer()
\ done'], #{out_io: 'buffer', out_name: ''})
startinsert
END
- eval script->writefile(scriptName)
+ eval script->writefile(scriptName, 'D')
let buf = RunVimInTerminal('-S ' .. scriptName, {})
call WaitForAssert({-> assert_equal('cmd:', term_getline(buf, 1))})
@@ -251,7 +251,44 @@ func Test_prompt_while_writing_to_hidden_buffer()
call WaitForAssert({-> assert_equal('cmd:testtesttest', term_getline(buf, 1))})
call StopVimInTerminal(buf)
- call delete(scriptName)
+endfunc
+
+func Test_prompt_appending_while_hidden()
+ call CanTestPromptBuffer()
+
+ let script =<< trim END
+ new prompt
+ set buftype=prompt
+ set bufhidden=hide
+
+ func s:TextEntered(text)
+ if a:text == 'exit'
+ close
+ endif
+ echowin 'Entered:' a:text
+ endfunc
+ call prompt_setcallback(bufnr(), function('s:TextEntered'))
+
+ func DoAppend()
+ call appendbufline('prompt', '$', 'Test')
+ endfunc
+ END
+ call writefile(script, 'XpromptBuffer', 'D')
+
+ let buf = RunVimInTerminal('-S XpromptBuffer', {'rows': 10})
+ call TermWait(buf)
+
+ call term_sendkeys(buf, "asomething\<CR>")
+ call TermWait(buf)
+
+ call term_sendkeys(buf, "exit\<CR>")
+ call TermWait(buf)
+
+ call term_sendkeys(buf, ":call DoAppend()\<CR>")
+ call TermWait(buf)
+ call assert_notmatch('-- INSERT --', term_getline(buf, 10))
+
+ call StopVimInTerminal(buf)
endfunc
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/test/unit/helpers.lua b/test/unit/helpers.lua
index 686af3b461..708929ad9f 100644
--- a/test/unit/helpers.lua
+++ b/test/unit/helpers.lua
@@ -148,7 +148,11 @@ local cdef = ffi.cdef
local cimportstr
-local previous_defines_init = ''
+local previous_defines_init = [[
+typedef struct { char bytes[16]; } __attribute__((aligned(16))) __uint128_t;
+typedef struct { char bytes[16]; } __attribute__((aligned(16))) __float128;
+]]
+
local preprocess_cache_init = {}
local previous_defines_mod = ''
local preprocess_cache_mod = nil