Commit Graph

9655 Commits

Author SHA1 Message Date
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
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
nateozem
30a21830d0 doc: test/README.md: migrate wiki info (#7552) 2017-11-14 01:43:52 +01:00
Justin M. Keyes
8fff2ef74a
vim-patch:8.0.0227 (#7548)
Problem:    Crash when 'fileformat' is forced to "dos" and the first line in
            the file is empty and does not have a CR character.
Solution:   Don't check for CR before the start of the buffer.

2aa5f696b9
2017-11-13 08:30:25 +01:00
James McCoy
8d8212d384
Merge pull request #7545 from jamessan/test-fixes
Fix test failures found in Debian builds, closes #7522
2017-11-12 21:09:44 -05:00
Marco Hinz
d5b7f28b44 test/unit/path_spec: expect correct buffer size (#7514)
Fixed-size buffers and lfs.currentdir().. does not compute. The tests would fail
if the current working directory was longer than expected.
2017-11-13 02:28:07 +01:00
Jan Edmund Lazo
a43a573ad5 health.vim: normalize slashes for script path (#7525)
:checkhealth reports that remote plugins are unregistered
after running :UpdateRemotePlugins because of the backslashes in filepath.
Normalize them to forward slashes because the paths in rplugin.vim are normalized in autoload/remote/host.vim.
2017-11-13 02:10:06 +01:00
Justin M. Keyes
e6beb60da5
:terminal : fix crash on resize (#7547)
closes #7538
Fix wrong window references from #7440

Remove some eager resizing. Still mostly doesn't address #4997.
2017-11-13 02:06:32 +01:00
Justin M. Keyes
20c672a460 Merge #7530 'vim-patch:8.0.0226 vim-patch:8.0.0224' 2017-11-13 01:26:22 +01:00
KunMing Xie
6b8c34137c vim-patch: NA
* vim-patch:8.0.0245

Problem:    The generated zh_CN.cp936.po message file is not encoded properly.
Solution:   Instead of using zh_CN.po as input, use zh_CN.UTF-8.po.

16038d50c4

* vim-patch:8.0.0248

Problem:    vim_strcat() cannot handle overlapping arguments.
Solution:   Use mch_memmove() instead of strcpy(). (Justin M Keyes,
            closes vim/vim#1415)

45600ce8f2
2017-11-12 23:27:08 +01:00
James McCoy
b63cde97f4
tests: terminal: Assert for SIGWINCH handling before continuing
Fixes test failures like

    test/functional/terminal/cursor_spec.lua @ 62: terminal cursor with number column is positioned correctly when focused
    ./test/functional/ui/screen.lua:302: Row 2 did not match.
    Expected:
      |{7:  1 }tty ready                                     |
      |*{7:  2 }{1: }                                             |
      |{7:  3 }                                              |
      |{7:  4 }                                              |
      |{7:  5 }                                              |
      |{7:  6 }                                              |
      |{3:-- TERMINAL --}                                    |
    Actual:
      |{7:  1 }tty ready                                     |
      |*{7:  2 }rows: 6, cols: 46                             |
      |{7:  3 }{1: }                                             |
      |{7:  4 }                                              |
      |{7:  5 }                                              |
      |{7:  6 }                                              |
      |{3:-- TERMINAL --}                                    |
2017-11-12 16:45:39 -05:00
James McCoy
0407ddb364
Use PRId64 to format Integer when calling api_set_error
Integer is a 64-bit type so using %d can produce incorrect results.

    test/functional/api/highlight_spec.lua @ 35: highlight api nvim_get_hl_by_id
    ...W7Xi/neovim-0.2.1/test/functional/api/highlight_spec.lua:46: Expected objects to be the same.
    Passed in:
    (string) 'Invalid highlight id: 7671724'
    Expected:
    (string) 'Invalid highlight id: 30000'
2017-11-12 16:45:39 -05:00
James McCoy
cf75de710c
tui_spec: Convert nil to "" before formatting it
This fixes an apparent difference in behavior between Lua and LuaJIT.
Lua fails to format nil:

    test/functional/terminal/tui_spec.lua:381: bad argument #2 to 'format' (string expected, got nil)
2017-11-12 16:45:39 -05:00
Justin M. Keyes
69e3308771 cmake: install runtime/rgb.txt
closes #6682
2017-11-12 15:52:21 +01:00
Justin M. Keyes
881f9e42d1
process_close(): uv_unref() detached processes (#7539)
Doc for UV_PROCESS_DETACHED in uv.h mentions:
> child process will still keep the parent's event loop alive unless
> the parent process calls uv_unref() on the child's process handle.

ref #3944
2017-11-12 15:34:04 +01:00
ckelsel
ea020f2e26 fix lint error 2017-11-11 09:04:48 +08:00
Justin M. Keyes
b6a603fe51
Merge #7458 'remote: add node host' 2017-11-11 01:54:32 +01:00
KunMing Xie
a2fdd0a72f vim-patch:8.0.0237 (#7531)
Problem:    When setting wildoptions=tagfile the completion context is not set
            correctly. (desjardins)
Solution:   Check for EXPAND_TAGS_LISTFILES. (Christian Brabandt, closes vim/vim#1399)

ba47b51ff8
2017-11-11 01:26:55 +01:00
KunMing Xie
4fa0970519 vim-patch:8.0.0242 (#7532)
Problem:    Completion of user defined functions is not covered by tests.
Solution:   Add tests.  Also test various errors of user-defined commands.
            (Dominique Pelle, closes vim/vim#1413)

65c836e600
2017-11-11 00:00:11 +01:00