Commit Graph

9761 Commits

Author SHA1 Message Date
Björn Linse
d9b3ebfede FIXUP: duplicate error number in #7422 2017-11-23 07:36:35 +01:00
Justin M. Keyes
51637f4256 tui: move terminfo_is_term_family() 2017-11-22 23:19:51 +01:00
Justin M. Keyes
8c959be511 Merge #7593 'PVS static analysis fixes' 2017-11-22 23:12:30 +01:00
Björn Linse
a4f6cec7a3
cmdline: CmdlineEnter and CmdlineLeave autocommands (#7422)
vim-patch:fafcf0dd59fd

patch 8.0.1206: no autocmd for entering or leaving the command line

Problem:    No autocmd for entering or leaving the command line.
Solution:   Add CmdlineEnter and CmdlineLeave.

fafcf0dd59
2017-11-22 22:35:20 +01:00
Peter Kalauskas
fe2546c81a move.c: remove unreachable break statement
n > 0 verified by while condition, (--n < 0) always false
2017-11-22 09:21:34 -08:00
Peter Kalauskas
1b94f24d6e eval.c: remove nonnullret deadcode
The following calls can't return null:
* xmalloc
* xcalloc
* get_buffer_info
* get_tabpage_info
* get_vim_var_str
* get_win_info
* tv_get_string
* tv_list_alloc
* tv_list_alloc_ret
* vim_strnsave
2017-11-22 09:21:34 -08:00
Peter Kalauskas
c030a38168 helpers.c: statically assert integer falls within range 2017-11-22 09:21:34 -08:00
Peter Kalauskas
c24b74c229 Fix for pvs V782, pointer access to first element of array 2017-11-22 09:21:34 -08:00
Peter Kalauskas
fdcde7dba3 input.c: replace if/else with switch 2017-11-22 09:21:34 -08:00
Peter Kalauskas
dddc609859 menu.c: remove conditional expression that is always true 2017-11-22 09:21:34 -08:00
KunMing Xie
9393be477a vim-patch:8.0.0289 (#7591)
Problem:    No test for "ga" and :ascii.
Solution:   Add a test. (Dominique Pelle, closes vim/vim#1429)

21d7c9b601
2017-11-22 11:59:30 +01:00
KunMing Xie
bb7795e820 vim-patch:8.0.0292 (#7592)
Problem:    The stat test is a bit slow.
Solution:   Remove a couple of sleep comments and reduce another.

a2f28859bf
2017-11-22 11:57:56 +01:00
Jan Edmund Lazo
7b686881a1 win: default grepprg to findstr.exe (#7611) 2017-11-22 00:35:51 +01:00
Justin M. Keyes
9b6bf8fa37 Merge #7345 'location-list update on buffer-modified' 2017-11-21 01:53:12 +01:00
Justin M. Keyes
84d9245c70 pvscheck.sh: auto-detect URL by default
The hardcoded URL breaks very often, this confuses people.
Instead, auto-detect if no URL is provided.

Also auto-detect if the script is invoked with no arguments.
2017-11-21 01:38:30 +01:00
Phlosioneer
8674b0c3d1 syntax.c: Fix maybe-uninitialized warning (#7596)
When building in release mode, gcc generated a maybe-initialized
warning in get_syn_options. The warning is both right and wrong;
there is an execution path where the len variable is not
initialized in the code:
...
int len;
...
for (fidx = ARRAY_SIZE(flagtab); --fidx >= 0; ) {
  p = flagtab[fidx].name;
  int i;
  for (i = 0, len = 0; p[i] != NUL; i += 2, ++len)
    if (arg[len] != p[i] && arg[len] != p[i + 1])
      break;
  // <snip>
}
...
  arg = skipwhite(arg + len);
...

The initial for loop will not execute if ARRAY_SIZE(flagtab) == 0,
and thus len will never be initialized. flagtab is a local-static
variable, initialized to a long array of structured data, so
ARRAY_SIZE(flagtab) can't be 0.

However, gcc doesn't recognize ARRAY_SIZE(flagtab) as a constant.
There are any number of reasons this could happen. In any case,
the message can be fixed with a len=0 before the first for loop.

In addition to the above warning, I've labeled flagtab and
first_letters as const. They should never change.
2017-11-21 00:04:49 +01:00
Hannu Hartikainen
c391401648 helptags: fix double-free (#7600)
closes #7599
Helped-by: oni-link <knil.ino@gmail.com>

Freeing `dirname` was first introduced by a code refactoring from `ex_helptags()` to `do_helptags()` (`vim-patch:7.4.1551`)(#4648) and later removed by `vim-patch:7.4.1562`(#4660).
Only problem with that is, that the patches were not applied in order so the fixing patch was declared `N/A`.

So `do_helptags()` should have never freed `dirname`.
2017-11-20 21:20:01 +01:00
KunMing Xie
7d24a95b45 vim-patch:8.0.0287 (#7590)
Problem:    Cannot access the arguments of the current function in debug mode.
            (Luc Hermitte)
Solution:   use get_funccal(). (Lemonboy, closes vim/vim#1432, closes vim/vim#1352)

c7d9eacefa
2017-11-20 02:02:15 +01:00
Phlosioneer
df10714991 server.c: Fix bug in release mode (#7594)
When compiling with CMAKE_BUILD_TYPE=RelWithDebInfo, several
-Wmaybe-uninitialized warnings are printed. These were thought to
be false positives (#5061); there are no control paths that lead
to an uninitialized value. However, when gcc is run in -O2 mode,
it makes a mistake while generating the necessary logic.

Specifically, for the code:
...
  int = 0; // Index of the server whose address equals addr.
  for (; i < watchers.ga_len; i++) {
    watcher = ((SocketWatcher **)watchers.ga_data)[i];
    // <snip>
  }
  if (i >= watchers.ga_len) {
    ELOG("Not listening on %s", addr);
    return;
  }
...

Gcc generates:
...
<+98>:  cmp  %ebx, %ebp
<+100>: jg   0x530f13   <server_stop+55>
<+102>: cmp  %ebp, ebx
<+104>: jl   0x530f7e   <server_stop+162>
...

Normally, the if statement should catch the only control path
where watcher is not assigned: watchers.ga_len <= 0. When
compiled, the assembly lines 98 and 100 correspond to checking if
i < watchers.ga_len, and the lines 102 and 104 correspond to
checking if i >= watchers.ga_len. The assembly seems to compare
ebp (which is watchers.ga_len) with ebx (which is i), and jump
if greater; then do the same comparison and jump if less. This is
where gcc makes a mistake: it flips the order of the cmp
instruction. This means that the REAL behavior is first check if
i < watchers.ga_len and then check if i < watchers.ga_len. Which
means the code inside the if statement is NEVER executed; no
combination of i and watchers.ga_len will ever trigger ELOG().

So not only is this a use of an uninitialized value if
watchers.ga_len == 0 (or technically, if it's less than zero too),
it also clobbers any error detection if the for loop reaches the
last entry (which would normally cause i == watchers.ga_len too).

This commit fixes this issue by adding a bool to keep track of
whether a watcher was found during the loop. This makes gcc
generate the correct code, avoiding both bugs.
2017-11-20 01:55:28 +01:00
ZyX
05a3c12118 unittests: Run vim_str2nr tests with GC enabled 2017-11-19 23:36:40 +03:00
ZyX
1ffa4e5047 doc: Update documentation 2017-11-19 23:33:02 +03:00
ZyX
64158f2b0b unittests: Populate ARGTYPES in child process only 2017-11-19 22:32:02 +03:00
ZyX
fe3a58273e cmake: Fix api/version test failure 2017-11-19 22:24:26 +03:00
ZyX
03a129aacf Merge branch 'master' into expression-parser 2017-11-19 22:05:22 +03:00
ZyX
6ea3a08fdb syntax: Fix duplicate group definitions 2017-11-19 22:01:19 +03:00
ZyX
7c20f60b88 unittests: Avoid infinite cycle somewhere because of init failure 2017-11-19 22:01:14 +03:00
ZyX
ebb33eddd9 tests: Stabilize float format and %e in format_luav and format_string 2017-11-19 22:00:59 +03:00
ZyX
731dc82f8c ex_getln: Fix memory leak in color_expr_cmdline 2017-11-19 21:21:45 +03:00
ZyX
f20f97c936 *: Fix linter errors 2017-11-19 21:13:27 +03:00
ZyX
a94255a7ac tests: Use single test file for unit and functional parser tests 2017-11-19 20:20:06 +03:00
ZyX
53fa435a1f functests: Fix ui/cmdline test 2017-11-19 19:34:15 +03:00
ZyX
764cf3251d charset: Add missing include needed for vim_str2nr 2017-11-19 19:27:21 +03:00
ZyX
c287893225 viml/parser/expressions,unittests: Do better testing, fix found issues 2017-11-19 19:22:54 +03:00
Justin M. Keyes
de8b1fd1de Merge #7587 'vim-patch:8.0.0283' 2017-11-19 13:47:37 +01:00
ckelsel
540ed64635 vim-patch:8.0.0283
Problem:    The return value of mode() does not indicate that completion is
            active in Replace and Insert mode. (Zhen-Huan (Kenny) Hu)
Solution:   Add "c" or "x" for two kinds of completion. (Yegappan Lakshmanan,
            closes vim/vim#1397)  Test some more modes.

e90858d022
2017-11-19 19:53:47 +08:00
Justin M. Keyes
d6f9d1df04 version bump 2017-11-18 12:46:38 +01:00
Justin M. Keyes
6d2c30daf3 NVIM v0.2.2
FEATURES:
a6de144c3e 'viewoptions': add "curdir" flag #7447
b6a603fe51 node.js remote-plugin support #7458
f5d4da0144 :checkhealth : validate 'runtimepath' #7526

FIXES:
e6beb60da5 :terminal : fix crash on resize #7547
f19e5d6530 work around gnome-terminal memory leak #7573
07931ed1c8 'guicursor': use DECSCUSR for xterm-likes #7576
f185c739bc 'os_open: UV_EINVAL on NULL filename' #7561
e8af34dc63 win: provider: Detect(): return *.cmd path #7577
eacd788cf5 :checkhealth : fix check for npm and yarn #7569
a43a573ad5 health.vim: normalize slashes for script path #7525
69e3308771 cmake: install runtime/rgb.txt
d0b05e3c36 runtime: syntax error in `runtime/syntax/tex.vim` #7518
55d8967147 tutor: some fixes #7510

CHANGES:
9837a9c401 remove legacy alias to `v:count` #7407
c5f001a46a runtime: revert netrw update #7557
67e4529292 defaults: scrollback=10000 #7556
881f9e42d1 process_close(): uv_unref() detached processes #7539
2017-11-18 12:39:14 +01:00
Justin M. Keyes
f19e5d6530 tui: setrgbf/setrgbb: emit semicolons for VTE
Severe memory leak observed on gnome-terminal 3.26.2 VTE 0.50.2 when
colon-delimited RGB sequences are used.

closes #7573
2017-11-18 12:26:09 +01:00
Eric Roberts
a6de144c3e 'viewoptions': add "curdir" flag #7447
The flag enables the current local directory set by ":lcd" to be saved
to views which is the current default behaviour. The option can be
removed to disable this behaviour.

closes #7435

vim-patch:8.0.1289
2017-11-18 12:02:15 +01:00
Justin M. Keyes
f185c739bc
Merge #7561 'os_open: UV_EINVAL on NULL filename' 2017-11-18 01:01:25 +01:00
Jan Edmund Lazo
e8af34dc63 win: provider: Detect(): return *.cmd path (#7577)
neovim-ruby-host is a ruby script.
neovim-node-host is a shell script.
Both don't work in cmd.exe so gem and npm provide batchfile shims.

Return the full path of these shims, cmd.exe knows better what to do with these files.
2017-11-17 23:52:51 +01:00
Justin M. Keyes
bf3f0efb3a os_nodetype: rework
Make the Windows impl closer to Vim os_win32.c, and the Unix impl closer
to Vim os_unix.c.

Outcomes:
- Do not send negative fd to close(). ref #4806 #4772 #6860
- Fallback return-value is now correct in (hopefully) all cases.
- unix: check S_ISXXX instead of relying on os_open (which can fail for
  irrelevant reasons). buf_write() expects NODE_WRITABLE for character
  devices such as /dev/stderr. 96f834a842
2017-11-17 23:26:51 +01:00
Justin M. Keyes
d135ba99b2 os_open, os_stat: UV_EINVAL on NULL filename
EINVAL (instead of EFAULT) because that's what glibc does:
https://github.com/bminor/glibc/blob/master/io/open.c#L35

os_nodetype: check for UV_EINVAL explicitly.

ref #4370
ref https://github.com/neovim/neovim/issues/4370#issuecomment-344366571
ref ac055d677a

ref #4772
2017-11-17 22:30:38 +01:00
Justin M. Keyes
07931ed1c8
tui: 'guicursor': use DECSCUSR for xterm-likes (#7576)
Anything claiming to be an xterm gets DECSCUSR. This is the only
reasonable choice unless/until we get more reliable detection (#7490).

ref #6997
closes #7550
2017-11-17 22:24:01 +01:00
Sewoong Park
ee031eb525 lint #7562 2017-11-17 00:57:36 +01:00
Billy Vong
eacd788cf5 :checkhealth: fix check for npm and yarn (#7569)
Fix bug that checked for npm AND yarn, where we wanted npm OR yarn.
But since we call `npm` exclusively, and it's highly unlikely you have
yarn installed without npm, let's just remove the yarn check altogether.

Addresses https://github.com/neovim/node-client/issues/41
2017-11-16 23:43:50 +01:00
Drew Neil
59b0d9f62d doc: Fix pathshorten() example (#7571) 2017-11-16 23:41:16 +01:00
zandrmartin
f8d40e7d53 health.vim: define highlights as default (#7560) 2017-11-14 22:08:50 +01:00
Justin M. Keyes
c5f001a46a
runtime: revert netrw update (#7557)
fixes #7527
fixes #7536
2017-11-14 20:56:00 +01:00
Justin M. Keyes
67e4529292
defaults: scrollback=10000 (#7556) 2017-11-14 20:55:25 +01:00