aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--.travis.yml1
-rw-r--r--runtime/autoload/health/provider.vim8
-rw-r--r--src/nvim/edit.c4
-rw-r--r--src/nvim/message.c4
-rw-r--r--src/nvim/ops.c25
-rw-r--r--src/nvim/os/fs.c2
-rw-r--r--src/nvim/profile.c4
-rw-r--r--src/nvim/screen.c6
-rw-r--r--src/nvim/search.c2
-rw-r--r--src/nvim/spell.c2
-rw-r--r--src/nvim/syntax.c30
-rw-r--r--src/nvim/ugrid.c4
-rw-r--r--test/functional/autocmd/cursorhold_spec.lua31
-rw-r--r--test/functional/eval/executable_spec.lua7
-rw-r--r--test/functional/ui/messages_spec.lua41
-rw-r--r--third-party/CMakeLists.txt3
-rw-r--r--third-party/cmake/BuildGperf.cmake1
-rw-r--r--third-party/cmake/BuildLuarocks.cmake2
19 files changed, 134 insertions, 46 deletions
diff --git a/.gitignore b/.gitignore
index d0315edafa..453211a30e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -55,3 +55,6 @@ local.mk
/runtime/doc/*.html
/runtime/doc/tags.ref
/runtime/doc/errors.log
+
+# CLion
+/.idea/
diff --git a/.travis.yml b/.travis.yml
index 90570637ba..d550a550d8 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -138,7 +138,6 @@ addons:
- clang-4.0
- cmake
- cscope
- - g++-multilib
- gcc-multilib
- gdb
- gperf
diff --git a/runtime/autoload/health/provider.vim b/runtime/autoload/health/provider.vim
index 29bbee4888..87d82150b6 100644
--- a/runtime/autoload/health/provider.vim
+++ b/runtime/autoload/health/provider.vim
@@ -564,7 +564,10 @@ function! s:check_node() abort
endif
call health#report_info('Neovim node.js host: '. host)
- let latest_npm_cmd = has('win32') ? 'cmd /c npm info neovim --json' : 'npm info neovim --json'
+ let manager = executable('npm') ? 'npm' : 'yarn'
+ let latest_npm_cmd = has('win32') ?
+ \ 'cmd /c '. manager .' info neovim --json' :
+ \ manager .' info neovim --json'
let latest_npm = s:system(split(latest_npm_cmd))
if s:shell_error || empty(latest_npm)
call health#report_error('Failed to run: '. latest_npm_cmd,
@@ -593,7 +596,8 @@ function! s:check_node() abort
call health#report_warn(
\ printf('Package "neovim" is out-of-date. Installed: %s, latest: %s',
\ current_npm, latest_npm),
- \ ['Run in shell: npm install -g neovim'])
+ \ ['Run in shell: npm install -g neovim',
+ \ 'Run in shell (if you use yarn): yarn global add neovim'])
else
call health#report_ok('Latest "neovim" npm/yarn package is installed: '. current_npm)
endif
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index 57c4a5395c..6a37c52e3f 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -649,7 +649,9 @@ static int insert_execute(VimState *state, int key)
s->c = key;
// Don't want K_EVENT with cursorhold for the second key, e.g., after CTRL-V.
- did_cursorhold = true;
+ if (key != K_EVENT) {
+ did_cursorhold = true;
+ }
if (p_hkmap && KeyTyped) {
s->c = hkmap(s->c); // Hebrew mode mapping
diff --git a/src/nvim/message.c b/src/nvim/message.c
index 86c185dbc2..df130565e0 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -1878,8 +1878,8 @@ static void msg_puts_display(const char_u *str, int maxlen, int attr,
msg_ext_last_attr = attr;
}
// Concat pieces with the same highlight
- size_t len = strnlen((char *)str, maxlen);
- ga_concat_len(&msg_ext_last_chunk, (char *)str, len); // -V781
+ size_t len = strnlen((char *)str, maxlen); // -V781
+ ga_concat_len(&msg_ext_last_chunk, (char *)str, len);
msg_ext_cur_len += len;
return;
}
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index b96e075f66..e07e93060a 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -3085,8 +3085,9 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags)
memset(ptr, ' ', (size_t)bd.endspaces);
ptr += bd.endspaces;
// move the text after the cursor to the end of the line.
- memmove(ptr, oldp + bd.textcol + delcount,
- (size_t)((int)oldlen - bd.textcol - delcount + 1));
+ int columns = (int)oldlen - bd.textcol - delcount + 1;
+ assert(columns >= 0);
+ memmove(ptr, oldp + bd.textcol + delcount, (size_t)columns);
ml_replace(curwin->w_cursor.lnum, newp, false);
++curwin->w_cursor.lnum;
@@ -3209,11 +3210,11 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags)
xfree(newp);
oldp = ml_get(lnum);
- newp = (char_u *) xmalloc((size_t)(col + yanklen + 1));
- /* copy first part of line */
+ newp = (char_u *)xmalloc((size_t)col + (size_t)yanklen + 1);
+ // copy first part of line
memmove(newp, oldp, (size_t)col);
- /* append to first line */
- memmove(newp + col, y_array[0], (size_t)(yanklen + 1));
+ // append to first line
+ memmove(newp + col, y_array[0], (size_t)yanklen + 1);
ml_replace(lnum, newp, false);
curwin->w_cursor.lnum = lnum;
@@ -3705,11 +3706,11 @@ int do_join(size_t count,
}
}
- /* store the column position before last line */
+ // store the column position before last line
col = sumsize - currsize - spaces[count - 1];
- /* allocate the space for the new line */
- newp = (char_u *) xmalloc((size_t)(sumsize + 1));
+ // allocate the space for the new line
+ newp = (char_u *)xmalloc((size_t)sumsize + 1);
cend = newp + sumsize;
*cend = 0;
@@ -5472,7 +5473,7 @@ void cursor_pos_info(dict_T *dict)
byte_count_cursor = byte_count
+ line_count_info(ml_get(lnum), &word_count_cursor,
&char_count_cursor,
- (varnumber_T)(curwin->w_cursor.col + 1),
+ (varnumber_T)curwin->w_cursor.col + 1,
eol_size);
}
}
@@ -5490,8 +5491,10 @@ void cursor_pos_info(dict_T *dict)
if (l_VIsual_active) {
if (l_VIsual_mode == Ctrl_V && curwin->w_curswant < MAXCOL) {
getvcols(curwin, &min_pos, &max_pos, &min_pos.col, &max_pos.col);
+ int64_t cols;
+ STRICT_SUB(oparg.end_vcol + 1, oparg.start_vcol, &cols, int64_t);
vim_snprintf((char *)buf1, sizeof(buf1), _("%" PRId64 " Cols; "),
- (int64_t)(oparg.end_vcol - oparg.start_vcol + 1));
+ cols);
} else {
buf1[0] = NUL;
}
diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c
index 65362b545f..4a10b5199c 100644
--- a/src/nvim/os/fs.c
+++ b/src/nvim/os/fs.c
@@ -364,7 +364,7 @@ static bool is_executable_in_path(const char_u *name, char_u **abspath)
#ifdef WIN32
// Prepend ".;" to $PATH.
size_t pathlen = strlen(path_env);
- char *path = memcpy(xmallocz(pathlen + 3), "." ENV_SEPSTR, 2);
+ char *path = memcpy(xmallocz(pathlen + 2), "." ENV_SEPSTR, 2);
memcpy(path + 2, path_env, pathlen);
#else
char *path = xstrdup(path_env);
diff --git a/src/nvim/profile.c b/src/nvim/profile.c
index e486095fe7..52e03c895e 100644
--- a/src/nvim/profile.c
+++ b/src/nvim/profile.c
@@ -66,8 +66,10 @@ proftime_T profile_setlimit(int64_t msec) FUNC_ATTR_WARN_UNUSED_RESULT
}
assert(msec <= (INT64_MAX / 1000000LL) - 1);
proftime_T nsec = msec * 1000000LL;
+ uint64_t now = os_hrtime();
+ assert(now <= INT64_MAX);
int64_t rv;
- STRICT_ADD(os_hrtime(), nsec, &rv, int64_t);
+ STRICT_ADD((proftime_T)now, nsec, &rv, int64_t);
return rv;
}
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index a007aa9a47..553008c010 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -3778,7 +3778,7 @@ win_line (
* At end of the text line or just after the last character.
*/
if (c == NUL) {
- long prevcol = (long)(ptr - line) - (c == NUL);
+ long prevcol = (long)(ptr - line) - 1;
/* we're not really at that column when skipping some text */
if ((long)(wp->w_p_wrap ? wp->w_skipcol : wp->w_leftcol) > prevcol)
@@ -6079,8 +6079,8 @@ void grid_alloc(ScreenGrid *grid, int rows, int columns, bool copy, bool valid)
{
int new_row;
ScreenGrid new = *grid;
-
- size_t ncells = (size_t)((rows+1) * columns);
+ assert(rows >= 0 && columns >= 0);
+ size_t ncells = (size_t)rows * columns;
new.chars = xmalloc(ncells * sizeof(schar_T));
new.attrs = xmalloc(ncells * sizeof(sattr_T));
new.line_offset = xmalloc((size_t)(rows * sizeof(unsigned)));
diff --git a/src/nvim/search.c b/src/nvim/search.c
index ed18df3877..ed5934cec2 100644
--- a/src/nvim/search.c
+++ b/src/nvim/search.c
@@ -1217,7 +1217,7 @@ int do_search(
xfree(msgbuf);
msgbuf = r;
// move reversed text to beginning of buffer
- while (*r != NUL && *r == ' ') {
+ while (*r == ' ') {
r++;
}
size_t pat_len = msgbuf + STRLEN(msgbuf) - r;
diff --git a/src/nvim/spell.c b/src/nvim/spell.c
index 6fd22a6537..17306744ad 100644
--- a/src/nvim/spell.c
+++ b/src/nvim/spell.c
@@ -5283,7 +5283,7 @@ add_sound_suggest (
}
// Go over the list of good words that produce this soundfold word
- nrline = ml_get_buf(slang->sl_sugbuf, (linenr_T)(sfwordnr + 1), FALSE);
+ nrline = ml_get_buf(slang->sl_sugbuf, (linenr_T)sfwordnr + 1, false);
orgnr = 0;
while (*nrline != NUL) {
// The wordnr was stored in a minimal nr of bytes as an offset to the
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index bcb18b6e67..192cf9cb75 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -3609,7 +3609,7 @@ syn_list_one(
continue;
}
- (void)syn_list_header(did_header, 999, id);
+ (void)syn_list_header(did_header, 0, id, true);
did_header = true;
last_matchgroup = 0;
if (spp->sp_type == SPTYPE_MATCH) {
@@ -3658,7 +3658,7 @@ syn_list_one(
/* list the link, if there is one */
if (HL_TABLE()[id - 1].sg_link && (did_header || link_only) && !got_int) {
- (void)syn_list_header(did_header, 999, id);
+ (void)syn_list_header(did_header, 0, id, true);
msg_puts_attr("links to", attr);
msg_putchar(' ');
msg_outtrans(HL_TABLE()[HL_TABLE()[id - 1].sg_link - 1].sg_name);
@@ -3800,7 +3800,6 @@ static bool syn_list_keywords(
const int attr
)
{
- int outlen;
int prev_contained = 0;
const int16_t *prev_next_list = NULL;
const int16_t *prev_cont_in_list = NULL;
@@ -3818,17 +3817,20 @@ static bool syn_list_keywords(
todo--;
for (keyentry_T *kp = HI2KE(hi); kp != NULL && !got_int; kp = kp->ke_next) {
if (kp->k_syn.id == id) {
+ int outlen = 0;
+ bool force_newline = false;
if (prev_contained != (kp->flags & HL_CONTAINED)
|| prev_skipnl != (kp->flags & HL_SKIPNL)
|| prev_skipwhite != (kp->flags & HL_SKIPWHITE)
|| prev_skipempty != (kp->flags & HL_SKIPEMPTY)
|| prev_cont_in_list != kp->k_syn.cont_in_list
- || prev_next_list != kp->next_list)
- outlen = 9999;
- else
+ || prev_next_list != kp->next_list) {
+ force_newline = true;
+ } else {
outlen = (int)STRLEN(kp->keyword);
- /* output "contained" and "nextgroup" on each line */
- if (syn_list_header(did_header, outlen, id)) {
+ }
+ // output "contained" and "nextgroup" on each line
+ if (syn_list_header(did_header, outlen, id, force_newline)) {
prev_contained = 0;
prev_next_list = NULL;
prev_cont_in_list = NULL;
@@ -7047,7 +7049,7 @@ static void highlight_list_one(const int id)
sgp->sg_blend+1, NULL, "blend");
if (sgp->sg_link && !got_int) {
- (void)syn_list_header(didh, 9999, id);
+ (void)syn_list_header(didh, 0, id, true);
didh = true;
msg_puts_attr("links to", HL_ATTR(HLF_D));
msg_putchar(' ');
@@ -7092,7 +7094,8 @@ static bool highlight_list_arg(
}
}
- (void)syn_list_header(didh, (int)(vim_strsize(ts) + STRLEN(name) + 1), id);
+ (void)syn_list_header(didh, (int)(vim_strsize(ts) + STRLEN(name) + 1), id,
+ false);
didh = true;
if (!got_int) {
if (*name != NUL) {
@@ -7210,9 +7213,10 @@ const char *highlight_color(const int id, const char *const what,
/// @param did_header did header already
/// @param outlen length of string that comes
/// @param id highlight group id
+/// @param force_newline always start a new line
/// @return true when started a new line.
static bool syn_list_header(const bool did_header, const int outlen,
- const int id)
+ const int id, bool force_newline)
{
int endcol = 19;
bool newline = true;
@@ -7225,10 +7229,10 @@ static bool syn_list_header(const bool did_header, const int outlen,
}
msg_outtrans(HL_TABLE()[id - 1].sg_name);
endcol = 15;
- } else if (ui_has(kUIMessages) || msg_silent) {
+ } else if ((ui_has(kUIMessages) || msg_silent) && !force_newline) {
msg_putchar(' ');
adjust = false;
- } else if (msg_col + outlen + 1 >= Columns) {
+ } else if (msg_col + outlen + 1 >= Columns || force_newline) {
msg_putchar('\n');
if (got_int) {
return true;
diff --git a/src/nvim/ugrid.c b/src/nvim/ugrid.c
index 8adb421ee1..9e4aaff878 100644
--- a/src/nvim/ugrid.c
+++ b/src/nvim/ugrid.c
@@ -6,6 +6,7 @@
#include <stdio.h>
#include <limits.h>
+#include "nvim/assert.h"
#include "nvim/vim.h"
#include "nvim/ui.h"
#include "nvim/ugrid.h"
@@ -72,8 +73,9 @@ void ugrid_scroll(UGrid *grid, int top, int bot, int left, int right, int count)
for (i = start; i != stop; i += step) {
UCell *target_row = grid->cells[i] + left;
UCell *source_row = grid->cells[i + count] + left;
+ assert(right >= left && left >= 0);
memcpy(target_row, source_row,
- sizeof(UCell) * (size_t)(right - left + 1));
+ sizeof(UCell) * ((size_t)right - (size_t)left + 1));
}
}
diff --git a/test/functional/autocmd/cursorhold_spec.lua b/test/functional/autocmd/cursorhold_spec.lua
new file mode 100644
index 0000000000..506b688853
--- /dev/null
+++ b/test/functional/autocmd/cursorhold_spec.lua
@@ -0,0 +1,31 @@
+local helpers = require('test.functional.helpers')(after_each)
+
+local clear = helpers.clear
+local eq = helpers.eq
+local eval = helpers.eval
+local feed = helpers.feed
+local retry = helpers.retry
+local source = helpers.source
+local sleep = helpers.sleep
+
+describe('CursorHoldI', function()
+ before_each(clear)
+
+ -- NOTE: since this test uses RPC it is not necessary to trigger the initial
+ -- issue (#3757) via timer's or RPC callbacks in the first place.
+ it('is triggered after input', function()
+ source([[
+ set updatetime=1
+
+ let g:cursorhold = 0
+ augroup test
+ au CursorHoldI * let g:cursorhold += 1
+ augroup END
+ ]])
+ feed('ifoo')
+ retry(5, nil, function()
+ sleep(1)
+ eq(1, eval('g:cursorhold'))
+ end)
+ end)
+end)
diff --git a/test/functional/eval/executable_spec.lua b/test/functional/eval/executable_spec.lua
index e346b786a6..1107fe6a0b 100644
--- a/test/functional/eval/executable_spec.lua
+++ b/test/functional/eval/executable_spec.lua
@@ -24,12 +24,7 @@ describe('executable()', function()
eq('arg1=lemon;arg2=sky;arg3=tree;',
call('system', sibling_exe..' lemon sky tree'))
end
- local is_executable = call('executable', sibling_exe)
- if iswin() and is_executable ~= expected then
- pending('XXX: sometimes fails on AppVeyor')
- else
- eq(expected, is_executable)
- end
+ eq(expected, call('executable', sibling_exe))
end)
describe('exec-bit', function()
diff --git a/test/functional/ui/messages_spec.lua b/test/functional/ui/messages_spec.lua
index 09e13b1464..2857c2fe1e 100644
--- a/test/functional/ui/messages_spec.lua
+++ b/test/functional/ui/messages_spec.lua
@@ -804,6 +804,7 @@ describe('ui/builtin messages', function()
[3] = {bold = true, reverse = true},
[4] = {bold = true, foreground = Screen.colors.SeaGreen4},
[5] = {foreground = Screen.colors.Blue1},
+ [6] = {bold = true, foreground = Screen.colors.Magenta},
})
end)
@@ -856,6 +857,46 @@ describe('ui/builtin messages', function()
eq('ErrorMsg xxx ctermfg=15 ctermbg=1 guifg=White guibg=Red',
meths.command_output("hi ErrorMsg"))
end)
+
+ it(':syntax list langGroup output', function()
+ command("syntax on")
+ command("set syntax=vim")
+ screen:try_resize(110,7)
+ feed(':syntax list vimComment<cr>')
+ screen:expect([[
+ {6:--- Syntax items ---} |
+ vimComment {5:xxx} {5:match} /\s"[^\-:.%#=*].*$/ms=s+1,lc=1 {5:excludenl} {5:contains}=@vimCommentGroup,vimCommentString |
+ |
+ {5:match} /\<endif\s\+".*$/ms=s+5,lc=5 {5:contains}=@vimCommentGroup,vimCommentString |
+ {5:match} /\<else\s\+".*$/ms=s+4,lc=4 {5:contains}=@vimCommentGroup,vimCommentString |
+ {5:links to} Comment |
+ {4:Press ENTER or type command to continue}^ |
+ ]])
+
+ feed('<cr>')
+ screen:try_resize(55,7)
+ feed(':syntax list vimComment<cr>')
+ screen:expect([[
+ |
+ {5:match} /\<endif\s\+".*$/ms=s+5,lc=5 |
+ {5:contains}=@vimCommentGroup,vimCommentString |
+ {5:match} /\<else\s\+".*$/ms=s+4,lc=4 {5:c}|
+ {5:ontains}=@vimCommentGroup,vimCommentString |
+ {5:links to} Comment |
+ {4:Press ENTER or type command to continue}^ |
+ ]])
+ feed('<cr>')
+
+ -- ignore final whitespace inside string
+ -- luacheck: push ignore
+ eq([[--- Syntax items ---
+vimComment xxx match /\s"[^\-:.%#=*].*$/ms=s+1,lc=1 excludenl contains=@vimCommentGroup,vimCommentString
+ match /\<endif\s\+".*$/ms=s+5,lc=5 contains=@vimCommentGroup,vimCommentString
+ match /\<else\s\+".*$/ms=s+4,lc=4 contains=@vimCommentGroup,vimCommentString
+ links to Comment]],
+ meths.command_output('syntax list vimComment'))
+ -- luacheck: pop
+ end)
end)
describe('ui/ext_messages', function()
diff --git a/third-party/CMakeLists.txt b/third-party/CMakeLists.txt
index 497e95e38c..768c89f922 100644
--- a/third-party/CMakeLists.txt
+++ b/third-party/CMakeLists.txt
@@ -1,6 +1,6 @@
# This is not meant to be included by the top-level.
cmake_minimum_required (VERSION 2.8.12)
-project(NVIM_DEPS)
+project(NVIM_DEPS C)
# Needed for: check_c_compiler_flag()
include(CheckCCompilerFlag)
@@ -101,6 +101,7 @@ set(DEPS_CXX_COMPILER "${CMAKE_CXX_COMPILER}")
if(CMAKE_OSX_SYSROOT)
set(DEPS_C_COMPILER "${DEPS_C_COMPILER} -isysroot${CMAKE_OSX_SYSROOT}")
+ set(DEPS_CXX_COMPILER "${DEPS_CXX_COMPILER} -isysroot${CMAKE_OSX_SYSROOT}")
endif()
# Cross compiling: use these for dependencies built for the
diff --git a/third-party/cmake/BuildGperf.cmake b/third-party/cmake/BuildGperf.cmake
index 71c3cc1eef..e922f71ed5 100644
--- a/third-party/cmake/BuildGperf.cmake
+++ b/third-party/cmake/BuildGperf.cmake
@@ -2,6 +2,7 @@
# cross compiling we still want to build for the HOST system, whenever
# writing a recipe that is meant for cross-compile, use the HOSTDEPS_* variables
# instead of DEPS_* - check the main CMakeLists.txt for a list.
+enable_language(CXX)
# BuildGperf(CONFIGURE_COMMAND ... BUILD_COMMAND ... INSTALL_COMMAND ...)
# Reusable function to build Gperf, wraps ExternalProject_Add.
diff --git a/third-party/cmake/BuildLuarocks.cmake b/third-party/cmake/BuildLuarocks.cmake
index 7f038c732d..87e2946c96 100644
--- a/third-party/cmake/BuildLuarocks.cmake
+++ b/third-party/cmake/BuildLuarocks.cmake
@@ -163,7 +163,7 @@ if(USE_BUNDLED_BUSTED)
endif()
add_custom_command(OUTPUT ${BUSTED_EXE}
COMMAND ${LUAROCKS_BINARY}
- ARGS build busted 2.0.rc13-0 ${LUAROCKS_BUILDARGS}
+ ARGS build busted 2.0.0 ${LUAROCKS_BUILDARGS}
DEPENDS penlight)
add_custom_target(busted DEPENDS ${BUSTED_EXE})