aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmake.deps/cmake/BuildLibuv.cmake1
-rw-r--r--cmake.deps/cmake/LibvtermCMakeLists.txt8
-rw-r--r--runtime/filetype.vim3
-rw-r--r--runtime/lua/man/health.lua20
-rw-r--r--runtime/lua/vim/filetype.lua2
-rw-r--r--src/nvim/autocmd.c17
-rw-r--r--src/nvim/eval.c12
-rw-r--r--src/nvim/eval/funcs.c19
-rw-r--r--src/nvim/eval/typval.c4
-rw-r--r--src/nvim/fileio.c2
-rw-r--r--src/nvim/globals.h2
-rw-r--r--src/nvim/message.c4
-rw-r--r--src/nvim/testdir/test_cursor_func.vim8
-rw-r--r--src/nvim/testdir/test_filetype.vim1
-rw-r--r--src/nvim/testdir/test_menu.vim29
15 files changed, 100 insertions, 32 deletions
diff --git a/cmake.deps/cmake/BuildLibuv.cmake b/cmake.deps/cmake/BuildLibuv.cmake
index 3f7d1a0aa9..c21e166d95 100644
--- a/cmake.deps/cmake/BuildLibuv.cmake
+++ b/cmake.deps/cmake/BuildLibuv.cmake
@@ -11,6 +11,7 @@ ExternalProject_Add(libuv
-DBUILD_TESTING=OFF
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DLIBUV_BUILD_SHARED=OFF
+ ${BUILD_TYPE_STRING}
CMAKE_CACHE_ARGS
-DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES}
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/libuv)
diff --git a/cmake.deps/cmake/LibvtermCMakeLists.txt b/cmake.deps/cmake/LibvtermCMakeLists.txt
index ff1d2d6b79..d7ec9eacad 100644
--- a/cmake.deps/cmake/LibvtermCMakeLists.txt
+++ b/cmake.deps/cmake/LibvtermCMakeLists.txt
@@ -41,14 +41,6 @@ file(GLOB VTERM_SOURCES ${CMAKE_SOURCE_DIR}/src/*.c)
add_library(vterm ${VTERM_SOURCES} ${TBL_FILES_HEADERS})
install(TARGETS vterm ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
-add_library(vterm-shared SHARED ${VTERM_SOURCES} ${TBL_FILES_HEADERS})
-set_target_properties(vterm-shared PROPERTIES
- OUTPUT_NAME vterm
- SOVERSION 0)
-install(TARGETS vterm-shared
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
-
install(FILES include/vterm.h include/vterm_keycodes.h
DESTINATION include)
diff --git a/runtime/filetype.vim b/runtime/filetype.vim
index 183d50134c..b6673c1762 100644
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -1751,6 +1751,9 @@ au BufNewFile,BufRead *.sed setf sed
" SubRip
au BufNewFile,BufRead *.srt setf srt
+" SubStation Alpha
+au BufNewFile,BufRead *.ass,*.ssa setf ssa
+
" svelte
au BufNewFile,BufRead *.svelte setf svelte
diff --git a/runtime/lua/man/health.lua b/runtime/lua/man/health.lua
new file mode 100644
index 0000000000..11d7148216
--- /dev/null
+++ b/runtime/lua/man/health.lua
@@ -0,0 +1,20 @@
+local M = {}
+
+local report_ok = vim.fn['health#report_ok']
+local report_error = vim.fn['health#report_error']
+
+local function check_runtime_file(name)
+ local path = vim.env.VIMRUNTIME .. '/' .. name
+ if vim.loop.fs_stat(path) then
+ report_error(string.format('%s detected. Please delete %s', name, path))
+ else
+ report_ok(string.format('%s not in $VIMRUNTIME', name))
+ end
+end
+
+function M.check()
+ check_runtime_file('plugin/man.vim')
+ check_runtime_file('autoload/man.vim')
+end
+
+return M
diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua
index 36ea97fb21..e204fe8ae2 100644
--- a/runtime/lua/vim/filetype.lua
+++ b/runtime/lua/vim/filetype.lua
@@ -970,6 +970,8 @@ local extension = {
mot = 'srec',
['s19'] = 'srec',
srt = 'srt',
+ ssa = 'ssa',
+ ass = 'ssa',
st = 'st',
imata = 'stata',
['do'] = 'stata',
diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c
index 81d495ee27..5b5ea43d86 100644
--- a/src/nvim/autocmd.c
+++ b/src/nvim/autocmd.c
@@ -1743,17 +1743,18 @@ bool apply_autocmds_group(event_T event, char *fname, char *fname_io, bool force
sfname = xstrdup(fname);
// Don't try expanding the following events.
if (event == EVENT_CMDLINECHANGED || event == EVENT_CMDLINEENTER
- || event == EVENT_CMDLINELEAVE || event == EVENT_CMDWINENTER
- || event == EVENT_CMDWINLEAVE || event == EVENT_CMDUNDEFINED
+ || event == EVENT_CMDLINELEAVE || event == EVENT_CMDUNDEFINED
+ || event == EVENT_CMDWINENTER || event == EVENT_CMDWINLEAVE
|| event == EVENT_COLORSCHEME || event == EVENT_COLORSCHEMEPRE
|| event == EVENT_DIRCHANGED || event == EVENT_DIRCHANGEDPRE
|| event == EVENT_FILETYPE || event == EVENT_FUNCUNDEFINED
- || event == EVENT_MODECHANGED || event == EVENT_OPTIONSET
- || event == EVENT_QUICKFIXCMDPOST || event == EVENT_QUICKFIXCMDPRE
- || event == EVENT_REMOTEREPLY || event == EVENT_SPELLFILEMISSING
- || event == EVENT_SYNTAX || event == EVENT_SIGNAL
- || event == EVENT_TABCLOSED || event == EVENT_USER
- || event == EVENT_WINCLOSED || event == EVENT_WINSCROLLED) {
+ || event == EVENT_MENUPOPUP || event == EVENT_MODECHANGED
+ || event == EVENT_OPTIONSET || event == EVENT_QUICKFIXCMDPOST
+ || event == EVENT_QUICKFIXCMDPRE || event == EVENT_REMOTEREPLY
+ || event == EVENT_SIGNAL || event == EVENT_SPELLFILEMISSING
+ || event == EVENT_SYNTAX || event == EVENT_TABCLOSED
+ || event == EVENT_USER || event == EVENT_WINCLOSED
+ || event == EVENT_WINSCROLLED) {
fname = xstrdup(fname);
} else {
fname = FullName_save(fname, false);
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 6eaf3d1f5e..ebc60ea5c7 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -6454,11 +6454,14 @@ pos_T *var2fpos(const typval_T *const tv, const bool dollar_lnum, int *const ret
return NULL;
}
-/// Convert list in "arg" into a position and optional file number.
-/// When "fnump" is NULL there is no file number, only 3 items.
+/// Convert list in "arg" into position "posp" and optional file number "fnump".
+/// When "fnump" is NULL there is no file number, only 3 items: [lnum, col, off]
/// Note that the column is passed on as-is, the caller may want to decrement
/// it to use 1 for the first column.
///
+/// @param charcol if true, use the column as the character index instead of the
+/// byte index.
+///
/// @return FAIL when conversion is not possible, doesn't check the position for
/// validity.
int list2fpos(typval_T *arg, pos_T *posp, int *fnump, colnr_T *curswantp, bool charcol)
@@ -6498,13 +6501,16 @@ int list2fpos(typval_T *arg, pos_T *posp, int *fnump, colnr_T *curswantp, bool c
return FAIL;
}
// If character position is specified, then convert to byte position
+ // If the line number is zero use the cursor line.
if (charcol) {
// Get the text for the specified line in a loaded buffer
buf_T *buf = buflist_findnr(fnump == NULL ? curbuf->b_fnum : *fnump);
if (buf == NULL || buf->b_ml.ml_mfp == NULL) {
return FAIL;
}
- n = buf_charidx_to_byteidx(buf, posp->lnum, (int)n) + 1;
+ n = buf_charidx_to_byteidx(buf,
+ posp->lnum == 0 ? curwin->w_cursor.lnum : posp->lnum,
+ (int)n) + 1;
}
posp->col = (colnr_T)n;
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c
index f2ef8e5cdd..a326c44371 100644
--- a/src/nvim/eval/funcs.c
+++ b/src/nvim/eval/funcs.c
@@ -1270,7 +1270,7 @@ static void f_ctxsize(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
/// Otherwise use the column number as a byte offset.
static void set_cursorpos(typval_T *argvars, typval_T *rettv, bool charcol)
{
- long line, col;
+ long lnum, col;
long coladd = 0;
bool set_curswant = true;
@@ -1284,7 +1284,7 @@ static void set_cursorpos(typval_T *argvars, typval_T *rettv, bool charcol)
return;
}
- line = pos.lnum;
+ lnum = pos.lnum;
col = pos.col;
coladd = pos.coladd;
if (curswant >= 0) {
@@ -1293,10 +1293,15 @@ static void set_cursorpos(typval_T *argvars, typval_T *rettv, bool charcol)
}
} else if ((argvars[0].v_type == VAR_NUMBER || argvars[0].v_type == VAR_STRING)
&& (argvars[1].v_type == VAR_NUMBER || argvars[1].v_type == VAR_STRING)) {
- line = tv_get_lnum(argvars);
+ lnum = tv_get_lnum(argvars);
+ if (lnum < 0) {
+ semsg(_(e_invarg2), tv_get_string(&argvars[0]));
+ } else if (lnum == 0) {
+ lnum = curwin->w_cursor.lnum;
+ }
col = (long)tv_get_number_chk(&argvars[1], NULL);
if (charcol) {
- col = buf_charidx_to_byteidx(curbuf, (linenr_T)line, (int)col) + 1;
+ col = buf_charidx_to_byteidx(curbuf, (linenr_T)lnum, (int)col) + 1;
}
if (argvars[2].v_type != VAR_UNKNOWN) {
coladd = (long)tv_get_number_chk(&argvars[2], NULL);
@@ -1305,11 +1310,11 @@ static void set_cursorpos(typval_T *argvars, typval_T *rettv, bool charcol)
emsg(_(e_invarg));
return;
}
- if (line < 0 || col < 0 || coladd < 0) {
+ if (lnum < 0 || col < 0 || coladd < 0) {
return; // type error; errmsg already given
}
- if (line > 0) {
- curwin->w_cursor.lnum = (linenr_T)line;
+ if (lnum > 0) {
+ curwin->w_cursor.lnum = (linenr_T)lnum;
}
if (col > 0) {
curwin->w_cursor.col = (colnr_T)col - 1;
diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c
index 961c963170..a0b06aaaf4 100644
--- a/src/nvim/eval/typval.c
+++ b/src/nvim/eval/typval.c
@@ -3750,9 +3750,11 @@ varnumber_T tv_get_number_chk(const typval_T *const tv, bool *const ret_error)
linenr_T tv_get_lnum(const typval_T *const tv)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT
{
+ const int did_emsg_before = did_emsg;
linenr_T lnum = (linenr_T)tv_get_number_chk(tv, NULL);
- if (lnum == 0) { // No valid number, try using same function as line() does.
+ if (lnum <= 0 && did_emsg_before == did_emsg && tv->v_type != VAR_NUMBER) {
int fnum;
+ // No valid number, try using same function as line() does.
pos_T *const fp = var2fpos(tv, true, &fnum, false);
if (fp != NULL) {
lnum = fp->lnum;
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index b31b8336aa..30898981de 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -1683,7 +1683,7 @@ failed:
HANDLE conin = CreateFile("CONIN$", GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ, (LPSECURITY_ATTRIBUTES)NULL,
OPEN_EXISTING, 0, (HANDLE)NULL);
- vim_ignored = _open_osfhandle(conin, _O_RDONLY);
+ vim_ignored = _open_osfhandle((intptr_t)conin, _O_RDONLY);
#endif
}
}
diff --git a/src/nvim/globals.h b/src/nvim/globals.h
index 1a6c639261..209caca880 100644
--- a/src/nvim/globals.h
+++ b/src/nvim/globals.h
@@ -199,7 +199,7 @@ EXTERN dict_T vimvardict; // Dictionary with v: variables
EXTERN dict_T globvardict; // Dictionary with g: variables
/// g: value
#define globvarht globvardict.dv_hashtab
-EXTERN bool did_emsg; // set by emsg() when the message
+EXTERN int did_emsg; // set by emsg() when the message
// is displayed or thrown
EXTERN bool called_vim_beep; // set if vim_beep() is called
EXTERN bool did_emsg_syntax; // did_emsg set because of a
diff --git a/src/nvim/message.c b/src/nvim/message.c
index fef5055c84..a90e675423 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -658,7 +658,7 @@ static bool emsg_multiline(const char *s, bool multiline)
// interrupt message).
if (cause_errthrow(s, severe, &ignore)) {
if (!ignore) {
- did_emsg = true;
+ did_emsg++;
}
return true;
}
@@ -721,7 +721,7 @@ static bool emsg_multiline(const char *s, bool multiline)
} else {
flush_buffers(FLUSH_MINIMAL); // flush internal buffers
}
- did_emsg = true; // flag for DoOneCmd()
+ did_emsg++; // flag for DoOneCmd()
}
emsg_on_display = true; // remember there is an error message
diff --git a/src/nvim/testdir/test_cursor_func.vim b/src/nvim/testdir/test_cursor_func.vim
index 2e625f2388..9801a45915 100644
--- a/src/nvim/testdir/test_cursor_func.vim
+++ b/src/nvim/testdir/test_cursor_func.vim
@@ -32,7 +32,7 @@ func Test_move_cursor()
call cursor(1, 1, 1)
call assert_equal([1, 1, 1], getcurpos()[1:3])
- call assert_equal(-1, cursor(-1, -1))
+ call assert_fails('call cursor(-1, -1)', 'E475:')
quit!
endfunc
@@ -353,8 +353,14 @@ func Test_setcursorcharpos()
normal G
call setcursorcharpos([1, 1])
call assert_equal([1, 1], [line('.'), col('.')])
+
call setcursorcharpos([2, 7, 0])
call assert_equal([2, 9], [line('.'), col('.')])
+ call setcursorcharpos([0, 7, 0])
+ call assert_equal([2, 9], [line('.'), col('.')])
+ call setcursorcharpos(0, 7, 0)
+ call assert_equal([2, 9], [line('.'), col('.')])
+
call setcursorcharpos(3, 4)
call assert_equal([3, 1], [line('.'), col('.')])
call setcursorcharpos([3, 1])
diff --git a/src/nvim/testdir/test_filetype.vim b/src/nvim/testdir/test_filetype.vim
index 03ce8e9e8c..d123d469a6 100644
--- a/src/nvim/testdir/test_filetype.vim
+++ b/src/nvim/testdir/test_filetype.vim
@@ -537,6 +537,7 @@ let s:filename_checks = {
\ 'squirrel': ['file.nut'],
\ 'srec': ['file.s19', 'file.s28', 'file.s37', 'file.mot', 'file.srec'],
\ 'srt': ['file.srt'],
+ \ 'ssa': ['file.ass', 'file.ssa'],
\ 'sshconfig': ['ssh_config', '/.ssh/config', '/etc/ssh/ssh_config.d/file.conf', 'any/etc/ssh/ssh_config.d/file.conf', 'any/.ssh/config', 'any/.ssh/file.conf'],
\ 'sshdconfig': ['sshd_config', '/etc/ssh/sshd_config.d/file.conf', 'any/etc/ssh/sshd_config.d/file.conf'],
\ 'st': ['file.st'],
diff --git a/src/nvim/testdir/test_menu.vim b/src/nvim/testdir/test_menu.vim
index 75992d3313..db7ec92bf8 100644
--- a/src/nvim/testdir/test_menu.vim
+++ b/src/nvim/testdir/test_menu.vim
@@ -481,6 +481,35 @@ func Test_popup_menu()
unmenu PopUp
endfunc
+" Test for MenuPopup autocommand
+func Test_autocmd_MenuPopup()
+ CheckNotGui
+
+ set mouse=a
+ set mousemodel=popup
+ aunmenu *
+ autocmd MenuPopup * exe printf(
+ \ 'anoremenu PopUp.Foo <Cmd>let g:res = ["%s", "%s"]<CR>',
+ \ expand('<afile>'), expand('<amatch>'))
+
+ call feedkeys("\<RightMouse>\<Down>\<CR>", 'tnix')
+ call assert_equal(['n', 'n'], g:res)
+
+ call feedkeys("v\<RightMouse>\<Down>\<CR>\<Esc>", 'tnix')
+ call assert_equal(['v', 'v'], g:res)
+
+ call feedkeys("gh\<RightMouse>\<Down>\<CR>\<Esc>", 'tnix')
+ call assert_equal(['s', 's'], g:res)
+
+ call feedkeys("i\<RightMouse>\<Down>\<CR>\<Esc>", 'tnix')
+ call assert_equal(['i', 'i'], g:res)
+
+ autocmd! MenuPopup
+ aunmenu PopUp.Foo
+ unlet g:res
+ set mouse& mousemodel&
+endfunc
+
" Test for listing the menus using the :menu command
func Test_show_menus()
" In the GUI, tear-off menu items are present in the output below