Note: currently they are both *dumped*, but parsing them produces an error. This
is inappropriate: variables should either be skipped with error message when
dumping or should be read back properly.
It also appears that I did not have test for “has wrong variable value type”
error, so nothing got removed from errors_spec.
Special dictionaries representing map are created when encountering duplicate
key or when key is empty or contains NUL.
Also checks that values are separated by a comma/colon properly.
Having a tags file in the calling directory of make test would make this test
fail, so disable tag file completion for it. Disable all other options except the
current buffer, to, applying the principle of least surprise.
-1 is index past the end, and -2 is the index of the last element.
This eliminates the need for include_start/include_end.
Allow the handling of out-of-bounds to be configurable.
-NaN doesn't exist in the IEEE 754 spec, it is a hardware-specific detail
abstracted away by luajit(and not by lua or nvim), so there's no need to test
it. Normalize all tests that involve -nan so the suite will be compatible with
both Lua and Luajit.
The hexadecimal notation is a Luajit extension which is not compatible with Lua
5.1. While Lua 5.2 does support hexadecimal sequences, it is better to target
Lua 5.1 for maximum compatibility with Luajit(which has fully compatible with
5.1 API/ABI).
Problem: When using slices there is a mixup of variable name and namespace.
Solution: Recognize variables that can't be a namespace. (Hirohito Higashi)
9bbf63dbf8
All syntastic users experienced this problem:
E685: Internal error: get_tv_string_buf()
It's reproducable with:
:call setloclist(0, [''])
So, not given optional arguments to setloclist() lead to some fields not
inizilied and the code took the wrong branches.
Adds support for:
- api:vim_input("<D-a>")
- ":nnoremap <C-D-S-...>" and permutations thereof
UIs must capture the modifier and send it as "<D-...>" to vim_input().
Note: Before this commit, any arbitrary ":nnoremap <{foo}-{bar}>"
mapping could already be invoked with feedkeys("\<{foo}-{bar}>"). This
commit supports "D-" as a modifier that can be combined with "C-", "A-",
"S-" in any order.
For non-GUI (terminal) support, user must:
:set <D-a>={CSI sequence}
then send the {CSI sequence} from their terminal. But this does not work
yet (regression #2204).
Closes#2190
Problem: Completing the longest match doesn't work properly with multi-byte
characters.
Solution: When using multi-byte characters use another way to find the
longest match. (Hirohito Higashi)
4f8fa1633c
Problem: C indenting is wrong below a "case (foo):" because it is
recognized as a C++ base class construct. Issue #38.
Solution: Check for the case keyword.
d1b15dec4d
Problem: Indentation of array initializer is wrong.
Solution: Avoid that calling find_start_rawstring() changes the position
returned by find_start_comment(), add a test. (Hirohito Higashi)
089af18d1f
The test was split into several blocks reusing the same input file. As it is
complicated to send text in different encodings and with control characters
from the test suite to nvim and back the results are written to a temp file
and loaded into the test from there.
Some parts of the test depend on gzip(1). They are skipped if gzip is not
available.
Some `:write` and `:edit` commands produce messages and "hit enter" prompts
that had to be treated with an extra `feed('<C-L>')`. In the original test
file this was not neccessary because it was `:source!`ed.
If the build directory path has symlinks in it, 'make functionaltest'
fails at shada_spec.lua:177 because readme_fname has symlink but
nvim resolves the symlink when writing it into the shada file.
Problem: "gv" after paste selects one character less if 'selection' is
"exclusive".
Solution: Increment the end position. (Christian Brabandt)
d29c6fea94
Problem: ml_get error when using "p" in a Visual selection in the last
line.
Solution: Change the behavior at the last line. (Yukihiro Nakadaira)
d009e86826
Problem: gettabvar() doesn't work after Vim start. (Szymon Wrozynski)
Solution: Handle first window in tab still being NULL. (Christian Brabandt)
7e47d1ac6a
Problem: When removing from 'path' and then adding, a comma may go missing.
(Malcolm Rowe)
Solution: Fix the check for P_ONECOMMA. (closes#471)
174674743d
The test involves argument and buffer numbers. Therefore it was necessary to
use a custom testing session to ensure that the initial buffer corresponds to
an argument.
Plugins (YCM, dispatch.vim) use gui_running to decide behavior; so do
some colorschemes. Up to now, nvim lied about gui_running for the
benefit of colorschemes and the detriment of all _other_ plugins that
check this condition. That's counterproductive: a user employs at most
_one_ colorscheme but may use many other plugins which expect the Vim
legacy semantics of gui_running.
Moreover, colorschemes usually don't _need_ to check gui_running: they
can instead set cterm{fg,bg} and gui{fg,bg} in the same :highlight call.
It is reasonable for users who want "true color" to modify their
colorscheme once (or request upstream to do so) in order to avoid
running into quirks in any other plugins.
Closes#2782
Problem: When using += with ":set" a trailing comma is not recognized.
(Issue 365)
Solution: Don't add a second comma. Add a test. (partly by Christian
Brabandt)
a7b7b1cef9
Problem: The entries added by matchaddpos() are returned by getmatches()
but can't be set with setmatches(). (Lcd)
Solution: Fix setmatches(). (Christian Brabandt)
0fce425772
Problem: Illegal memory access when using :copen and :cclose.
Solution: Avoid that curbuf is invalid. (suggestion by Justin M. Keyes)
Add a test.
62ef797496
Problem: ":tabmove" does not work as documented.
Solution: Make it work consistently. Update documentation and add tests.
(Hirohito Higashi)
40ce3a4e1f
Problem: test_listlbr_utf8 sometimes fails.
Solution: Don't use a literal multibyte character but <C-V>uXXXX. Do not
dump the screen highlighting. (Christian Brabandt, closes#518)
1c57fe8b94
Problem: When using 'colorcolumn' and there is a sign with a fullwidth
character the highlighting is wrong. (Andrew Stewart)
Solution: Only increment vcol when in the right state. (Christian Brabandt)
32a214e78d
Problem: Appending in Visual mode with 'linebreak' set does not work
properly. Also when 'selection' is "exclusive". (Ingo Karkat)
Solution: Recalculate virtual columns. (Christian Brabandt)
74db34cc91
As the work of this migration did take quite some time, some changes where
made in master after this branch was started. These are ported to the new
test file.
The old test_eval.in file did a `:wq` on line 168. The following 60 lines
where not used and there was no expected output for them in test_eval.ok.
This test code is now used in several test cases in the new test file.
This is consistent with VIM behavior. When showing a visual selection,
VIM only extends it past the last character if eol is in listchars (even
if nolist is set).
vim-patch:7.4.569
vim-patch:7.4.573
Helped-by: @glts https://github.com/neovim/neovim/pull/2621
Problem: Having CTRL-C interrupt or not does not check the mode of the
mapping. (Ingo Karkat)
Solution: Use a bitmask with the map mode. (Christian Brabandt)
651863c94a
Problem: Mapping CTRL-C in Visual mode doesn't work. (Ingo Karkat)
Solution: Call get_real_state() instead of using State directly.
5000869712
Background: Vim internally prefers to represent ALT/META chords as
single-byte keys, by setting the high bit of the key byte.
extract_modifiers() _discards_ the meta/alt modifier, but we need it for
libvterm and libtermkey.
Closes#2440Closes#3727Closes#2017
References #2277
References #2254https://github.com/neovim/neovim/issues/2017#issuecomment-140423557
> We [not libtermkey] are setting the high bit for some reason
https://github.com/neovim/neovim/issues/176#issuecomment-77834715
> libvtermkey requires the leading esc to parse alt/meta
https://github.com/neovim/neovim/pull/3246#issuecomment-136328450
> A program could do better than the current logic on some terminals, by
> asking for pure 8bit mode (S8C1T) and then immediately querying the
> mode again. If the result comes back as an 8bit single-byte CSI, then
> it can presume the mode setting was successful, and now the ESC prefix
> byte won't be seen in multibyte sequences; only as an Alt- prefix or
> a real Escape key. On such a terminal, it could therefore avoid
> needing to use that waiting timeout.
When converting a msgpack object to a String object, strings (and byte
arrays) with length 0 are handled as errors. This is fixed by
always using the msgpack data pointer as a valid pointer. For a NULL
pointer there is nothing to copy.
Test by @snoe
Fixes#3844
The tests would leave the following test files in the root directory:
Xtest-functional-plugin-shada.shada
Xtest-functional-plugin-shada.shada.tmp.f
Clean them up in teardown().
Replaced old unit tests for errno with libuv error codes UV_ENOENT
and UV_EEXIST (for os_open and os_getperms).
Added libuv include path to test/includes compiler calls - needed
to get hold of libuv headers.
Note: it looks like viminfo files do not store search direction intentionally.
After reading viminfo file search direction was considered to be “forward”.
Note 2: all files created on earlier Neovim version will automatically receive
“forward” direction.
Fixes#3580
This change adds switch cases for K_FOCUSGAINED and K_FOCUSLOST to the
input handling functions in ex_getln.c and terminal.c. The handling is
identical to what's found in edit.c (just calling apply_autocmds).
If one enters cmdline-mode by feeding `:` and sends a focuslost event (by
leaving the window for example) the text `<FocusLost>` will be inserted
into the command line. There is similar behaviour in terminal mode. This
patch corrects this behavior to fire the apropriate autocmd instead.
Fixes#3714
- change approach for test 1: screen:expect() instead of assert()
- use execute() instead of command()
- 2 new tests that check none and wrong input for :oldfiles!
Helped-by: @fwalch
Helped-by: @tarruda
Helper-by: @justinmk
Refactor input.c, normal.c and edit.c to use the K_EVENT special key to trigger
the CURSORHOLD event. In normal and edit mode, K_EVENT is treated as
K_CURSORHOLD, which enables better handling of arbitrary actions in those
states(eg: In normal mode the previous operator counts will be restored).
Also fix a test in vim_spec.lua. The test had a wrong assumption: cmdheight is
only used to determine when the press enter screen will be shown, not to limit
how many lines or control pagination.
Problem: Moving the cursor in Insert mode starts new undo sequence.
Solution: Add CTRL-G U to keep the undo sequence for the following
cursor movement command. (Christian Brabandt)
8b5f65a527Closes#3492
- Remove unused variables.
- Do not use helpers.nvim_feed in most cases.
- Do not use helpers.nvim and helpers.nvim_eval at all.
- Add helpers.funcs and helpers.\*meths special tables. Indexing such table
creates functions which call helpers.call or helpers.nvim (and similar) with
first argument equal to table index.
This problem made test64 to crash. Description of the bug: when removing entry
from history when removed entry is not the last one it puts one element to
free_entries list, but ignores free entries starting from last_free_element.
Possible solutions:
1. First working: simply populate free_entries list with entries which are still
free, starting from last_free_element.
2. Better (wastes less CPU): after free_entries list size goes to zero (which is
the initial value) continue using last_free_element.
3. Even better (less memory): note that element from the list is *only* removed
before adding another one. So replace free_entries array with one item.
Also renamed last_free_element to last_free_entry: in any case most of the lines
which mention it were altered.
It appears that large portion of non-ShaDa ASCII text files may be parsed as
a ShaDa file because it is mostly recognized as a sequence of unknown entries:
all ASCII non-control characters are recognized as FIXUINT shada objects, so
text like
#!/bin/sh
powerline "$@" 2>&1 | tee -a powerline
(with trailing newline) will be recognized as a correct ShaDa file containing
single unknown entry with type 0x23 (dec 35, '#'), timestamp 0x21 (dec 33, '!')
and length 0x2F (dec 47, '/') without this commit. With it parsing this entry
will fail.
For compatibility the following things are done:
1. Items with type greater then greatest type are ignored when reading and
copied when writing.
2. Registers with unknown name are ignored when reading and blindly copied when
writing.
3. Registers with unknown type are ignored when reading and merged as usual when
writing.
4. Local and global marks with unknown names are ignored when reading. When
writing global marks are blindly copied and local marks are also blindly
copied, but only if file they are attached to fits in the `'N` limit defined
in &shada. Unknown local mark’s timestamp is also taken into account when
calculating which files exactly should fit into this limit.
5. History items with unknown type are ignored when reading and blindly copied
when writing.
6. Unknown keys found in register, local marks, global marks, changes, jumps and
search pattern entries are read to additional_data Dictionary and dumped (of
course, unless any of these elements were not overwritten later). It
obviously works only for values conversible to Object type.
7. Additional elements found in replacement string and history entries are read
to additional_elements Array and dumped (same: only if they were not
overwritten later). Again this works only for elements conversible to Object
type.
8. Additional elements found in variable entries are simply ignored when
reading. When writing *new* variables they will be preserved during merging,
but that’s all. Variable values dumped from current NeoVim session never have
additional elements.
Modifications:
- If file was not written due to write error then writing stops and temporary
file will not be renamed.
- If NeoVim detects that target file is not a ShaDa file then temporary file
will not be renamed.
Some notes:
- Replaced msgpack_unpacker usage with regular xmalloc’ed buffer. Also since
msgpack_unpack_next (as well as msgpack_unpacker_next) is not ever going to
return MSGPACK_UNPACK_EXTRA_BYTES this condition was checked manually.
Function that does return this status is msgpack_unpack, but it is marked as
obsolete.
- Zero type is checked prior to main switch in shada_read_next_item because
otherwise check would be skipped.
- Zeroing entry at the start of shada_read_next_item makes it safer.
- dedent('') does not work.
- v:oldfiles list is only replaced with bang, if it is NULL or empty.