Commit Graph

88 Commits

Author SHA1 Message Date
erw7
a4fe8bdc97
shada: fix failed assertion on exit (#12692)
If set the number of history saves is 0, assertions fail when inserting an entry on exit.
Dont insert an entry when the number of saves is 0 fixes the issue.

fixes #11497
2020-07-31 16:08:34 +02:00
erw7
f1cbd39f7b vim-patch:8.2.0920: writing viminfo fails with a circular reference
Problem:    Writing viminfo fails with a circular reference.
Solution:   Use copyID to detect the cycle. (closes vim/vim#6217)
5b157fe2ed
2020-06-09 23:54:07 +09:00
erw7
9fc3949841 shada: fix write E5004 error on exit
Fix the problem of failing to write shada when the global variable contains
Funcref or Partial.
2020-06-08 23:15:10 +09:00
Abdelhakeem Osama
6692c0958f shada: initialize jumplist before search pattern (#10964)
Since 8b8ecf4, the shada module loads files in the jumplist to properly
clear duplicates. This can trigger some autocommands, which in turn
saves and restores search and substitute patterns, freeing the previous
strings in "spats" which are held in "wms" as well (heap-use-after-free).
To avoid this, initialize the jumplist in "wms" before search patterns.
2019-09-07 18:02:29 -07:00
Justin M. Keyes
4bb728dfa0
test: Minimize shada/helpers.lua #10728 2019-08-09 10:23:57 +02:00
Abdelhakeem Osama
35362495c9 jumplist: avoid extra tail entry #9805
fixes #9775
2019-04-02 00:50:28 +02:00
Björn Linse
4da5cb38d3 startup: always wait for UI with --embed, unless --headless also is supplied 2018-09-22 10:18:28 +02:00
ZyX
5d9bb16d66 functests: Use proper path in eq() 2018-04-02 11:14:11 +03:00
ZyX
dd1b493f75 shada: Fix some memory leaks and completely ignore numbered mark names
Problems:
- In two places in shada_read_when_writing() memory just was not freed. Both 
  places were verified to cause test failures.
- Numbered marks got assigned incorrect (off-by-one compared to position in the 
  array) numbers in replace_numbered_mark.
- It was possible to have non-continuously populated array of numbered marks 
  which messed up code for merging them.

(Note about tests: marks with additional data are always compared different when 
merging, that caused some confusion regarding why test did not work the way 
I expected.)
2018-04-01 21:29:47 +03:00
ZyX
1ac1f520f0 functests: Add test for merging with file with only numeric mark
Known to cause memory leak, but not an expected crash.
2018-04-01 20:04:35 +03:00
ZyX
17ea0f2214 functests: Fix existing functional tests 2018-03-27 01:33:59 +03:00
Justin M. Keyes
b616ef9b22 tests: stderr output contains cp noise
closes #7811
2018-01-05 18:18:26 +01:00
ZyX
6b45dbca04 mark: Make sure that jumplist item will not have zero lnum
Fixes #7169
2017-12-24 00:32:43 +03:00
Ignas Anikevicius
e9dba214ea test/shada: fixup for Windows backslashes #7287 2017-10-02 00:48:43 +02:00
ZyX
91b9ad7d82 shada: Make sure that code does not attempt to read too long items
Fixes #6957
2017-07-04 15:41:59 +03:00
AdnoC
5908f562df test: Fix and add cases for unnamed register
Also:

Add ru to shada tests with all keys

Add test for unset unnamed and register 0
2017-05-31 13:31:05 -04:00
AdnoC
beca4dc16c eval/shada: Add testing for unnamed register with setreg and startup 2017-05-31 13:19:08 -04:00
James McCoy
2dc27a8a78 shada: Remember whether "0 or "1 was the unnamed register
Ref #4645
2017-05-24 14:17:19 -04:00
ZyX
cdb1aa3e47 eval: Fix len argument to xstrlcat 2017-03-29 10:08:45 +03: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
ZyX
81ef9f55ae shada: Save current cursor position before saving jumps 2017-01-04 16:34:06 +03:00
James McCoy
7eb91c781b shada: Respect the optional buffer count for shada-%
Closes #5759
2016-12-12 14:35:09 -05: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
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
Björn Linse
b3ece5c81c encoding: update tests
Change shada reencoding tests to check for
correct handling of UTF-8 and binary strings.

Delete enc=latin1 json tests.
2016-11-05 14:49:24 +01:00
James McCoy
93f3896300
test: Fix shada/marks_spec.lua failure
The 'dump and read back mark " from a closed tab' test needs to actually
create a second tab.  Since it wasn't doing so, the 'q!' command caused
nvim to exit and the subsequent 'qall' command fails.
2016-10-28 22:32:14 -04:00
Grzegorz Milka
9ca90fdb9f vim-patch:7.4.2212
Problem:    Mark " is not set when closing a window in another tab. (Guraga)
Solution:   Check all tabs for the window to be valid. (based on patch by
            Hirohito Higashi, closes vim/vim#974)

e59215c7dc
2016-10-22 23:43:14 +02:00
ZyX
6127eaef05 shada: Fix non-writeable ShaDa directory handling
Before this change,

    nvim -i /etc/shada

segfaults on exit if the file does not exist and user does not have
permissions to create the file at /etc/shada.

Closes #5296
Reported in #5277
https://github.com/neovim/neovim/issues/5277#issuecomment-243937255
2016-09-04 21:45:48 -04:00
Björn Linse
1c22cab2fd api: consistently use nvim_ prefix and update documentation 2016-08-31 21:57:06 +02:00
Rui Abreu Ferreira
9ce81f7b2b functionaltest: Create lua helper for os.tmpname()
In Windows Lua's os.tmpname() returns relative paths starting with \s,
prepend them with $TEMP to generate a valid path.

In OS X os.tmpname() returns paths in '/tmp' but they should be in
'/private/tmp'. We cannot use os_name() for platform detection because
some tests use tempname() before nvim is spawned, instead use one of the
following:

1. Set SYSTEM_NAME environment variable before calling the tests, it
   is set from CMAKE_SYSTEM_NAME(i.e. uname -s or 'Windows')
2. Call uname -s
3. Assume windows
2016-08-31 11:32:28 +01:00
Rui Abreu Ferreira
39c628d031 Mark some functional tests as pending in Windows 2016-08-26 08:21:41 +01:00
ZyX
ff470bb853 functests: Check logs in lua code
It is otherwise impossible to determine which test failed sanitizer/valgrind
check. test/functional/helpers.lua module return was changed so that tests which
do not provide after_each function to get new check will automatically fail.
2016-06-10 21:50:49 +03:00
Björn Linse
ce17d03180 eval: let getreg() return valid list for an undefined register
vim-patch:7.4.1755
this prevents a crash when the list is used in setreg() later
2016-04-21 18:11:06 +02:00
ZyX
d4106f6df3 shada: Make sure that NIL and EXT values can also be parsed back
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.
2016-04-18 02:46:34 +03:00
Thiago de Arruda
c18d5917e3 Update lua client to 0.0.1-24
The new version of the lua client uses libmpack as a backend, and some test
scripts had to be updated to reflect that.
2016-04-13 09:21:32 -03:00
Thiago de Arruda
704f3dd855 Synchronize shada reset helper with other functional tests 2016-04-11 23:07:52 -03:00
Jun T
edbc97225d test: shada_spec: resolve symlink
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.
2016-02-12 00:03:39 +09:00
ZyX
efaf76e623 functests: Update tests 2016-01-07 00:54:57 +03:00
ZyX
ea67bf808b shada: Continue dumping when variables failed to dump
Closes #3721
2015-12-18 19:29:49 +03:00
Justin M. Keyes
b9139e009f Merge pull request #3724 from ZyX-I/fix-3635
shada: Do not save unlisted and quickfix buffers
2015-11-27 18:06:52 -05:00
Felipe Morales
80cf03602e Merge pull request #3581 from ZyX-I/fix-shada
Store last search direction when writing ShaDa files
2015-11-23 23:03:29 +01:00
ZyX
b98cea909f shada: Also store last search direction
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
2015-11-23 17:08:01 +03:00
Marco Hinz
4a69e55f39 test/functional: clean up according to luacheck (part 1) 2015-11-23 13:57:21 +01:00
ZyX
ec8e60a055 shada: Do not save unlisted and quickfix buffers
Fixes #3635
2015-11-23 15:12:08 +03:00
John Szakmeister
a6c45d15fd Sort oldfiles in the marks_spec tests to avoid random ordering errors.
According to @ZyX-I in #3594, ordering is not important so let's use
@tarruda's fix by sorting the results.
2015-11-06 06:02:41 -05:00
ZyX
ea2fe52552 functests: Add test to check expected behaviour (failing) 2015-10-23 14:47:59 +03:00
ZyX
3a4a941885 shada: Fix memory leak and double free when setting both &vi and &sd 2015-10-08 22:01:12 +03:00
ZyX
1162962d8b functests: Refactor tests:
- 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.
2015-10-08 22:01:12 +03:00
ZyX
2dd8e05f9f shada: Fix jump/change list merging code
Errors happens under following conditions:

1. Jump/change list is full.
2. New jump/change list item should go between some of the old ones.
2015-10-08 22:01:11 +03:00
ZyX
b8e7915596 shada: Make sure that shada-r option correctly ignores case 2015-10-08 22:01:10 +03:00