Commit Graph

1367 Commits

Author SHA1 Message Date
Justin M. Keyes
18127f64c4 test: executable(): AppVeyor: Ignore "sibling" failure
This test sometimes fails on AppVeyor, but we still want to exercise the
code path and get at least a "soft" notification in the pending list.
2017-02-04 11:07:50 +01:00
Justin M. Keyes
67fbbdb1b5 win: executable(): full path without extension
Absolute path is considered executable even *without* an extension.
2017-02-04 11:07:50 +01:00
Justin M. Keyes
cd5b131575 vim-patch:8.0.0280
patch 8.0.0280: problem setting multi-byte environment var on MS-Windows

Problem:    On MS-Windows setting an environment variable with multi-byte
            strings does not work well.
Solution:   Use wputenv when possible. (Taro Muraoka, Ken Takata)

7c23d1d9d9cc
2017-02-04 11:07:49 +01:00
Justin M. Keyes
978c95e5c4 test: helpers.clear(): Set common env vars only if not passed. 2017-02-04 11:07:49 +01:00
Justin M. Keyes
bbfdb84ae1 build: Do not force busted into front of $PATH
This was a workaround from long ago, but it doesn't seem to be needed
anymore. And it breaks the $PATH on the Windows build (AppVeyor CI).

After this change python3 (and 2) is correctly detected on AppVeyor CI.

References #5946
2017-02-04 11:07:49 +01:00
Justin M. Keyes
224f99b85d win: Append process dir to $PATH
This allows executables to be found by :!, system(), and executable() if
they live next to ("sibling" to) nvim.exe. This is what gvim on Windows
does, and also matches the behavior of Win32 SearchPath().

c4a249a736/src/os_win32.c (L354-L370)
2017-02-04 11:07:49 +01:00
Rui Abreu Ferreira
7d58aba80c test: executable() 2017-02-04 11:07:49 +01:00
Justin M. Keyes
6d4e08d226 test: Remove whitespace (avoid LF/CRLF discrepancy) 2017-02-04 04:04:27 +01:00
Lucas Hoffmann
bea2e5738d tests: Migrate legacy test 8. #4179
The test produces some "hit enter" prompts and error messages that had to be
dealt with by `feed`ing CTRL-L to nvim.
2017-02-03 23:05:08 +01:00
Justin M. Keyes
6239492d9c Merge #2990 'tests: Migrate legacy test 69.' 2017-02-03 22:55:05 +01:00
Lucas Hoffmann
b4c172d612 tests: Modernize migrated legacy test 69. 2017-02-03 22:54:38 +01:00
James McCoy
11f2bd5fa3 Merge pull request #6050 from jamessan/fix-xclip-tests
Fix xclip tests to cleanup on their own
2017-02-03 11:36:52 -05:00
Justin M. Keyes
8b804948df Merge #5975 from jamessan/execute-with-attrs
execute: Correctly capture output with highlight attributes
2017-02-03 12:36:17 +01:00
James McCoy
ce51fa0955
test: Turn printargs_path into a function
When test/functional/eval/system_spec.lua is run on its own,
helpers.os_name() was being called before a session had been created.
This caused that describe block to fail.

Turning printargs_path into a function delays the call of
helpers.os_name() until the test is being run, which ensures a session
is available.
2017-02-02 19:52:59 -05:00
James McCoy
7e30fe3157
test: Make xclip exit after one selection request
Closes #4900
2017-02-02 19:52:06 -05:00
James McCoy
e8899178ec Merge pull request #5869 from hardenedapple/undojoin-curhead
Don't set `b_u_curhead` in `ex_undojoin()`
2017-02-02 12:45:02 -05:00
Justin M. Keyes
f8b21b6d82
test: execute() + :redir 2017-02-01 18:31:53 -05:00
James McCoy
7e7f01a3be
execute: Correctly capture output with highlight attributes
Closes #5422
2017-02-01 18:28:32 -05:00
Justin M. Keyes
88bc9f8e92 xstrlcat: Allow overlapped pointers. (#6017)
memcpy is not equivalent to memmove (which is used by vim_strcat), this
could cause subtle bugs if xstrlcat is used as a replacement for
vim_strcat. But vim_strcat is inconsistent: in the `else` branch it uses
strcpy, which doesn't allow overlap.

Helped-by: oni-link <knil.ino@gmail.com>
Helped-by: James McCoy <jamessan@jamessan.com>
Helped-by: Nikolai Aleksandrovich Pavlov <kp-pav@yandex.ru>
2017-01-31 17:42:22 +01:00
Matthew Malcomson
d25649fa01 undo: :earlier, g-: Set b_u_seq_cur correctly. (#6016)
Previously alternate branches were not accounted for properly, with this
change g- after an undo to a branch point works.

The current sequence number b_u_seq_cur is used in undo_time(), in
u_doit() this was calculated by subtracting one from the curhead
sequence number.

The curhead header entry represents the change that was just undone, so
the sequence number we want is that of the change we have moved to. This
is the sequence number of the undo head that is the uh_next element of
this curhead. That sequence number is not always one less than the
curhead sequence number -- there may have been an alternate branch at
this point.

Instead of subtracting one, we now directly find the sequence number of
curhead->uh_next.
2017-01-31 05:46:55 +01:00
Tommy Allen
bdfa1479d2 eval.c: Fix findfile(), :find, gf in :terminal. #6009
Closes #4299
2017-01-31 00:48:30 +01:00
Justin M. Keyes
81525dc5c3 defaults: Revert 'mouse=a' (#6022)
This default causes too much confusion for terminal users. Until
a better approach is implemented, revert to the traditional default.

Better solution would be:
- Implement a right-click menu for TUI
- Set 'mouse=a' *only* if clipboard is working.

Closes #5938
2017-01-28 14:30:57 +01:00
Justin M. Keyes
25427ae892 test: Fix broken test. 2017-01-24 14:25:50 +01:00
Justin M. Keyes
a8a673c20d Merge #5964 from equalsraf/windows-clipboard
Windows clipboard support
2017-01-24 00:24:26 +01:00
Justin M. Keyes
a3a241d313 ci: XXX: Disable "throttle" test on Travis macOS. 2017-01-23 22:17:16 +01:00
Justin M. Keyes
6be8ea0787 coverity/133845: Negative array index read. (FP)
`find_command(s->ca.cmdchar) >= 0` was established near the start of
normal_execute(). And `unshift_special(&s->ca);` "should" not ever
result in s->ca.cmdchar containing a multibyte char.

So only an assert() is needed here.
2017-01-23 15:49:37 +01:00
Matthew Malcomson
e0e4825897 Don't set b_u_curhead in ex_undojoin()
vim-patch:8.0.0205
This provides no benefit, and introduces some bugs.
2017-01-22 21:19:46 +00:00
Justin M. Keyes
be09274287 test: Avoid Lua closure limit.
Fixes Lua error:
> function at line 543 has more than 60 upvalues
2017-01-22 14:13:53 +01:00
Justin M. Keyes
043d8ba422 Merge #5782 'Visual-mode put from @. register' 2017-01-22 11:10:24 +01:00
Justin M. Keyes
497db001df test: expand_env_esc()
Test expand_env_esc() using the same parameters reported in #3725.

Closes #3725
2017-01-21 18:17:44 +01:00
Justin M. Keyes
bd16e116eb win: test: Enable jobstart() 'shell' test. (#5983) 2017-01-21 17:04:39 +01:00
Rui Abreu Ferreira
1cb52309f1 Enable clipboard provider tests in Windows 2017-01-20 18:29:18 +00:00
Justin M. Keyes
ef753a76b9 tui: Enable mode-sensitive cursor by default.
Also give NVIM_TUI_ENABLE_CURSOR_SHAPE more granularity:
0 = do not change cursor shape
1 = non-blinking ("steady") cursor with mode-sensitive shape
2 = blinking cursor with mode-sensitive shape

Note: blink state is not changed for Konsole, instead user's terminal
preference makes the decision. (Can't do that for xterm-likes, DECSCUSR
forces us to choose blink-state.)

This is a temporary step until the TUI respects 'guicursor'
Ref: https://github.com/neovim/neovim/issues/2583#issuecomment-272988384
2017-01-20 15:48:41 +01:00
Justin M. Keyes
e7de3b5f84 test/timer_spec.lua: Relax expected count.
Test sometimes fails on AppVeyor (Windows). 300/50=6, but there could be
environment factors that miss the timer interval on the "edges".
timer_start() does not have such a hard requirement.
2017-01-19 14:46:29 +01:00
Justin M. Keyes
3a574af3c4 ci: Disable "CTRL-C interrupts :global" test
This test is low-value, high-cost. It's slow, and sometimes crashes
luajit. It's still enabled on local runs, that's good enough.
2017-01-19 14:22:01 +01:00
Justin M. Keyes
7637df4b59 win: test: XXX: Disable some tests. 2017-01-19 09:55:57 +01:00
Justin M. Keyes
32c7971b2a win: fix warnings 2017-01-19 09:55:57 +01:00
Justin M. Keyes
e40946a5be win: test: enable job_spec.lua
- Default to powershell.
- Avoid hardcoded "-c".
- Remove ^M character from received lines.
- pending_win32(): clear() is unnecessary and it pollutes the tests.

Closes #3973
Helped-by: Rui Abreu Ferreira <raf-ep@gmx.com>
2017-01-19 09:55:57 +01:00
James McCoy
75e6af44e0 Merge pull request #5963 from jamessan/screen-expect-clarity
test: screen: Assert expected row count matches configured screen height
2017-01-18 15:16:07 -05:00
Justin M. Keyes
2ee60e5b28 test: nvim_ui_attach() with huge dimensions. (#5974)
Also:
- Attempt to constrain wall-of-text in screen.lua.
- Windows: Enable screen_basic_spec.lua

Closes #2180
2017-01-18 20:28:35 +01:00
James McCoy
e2b031a342 test: screen_basic: Re-enable min width/height test 2017-01-18 11:24:39 -05:00
James McCoy
4322021bae test: screen: Assert expected row count matches configured screen height
When there is a difference in expected vs. actual row count, the user
gets a confusing message about being unable to string concat a nil value
from screen:expect.

This assert makes it clear what the problem is rather than requiring
people to dig through the code of screen:expect to determine what
happened.
2017-01-18 11:24:34 -05:00
Matthew Malcomson
b7ee8fbc81 put fixup, esp. ". register close #5709 #5781
Note some bugs were judged to have too ugly a fix to solve, tests to
demonstrate these problems, and the explanation behind not fixing them
are below.

describe('register . problems', function()
  before_each(reset)

  -- The difficulty here is: The basic requirement is that the text
  -- inserted is treated as if it were typed in insert mode. This is why
  -- the paste method is to enter insert mode and enter the ". register
  -- into readbuf1.
  -- We can't add a count into the readbuf here because the insert mode
  -- count is implemented with readbuf2 which is checked for characters
  -- after readbuf1.
  -- Hence, the ".gp command (which adds extra characters into readbuf1
  -- to emulate leaving the cursor after the text by moving the cursor
  -- after inserting the text) would insert the motion characters into
  -- the buffer instead of using them to move after the insert has been
  -- done.
  -- I could probably get this working properly with a special flag put
  -- into start_redo_ins() and set in do_put(), but I think this adds
  -- much more complexity than fixing this bug justifies.
  pending('should not change the ". register with ".2p', function()
    local orig_register = funcs.getreg('.')
    feed('2".p')
    eq(orig_register, funcs.getreg('.'))
  end)

  describe("cursor positioning after undo and redo with '.'", function()
    before_each(reset)
    local function make_cursor_test(macro_string)
      return function()
        feed(macro_string)
        local afterpos = funcs.getcurpos()
        local orig_string = curbuf_contents()
        feed('u.')
        eq(afterpos, funcs.getcurpos())
        expect(orig_string)
      end
    end
    -- The difficulty here is: setting the cursor after the end of the
    -- pasted text is done by adding a motion command to the
    -- stuffbuffer after the insert.
    -- Modifying 'redobuff' is done in the code that handles inserting
    -- text and moving around.
    -- I could add a special case in ins_esc() that checks for a flag
    -- set in do_put() to add the motion character to the redo buffer,
    -- but I think that is starting to get way too convoluted for the
    -- benefit.
    pending('should be the same after ".gp and ".gpu.',
            make_cursor_test('".gp'))
    -- The difficulty here is: putting forwards is implemented by using
    -- 'a' instead of 'i' to start insert.
    -- Undoing with 'u' an insert that began with 'a' leaves the cursor
    -- where the first character was inserted, not where the cursor was
    -- when the 'a' was pressed.
    -- We account for this the first time by saving the cursor position
    -- in do_put(), but this isn't stored in redobuff for a second time
    -- around.
    -- We can't change how such a fundamental action as undo after
    -- inserting with 'a' behaves, we could add in a special case
    -- whereby we set a flag in do_put() and read it when entering
    -- insert mode but this seems like way too much to fix such a minor
    -- bug.
    pending('should be the same after ".pu. and ".pu.u.',
            make_cursor_test('".pu.'))
  end)
end)
2017-01-18 12:28:10 +00:00
Justin M. Keyes
be4c896845 DirChanged: set <amatch> (#5961)
Also:
- test that DirChanged is not recursive
- fix 'not trigger if :cd fails' test on Windows
2017-01-17 10:47:20 +01:00
Marco Hinz
340f79b4b8 Merge #5928 'New event: DirChanged' 2017-01-16 13:36:16 +01:00
Justin M. Keyes
3ba5e43d2e Merge #5918 'vim-patch: 7.4.2006, 7.4.2075, 7.4.2077, 7.4.2117, 7.4.2300, 7.4.2313, 7.4.2314'. 2017-01-16 00:59:50 +01:00
Matthew Malcomson
b5560a69b1 setpos(): Set lowercase mark in other buffers (#5753)
Also make setpos("'A", [999, 1, 1, 0]) fail, i.e. return -1 (assuming there is no buffer 999).

Fixes #5713

Background:

`:help setpos()` mentions an argument `"bufnum"` that determines the buffer a mark should be put in.
This argument is respected for uppercase marks, but not for lowercase marks.
This is reasonable (though I personally would like `setpos()` to be able to set marks in other buffers), but the help doesn't mention this anywhere.

It's also strange that attempting to change buffers with `setpos('.', [bufnr('#'), 1, 1, 0])` alerts the user that having a different buffer is an error, while attempting to set a mark with `setpos("'d", [bufnr('#'), 1, 1, 0])` doesn't tell the user that the `"bufnum"` argument is an error.
2017-01-15 21:36:29 +01:00
James McCoy
bde9bedb0b
job: Consume content from rbuffer before invoking the callback again
While a job callback is active, it may be invoked again.  Since the
data handled by the first invocation of the callback hasn't been marked
as consumed, the subsequent invocation will see the same data.

Reported-by: Daniel Hahler
Patch-by: oni-link
Closes #5889
2017-01-14 07:49:07 -05:00
Marco Hinz
a2f8adad4c
Add autocmd/dirchanged_spec.lua 2017-01-13 15:29:05 +01:00
Justin M. Keyes
f686635420 Merge #5933 from justinmk/dir-bufenter
open_buffer(): Raise `BufEnter` for directories.
2017-01-13 04:09:37 +01:00
Justin M. Keyes
82edcb593b Windows: enable more tests 2017-01-13 01:17:12 +01:00
Justin M. Keyes
cc7f1aba46 test: BufEnter 2017-01-13 01:17:11 +01:00
James McCoy
674db4b01f eval: Remove dictwatcher from watchers queue before freeing it
This fixes a use-after-free noticed by ASAN which would occur when a
dictwatcher was still active on a dictionary when the dictionary was
freed.

    fun! MakeWatch()
      let d = {'foo': 'bar'}
      call dictwatcheradd(d, 'foo', function('...'))
    endfun

Patch-by: oni-link
Closes #5930
2017-01-12 14:47:43 -05:00
James McCoy
f2dff86493
inccommand: Preview :sub commands only after the delimiter is present
Closes #5888
2017-01-11 21:05:02 -05:00
James McCoy
dcd77c64ef
inccommand: Suppress error reporting when previewing commands
Closes #5912
2017-01-11 21:05:02 -05:00
Justin M. Keyes
9ecdce1d53 test: system([...]): v:shell_error 2017-01-11 01:05:56 +01:00
Rui Abreu Ferreira
1e079fa987 system([...]): Set v:shell_error=-1 if not executable.
Do _not_ set v:shell_error on parameter validation error.

system([...]) does not invoke a shell, so this change is somewhat
questionable. But `:help v:shell_error` is sufficiently vague to allow
-1 in this case.
2017-01-11 01:05:55 +01:00
Rui Abreu Ferreira
ac44d0ed54 test: system([...]) 2017-01-11 01:05:55 +01:00
James McCoy
6520517e22
vim-patch:7.4.2008
Problem:    evalcmd() has a confusing name.
Solution:   Rename to execute().  Make silent optional.  Support a list of
            commands.

79815f1ec7
2017-01-10 07:14:12 -05:00
lonerover
2b56cf099a fix test failure 2017-01-09 13:06:24 +08:00
Rui Abreu Ferreira
ae1ba2b2fb test: Windows: Re-enable shada functional tests
One of the tests remains disabled until we figure out the expected
behaviour of mkdir() on Windows when `prot` is passed.
2017-01-08 03:23:15 +01:00
Rui Abreu Ferreira
32156f06f7 XDG: Windows: resolve $LOCALAPPDATA, $TEMP (#5278)
After #4964 environment variables in the XDG "fallback" table are no
longer expanded.

Fallback to correctly expanded $LOCALAPPDATA, $TEMP. If that fails
(unlikely), fallback to hard-coded paths (e.g. ~/AppData/Local).

Closes #5255
2017-01-08 03:18:00 +01:00
Justin M. Keyes
d2f16d534f Merge #5079 from ZyX-I/shada-save-current-pos
shada: Save current cursor position before saving jumps
2017-01-07 23:15:50 +01:00
ZyX
3967618fa5 unittest: Fix linter errors 2017-01-07 19:12:18 +03:00
ZyX
dea4bb33dc unittest,memory: Fix tests 2017-01-07 19:07:32 +03:00
ZyX
88a4820cc9 unittest: Add failing test for freeing dictionaries in a list 2017-01-07 15:54:55 +03:00
ZyX
728367a196 unittest: Add dict_items function 2017-01-07 15:54:55 +03:00
ZyX
41cbb7891d unittest: Add failing test of freeing lists 2017-01-07 14:48:21 +03:00
ZyX
8fd3d31329 unittest: Allow mocking allocator calls 2017-01-07 14:48:21 +03:00
James McCoy
b4c0c61f5c Merge pull request #5826 from ZyX-I/fix-typval_encode
Refactor eval/typval_encode.h
2017-01-06 21:11:33 -05:00
ZyX
527636f158 functests: Add tests for new fixes 2017-01-06 23:52:31 +03:00
nfnty
7a344c795f path.c: vim_FullName(): Fix heap overflow #5737
- Clarify documentation.
- Return `FAIL` and truncate if `fname` is too long.
- Add tests.
2017-01-05 15:17:34 +01:00
Justin M. Keyes
e21aef1e10 Merge #5874 from ZyX-I/fix-5482
Fix plugin which opens ShaDa files
2017-01-04 17:34:17 +01:00
ZyX
81ef9f55ae shada: Save current cursor position before saving jumps 2017-01-04 16:34:06 +03:00
Justin M. Keyes
0ce77a744a Merge #5749 from justinmk/test-ctrl-c 2017-01-04 13:32:39 +01:00
ZyX
24b3b938e8 plugin/shada: Handle NUL characters with intchar correctly
Fixes #5482
2017-01-04 15:06:33 +03:00
ZyX
d82f5d1ba2 plugin/msgpack: Support character constants like '\0' 2017-01-04 14:53:02 +03:00
Justin M. Keyes
6f9be2464c Merge #5872 justinmk/test_autochdir 2017-01-04 08:24:36 +01:00
Justin M. Keyes
a63675c384 test/helpers.rmdir(): Windows: Change to top-level dir on failure.
On Windows, if the nvim process has a directory open the lua process
cannot remove it. After failing once, it's safe to force `nvim` to the
top-level directory. Then try again.
2017-01-04 07:23:13 +01:00
Justin M. Keyes
097c8dccca refactor: Remove VimL function test_autochdir()
- Eliminate global test_autochdir.
- Eliminate VimL function test_autochdir()
- Use a lua test instead. Fails correctly after reverting
  0c43479979 / vim-patch:7.4.2015.
2017-01-04 07:23:13 +01:00
Justin M. Keyes
e03b43bd07 test: skip_fragile(), TEST_SKIP_FRAGILE
Let build systems define TEST_SKIP_FRAGILE to skip tests that are known to be
resource-intensive (unreliable on slow systems).

References https://github.com/neovim/neovim/pull/5488#issuecomment-265622113
2017-01-04 04:24:18 +01:00
Justin M. Keyes
f4d326cf10 test: ctrl_c_spec
- Improve test reliability by only checking for a line with the string
  we are interested in ("Interrupt").
- Try to avoid OOM by loading an existing big file instead of looping to
  create one.
2017-01-04 03:18:30 +01:00
ZyX
3c64b814d2 unittests: Fix linter errors 2017-01-03 23:58:12 +03:00
ZyX
937b6fac8f unittest: Fix linter errors 2017-01-03 22:54:55 +03:00
ZyX
b38e725428 unittest: Refactor preprocess.lua
Keeps arguments separated and not joined as a single string as long as possible. 
Abstracts away additional arguments so that Gcc:preprocess should work for 
compilers with different conventions should they be supported.
2017-01-03 22:54:55 +03:00
ZyX
2151ddbd73 unittest: Move nil checks to Gcc:preprocess 2017-01-03 22:54:54 +03:00
ZyX
0d7b779cab unittest: Record previous defines in another place
Previous commit made preprocess.lua know how its output will be used. This moves 
state to cimport, making only it know which is cleaner.
2017-01-03 22:54:54 +03:00
ZyX
410d18ef5c unittest: Allow multiple indirect includes
Works by saving all preprocessor defines and reusing them on each run. This also
saves NVIM_HEADER_H defines. Saving other defines is needed for defines like
`Map(foo, bar)` which are sometimes used to declare types or functions. Saving
types or function declarations is not needed because they are recorded as luajit
state.

Fixes #5857
2017-01-03 22:54:54 +03:00
ZyX
136b382e64 tests: Add tests for partials dumping
Also fixed dumping of partials by encode_vim_to_object and added code which is 
able to work with partials and dictionaries to test/unit/eval/helpers.lua 
(mostly copied from #5119, except for partials handling).
2017-01-03 22:51:29 +03:00
ZyX
759e736b0a eval/typval_encode: Fix infinite loop
Occurs when trying to dump a partial with attached self dictionary which
references that partial. “Infinite” loop should normally result in Neovim killed
by OOM killer.

Also moved the place when partials are unreferenced by clear_tv: from
…FUNC_START to …FUNC_END.
2017-01-03 06:39:23 +03:00
Justin M. Keyes
c6a50ca82c test: jobclose(): Avoid indeterminism. (#5851)
stdout activity may reach the queue before `exit`; just discard it.

Observed on Travis CI, ubuntu "trusty" beta image:

    [ RUN      ] ...is/build/neovim/neovim/test/functional/core/job_spec.lua @ 509: jobs running tty-test program jobclose() sends SIGHUP
    ...is/build/neovim/neovim/test/functional/core/job_spec.lua:511: Expected objects to be the same.
    Passed in:
    (table) {
      [1] = 'notification'
     *[2] = 'stdout'
      [3] = {
        [1] = 0
        [2] = {
          [1] = '
    '
          [2] = '' } } }
    Expected:
    (table) {
      [1] = 'notification'
     *[2] = 'exit'
      [3] = {
        [1] = 0
        [2] = 42 } }
    stack traceback:
    	...is/build/neovim/neovim/test/functional/core/job_spec.lua:511: in function <...is/build/neovim/neovim/test/functional/core/job_spec.lua:509>
    [  FAILED  ] ...is/build/neovim/neovim/test/functional/core/job_spec.lua @ 509: jobs running tty-test program jobclose() sends SIGHUP (2.81 ms)
2016-12-31 08:59:44 -05:00
Marco Hinz
d2998a0a49 Tests: make unit tests work on macOS Sierra
Fixes #5455.
2016-12-29 02:58:21 +01:00
James McCoy
29d7a59711
vim-patch:7.4.1768
Problem:    Arguments of setqflist() are not checked properly.
Solution:   Add better checks, add a test. (Nikolai Pavlov, Hirohito Higashi,
            closes vim/vim#661)

d106e5ba7f
2016-12-27 14:10:01 -05:00
James McCoy
9ef371fd54
test: quickfix: Move upstream vim quickfix test to src/nvim/testdir
Massaging the upstream patches for this test into the lua tests are too
cumbersome and slow down patching.
2016-12-27 14:09:53 -05:00
Justin M. Keyes
0b244de384 test: job_spec: Avoid unreliable screen test. 2016-12-23 18:28:54 +01:00
Justin M. Keyes
43ba7f4d98 eval.c: set_selfdict(): Fix invalid memory access. 2016-12-14 20:52:18 +01:00
James McCoy
8c9cccbcb6 Merge pull request #5760 from jamessan/shada-percent-count
shada: Respect the optional buffer count for shada-%
2016-12-13 22:35:25 -05:00
Marco Hinz
5855f30cb1 Make VimL code compatible with merged Partial support (#5765)
Closes #5763.
2016-12-13 14:48:42 +01:00
James McCoy
7eb91c781b shada: Respect the optional buffer count for shada-%
Closes #5759
2016-12-12 14:35:09 -05:00
Michael Ennen
5e4eb18eb0 Add some tests and cleanup. 2016-12-12 10:17:35 -05:00
Björn Linse
0f681c80e1 Make partials work with jobs, timers, and dictwatchers. 2016-12-12 10:17:35 -05:00
Michael Ennen
34a7814219 vim-patch:7.4.1605
Problem:    Catching exception that won't be thrown.
Solution:   Remove try/catch.

3905e291fe
2016-12-12 10:17:35 -05:00
Justin M. Keyes
d32888073f test: jobstart() 2016-12-11 01:14:22 +01:00
Aaron Williamson
c8d5e9230e jobstart(): Return -1 if cmd is not executable. #5671
Closes #5465
2016-12-10 16:01:27 +01:00
Justin M. Keyes
cb58999007 os/shell: do_os_system(): Always show last chunk.
This ameliorates use-cases like:
    :!cat foo.txt
    :make
where the user is interested in the last few lines of output.

Try these shell-based ex-commands before/after this commit:
    :grep -r '' *
    :make
    :!yes
    :!grep -r '' *
    :!git grep ''
    :!cat foo
    :!echo foo
    :!while true; do date; done
    :!for i in `seq 1 20000`; do echo XXXXXXXXXX $i; done

In all cases the last few lines of the command should always be shown,
regardless of where throttling was triggered.
2016-12-10 01:26:34 +01:00
Justin M. Keyes
97204e1cef os/shell: Throttle :! output, pulse "..." message.
Periodically skip :! spam. This is a "cheat" that works for all UIs and greatly
improves responsiveness when :! spams MB or GB of output:
    :!yes
    :!while true; do date; done
    :!git grep ''
    :grep -r '' *

After ~10KB of data is seen from a single :! invocation, output will be skipped
for ~1s and three dots "..." will pulse in the bottom-left. Thereafter the
behavior alternates at every:
    * 10KB received
    * ~1s throttled

This also avoids out-of-memory which could happen with large :! outputs.

Note: This commit does not change the behavior of execute(':!foo').
      execute(':!foo') returns the string ':!foo^M', it captures *only* Vim
      messages, *not* shell command output. Vim behaves the same way.
      Use system('foo') for capturing shell command output.

Closes #1234

Helped-by: oni-link <knil.ino@gmail.com>
2016-12-09 18:51:17 +01:00
Justin M. Keyes
043f85210a tui: "backpressure": Drop messages to avoid flooding.
Closes #1234

multiqueue:
- Implement multiqueue_size()
- Rename MultiQueueItem.parent to MultiQueueItem.parent_item, to avoid confusion
  with MultiQueue.parent.
2016-12-09 18:51:17 +01:00
Justin M. Keyes
933c873cae test: Handle SIGHUP in tty-test fixture.
Closes #5727
2016-12-07 17:22:37 +01:00
Justin M. Keyes
a1b0f594ea test: Disable unreliable tests on travis+ASAN_UBSAN 2016-12-07 17:22:23 +01:00
Justin M. Keyes
1a4f13ba8f test: helpers.retry() 2016-12-07 17:03:52 +01:00
Marco Hinz
df2ffe48ce
Tests: add tests for v:exiting 2016-12-01 14:57:27 +01:00
Björn Linse
1f8a3da796 Merge pull request #5669 from chemzqm/add-cmdline-mode-rpc
Add cmdline mode to ui_mode_change
2016-12-01 08:05:44 +01:00
James McCoy
0e1c406df4 Merge pull request #5662 from brcolow/vim-7.4.1701
vim-patch:7.4.1701
2016-12-01 00:14:16 -05:00
chemzqm
3cf4b14e96 add cmdline mode to modechange of RPC and tests
use set_cursor_shape_bar for cmdline mode

fix test of screen_basic_spec.lua & screen.lua

comment fix
2016-11-30 22:20:06 +08:00
Michael Ennen
783c9aac8e vim-patch:7.4.1699 (#5660)
Problem:    :packadd does not work the same when used early or late.
Solution:   Always load plugins matching "plugin/**/*.vim".

71fb0c146b
2016-11-29 23:19:25 +01:00
Björn Linse
4b95bb582d ui: add tests for ui_mode_change
Also fix snapshot_util() to work even if default_attr_ids is not a
proper lua array.
2016-11-25 11:37:23 +01:00
Michael Ennen
783220e427 vim-patch:7.4.1701
Problem:    Equivalence classes still tested in old style tests.
Solution:   Remove the duplicate.

f9f22dbe4f
2016-11-24 23:30:30 -07:00
Shougo Matsushita
d152e2f3fd vim-patch:7.4.1660
Problem:    has('patch-7.4.1') doesn't work.
Solution:   Fix off-by-one error. (Thinca)

819821c5a9
2016-11-22 07:27:13 +09:00
Björn Linse
1d4563771b jobs: ensure calling jobclose() on a pty job sends SIGHUP. Closes #5619 2016-11-17 15:13:45 +01:00
Justin M. Keyes
44e6ee930f build: Target luacheck HEAD.
https://github.com/mpeterv/luacheck/pull/81#issuecomment-261099606

> If you really want to use bleeding-edge version you should get the
> rockspec from master branch, not a fixed commit ...
> The correct way to install from a specific commit is cloning that
> commit and running "luarocks make" from project directory. The reason
> is that running "install" or "build" on an scm rockspec fetches
> sources from master but uses build description from the rockspec
> itself, which may be outdated.
2016-11-17 00:55:39 +01:00
James McCoy
2e5736e2cd
vim-patch:7.4.1664
Problem:    Crash in :cgetexpr.
Solution:   Check for NULL pointer. (Dominique) Add a test.

89c64d557d
2016-11-15 23:16:09 -05:00
James McCoy
830bf8665b
vim-patch:7.4.1650
Problem:    Quickfix test fails.
Solution:   Accept any number of matches.

f68f1d7079
2016-11-15 23:16:09 -05:00
James McCoy
caa33aaaf8
vim-patch:7.4.1647
Problem:    Using freed memory after setqflist() and ":caddbuffer".  (Dominique)
Solution:   Set qf_ptr when adding the first item to the quickfix list.

8b20179c65
2016-11-15 23:16:08 -05:00
James McCoy
c0fd830be4
Bump all nvim-specific error codes above E5000
In order to not conflict with new error codes that Vim adds, all Neovim
error codes should be above 5000.  The three existing sub-5000 error
codes (E926, E951, and E952) are now E50003, E5004, and E5005
respectively.

E953 was removed in 6167ce6df2, so just
remove it from the help.
2016-11-15 23:16:08 -05:00
James McCoy
7231438f12
vim-patch:7.4.1640
Problem:    Crash when an autocommand changes a quickfix list. (Dominique)
Solution:   Check wether an entry is still valid. (Yegappan Lakshmanan,
            Hirohito Higashi)

ffec3c5349
2016-11-15 23:16:08 -05:00
Shougo
c69cfd7d1c vim-patch:8.0.0035 (#5609)
Problem:    Order of matches for 'omnifunc' is messed up. (Danny Su)
Solution:   Do not set compl_curr_match when called from complete_check().
            (closes vim/vim#1168)

472e85970e
2016-11-15 17:59:55 +01:00
Justin M. Keyes
01ef6fc3d2 Merge #5607 from justinmk/icm
'inccommand': auto-disable if too slow; fix other behaviors
2016-11-15 09:12:47 +01:00
Justin M. Keyes
35231312d7 'inccommand': Add tests. 2016-11-15 05:01:25 +01:00
Justin M. Keyes
708617ebb6 inccommand=nosplit: Jump to first match.
Call update_topline() to adjust the current viewport.

Closes #5597
2016-11-15 04:22:24 +01:00
James McCoy
9d2985ecba vim-patch:7.4.1658
Problem:    A plugin does not know when VimEnter autocommands were already
            triggered.
Solution:   Add the v:vim_did_enter variable.

1473551a44
2016-11-14 14:16:40 -05:00
James McCoy
5e1dc26f74
test: window_spec: Remove flaky terminal resize test 2016-11-13 18:47:03 -05:00
Justin M. Keyes
598f5af58b Merge #5582 from justinmk/icm
'inccommand': Support :smagic/:snomagic. Less jumping around.
2016-11-12 13:32:48 +01:00
Tommy Allen
84eed76b55 CheckHealth: Include v:throwpoint in error message (#5575)
* health.vim: Include v:throwpoint in error message

* health/provider.vim: Check for ruby executable

* health/provider.vim: Combine subprocess stdout and stderr

* test: Updated CheckHealth test
2016-11-12 11:59:15 +01:00
James McCoy
7e48c23a50 vim-patch:7.4.1634 (#5594)
Problem:    Vertical movement after CTRL-A ends up in the wrong column.
            (Urtica Dioica)
Solution:   Set curswant when appropriate. (Hirohito Higashi)

8e08125d3a
2016-11-12 11:32:23 +01:00
James McCoy
c5bc0ea04c vim-patch:7.4.1614 (#5593)
Problem:    Still quickfix test in old style.
Solution:   Turn test 10 into a new style test.

7eba3d2cbf
2016-11-12 11:30:18 +01:00
James McCoy
7baa96b717 vim-patch:7.4.1591
Problem:    The quickfix title is truncated.
Solution:   Save the command before it is truncated. (Anton Lindqvist)

5584df65a0
2016-11-11 11:37:42 -05:00
Justin M. Keyes
ae9a3d3b99 'inccommand': Simplify cursor placement logic.
Remove the inner for-loop; just use the column of the first in-line
match.
2016-11-11 05:45:06 +01:00
Justin M. Keyes
795f2bb9b9 'inccommand': Restore cursor/view if cancelled.
Restore cursor position and window "view", if command is cancelled.
This is how 'incsearch' works.
2016-11-10 18:09:48 +01:00
Justin M. Keyes
2e1217da46 'inccommand': buftype=nofile, restore cursor/view
- Use a standard scratch buffer instead of a new 'buftype', functions
  like curbufIsChanged() already have special handling for scratch bufs.
- Cleanup some stuff from the previous merge.
- Add support for :smagic, :snomagic. Closes #5578
2016-11-10 15:48:00 +01:00
Justin M. Keyes
0213e99aaf Merge #5561 'inccommand'
Initial work by:
  Robin Elrharbi-Fleury (Robinhola)
  Audrey Rayé (Adrey06)
  Philémon Hullot (DesbyP)
  Aymeric Collange (aym7)
  Clément Guyomard (Clement0)

Major revisions by:
  KillTheMule
  Björn Linse <bjorn.linse@gmail.com>
  Justin M. Keyes <justinkz@gmail.com>
2016-11-09 03:19:22 +01:00
Justin M. Keyes
aa0e09d251 'inccommand': Preserve curbuf->b_u_newhead.
Add tests for undotree().

Helped-by: Björn Linse <bjorn.linse@gmail.com>

When "curhead" points to a valid head, the value of "newhead" is
meaningless (and really should be set to null). The undo state for
a buffer is _logically_ the enum:

  enum UndoState {
    CurrentHead(head),
    NewHead(head),
    EmptyTree
  }

nvim _represents_ this as: whenever `curbuf->b_u_curhead` is nonnull it
should be used as the current head, and `curbuf->b_u_newhead` is
ignored. If the there is a current head, then this will be redoed on the
next redo, and its parent will be undone on next undo. Only if
`b_u_curhead` is NULL, `b_u_newhead` will be used as the head to undo
(and it is not possible to redo). Also both can be NULL, to indicate an
empty undotree. (To be fair, this only strictly true when calling undo.c
from the outside, in some places _within_ a function in undo.c both
values might be meaningful)

Apparently `undotree()` breaks this non-abstraction, this _cosmetic_
issue can easily be fixed by `ex_substitute` also saving and restoring
`b_u_newhead`, but is doesn't reflect any error really how
`u_undo_and_forget` manipulates the _actual_ state of the undo tree.
2016-11-09 01:03:47 +01:00
Justin M. Keyes
f3e8ca3bf5 'inccommand': preserve 'modified'
During the live preview, the buffer-local 'modified' flag
should not be changed.
2016-11-08 21:22:24 +01:00
Justin M. Keyes
ff6ec703d5 'inccommand': Do not trigger during scripts, feedkeys(). 2016-11-08 21:22:24 +01:00
KillTheMule
527ba2b12a 'inccommand': test: scripts/feedkeys() should not trigger preview 2016-11-08 21:22:24 +01:00
Justin M. Keyes
6a3f8d48d0 'inccommand': rename 'incsubstitute'
'inccommand' allows us to expand the feature to other commands, such as:
    :cdo
    :cfdo
    :global

Also rename "IncSubstitute" highlight group to "Substitute".
2016-11-08 21:22:13 +01:00
Justin M. Keyes
1e0e301062 'inccommand': format line numbers as "|123| "
This matches what Quickfix traditionally does.
2016-11-08 21:21:46 +01:00
Justin M. Keyes
3ccf69c1de 'inccommand': set buffer name to [Preview]
[inc_sub] is less obvious for users. Also, in the future we may want to
generalize the idea of a "preview buffer", or "incremental commands"
besides :substitute.
2016-11-08 21:21:46 +01:00
Justin M. Keyes
d0689eb0b2 'inccommand': disable 'cursorline', 'spell' in preview 2016-11-08 21:21:43 +01:00
Justin M. Keyes
e31f9007e4 'inccommand': preserve b:changedtick 2016-11-08 21:21:00 +01:00
Justin M. Keyes
c04ffe866d 'inccommand': rework
- Eliminate/isolate static/global variables
- Remove special-case parameter from buflist_new()
- Remove special-case ECMD_RESERVED_BUFNR
- To determine when u_undo_and_forget() should be done, check
  b_changedtick instead of a heuristic.
- use mb_string2cells() instead of strlen() to measure the :sub patterns
- call ml_close() before buf_clear_file(). Avoids leaks caught by ASan.

Original patch by:
  Robin Elrharbi-Fleury (Robinhola)
  Audrey Rayé (Adrey06)
  Philémon Hullot (DesbyP)
  Aymeric Collange (aym7)
  Clément Guyomard (Clement0)
2016-11-08 21:20:08 +01:00