Commit Graph

99 Commits

Author SHA1 Message Date
ZyX
5c112c0cb9 shada: Free wms->hms in shada_write_exit
Otherwise there should be memory leak.
2015-12-18 19:29:49 +03:00
ZyX
ea67bf808b shada: Continue dumping when variables failed to dump
Closes #3721
2015-12-18 19:29:49 +03:00
ZyX
a35c45732c shada: Fix all linter errors in src/nvim/shada.*
This commit is an example of fixing incorrect code which previously passed
through linter.
2015-12-13 00:47:46 +03:00
Rui Abreu Ferreira
07eaff7c26 Add missing guard for HAVE_UNISTD_H 2015-12-02 19:54:33 -05: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
Rui Abreu Ferreira
5bc6e0dc74 Update shada.c to use libuv error constants instead of errno constants
From #3473, shada.c used errno constants (e.g. ENOENT) to check the return
of os_open(), but in Windows the return from libuv functions is not -errno.
Instead use libuv error constants (e.g UV_ENOENT) for error checks.
2015-11-25 23:16:37 +00: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
ZyX
ec8e60a055 shada: Do not save unlisted and quickfix buffers
Fixes #3635
2015-11-23 15:12:08 +03:00
Justin M. Keyes
1ca5646bb5 Merge pull request #3470 from ZyX-I/pr-3198
XDG base directory specification support
2015-10-25 22:38:23 -04:00
ZyX
8642bad122 shada: Remove SHADA_FILE2 2015-10-23 14:54:11 +03:00
ZyX
a82a059921 option: Add // to the end of default &directory 2015-10-23 14:54:11 +03:00
ZyX
2e750973e9 shada: Move shada file to a new location 2015-10-23 14:54:10 +03:00
ZyX
7a1090eef5 shada: Run set_last_cursor before writing shada file 2015-10-23 14:47:59 +03:00
ZyX
909d79e600 shada: Do not use msgpack_rpc functions for converting data to msgpack
Should protect against #3431
2015-10-08 22:01:13 +03:00
ZyX
9d72f8ebaa shada: Fix shada_removable signature 2015-10-08 22:01:11 +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
0a44d504c8 shada(documentation): Fix outdated comments 2015-10-08 22:01:10 +03:00
ZyX
b8e7915596 shada: Make sure that shada-r option correctly ignores case 2015-10-08 22:01:10 +03:00
ZyX
0966e92cf4 shada: When using shada-r normalize option path 2015-10-08 22:01:10 +03:00
ZyX
d283e758ea shada: Fix out-of-bounds array access
It leads to a memory leak as well. May overwrite wms->jumps_size.
2015-10-08 22:01:07 +03:00
ZyX
690d280fa8 shada: Save an allocation when writing local marks 2015-10-08 22:01:06 +03:00
ZyX
29a3e972de shada: Fix v:hlsearch save/restore and do not write empty patterns 2015-10-08 22:01:05 +03:00
ZyX
915a298223 shada,functests: Fix v:hlsearch saving/restoring handling 2015-10-08 22:01:04 +03:00
ZyX
e1dc9ed464 shada: First write temporary file and only then check any permissions
It is not logical that on UNIX permissions can prevent even writing temporary
file, while on other OS it will first write temporary file and then fail during
rename.
2015-10-08 22:01:03 +03:00
ZyX
ceb135a498 shada: Keep uid and gid of the file when working from root
It was the behaviour exhibited by Vim, but it got unintentionally removed. There
is a difference though: Vim runs fchown *before* populating the file, I run it
just before renaming.
2015-10-08 22:01:00 +03:00
ZyX
313b947e3f shada: Refactor code that works with hms.last_hist_entry 2015-10-08 22:00:49 +03:00
ZyX
48ba2f0109 documentation/functests: Replace NeoVim with Neovim 2015-10-08 22:00:49 +03:00
ZyX
0fe11fe70a shada: Add generator key to the header
For use in viminfo→shada converters, plugins that allow editing ShaDa files or
any other software which generates ShaDa files for whatever purpose.
2015-10-08 22:00:49 +03:00
ZyX
127e63fc17 shada: Use same iteration end conditions as with other iterators 2015-10-08 22:00:49 +03:00
ZyX
c57c569000 shada: Also expand file name obtained from &shada option 2015-10-08 22:00:48 +03:00
ZyX
2ba138b2f9 *: Fix problems with clang+asan Release build 2015-10-08 22:00:47 +03:00
ZyX
be45e75026 shada: Refuse to write ShaDa file when ShaDa was disabled 2015-10-08 22:00:46 +03:00
ZyX
d1830e1433 config: Check order and endianess even when cross-compiling 2015-10-08 22:00:45 +03:00
ZyX
0d15b35d49 shada,config: Use CMake to determine endianess and be64toh existence 2015-10-08 22:00:44 +03:00
ZyX
369081d1c4 shada: Fix crash in hmll_insert
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.
2015-10-08 22:00:43 +03:00
ZyX
9afa45e639 shada: Fix -Wstrict-aliasing gcc error
Also removes theoretically possible unaligned memory access when computing
be64toh() argument.
2015-10-08 22:00:43 +03:00
ZyX
bcb60b0a64 shada: Fix unused variable warning when using Release build 2015-10-08 22:00:42 +03:00
ZyX
597da19777 shada: Fix incompatible pointer types error in non-glibc builds 2015-10-08 22:00:40 +03:00
ZyX
9b53acffb5 shada: Avoid “conditional … depends on initialized value” error
Error can be seen in some errors_spec.lua tests.
2015-10-08 22:00:40 +03:00
ZyX
1889ee329f shada: Allow moving jump index past the end
idx == len + 1 indicates that no jumplist entry is currently used.
2015-10-08 22:00:40 +03:00
ZyX
17c69258a7 shada: Use same merging code for jumps and changes 2015-10-08 22:00:39 +03:00
ZyX
9d8184c65a shada: Move common jump/change merging code into a macros 2015-10-08 22:00:39 +03:00
ZyX
f9ae1caf7e shada: Fix jump list merger code 2015-10-08 22:00:39 +03:00
ZyX
a4b2698a1f shada: Move all default values to an array of ShadaEntry structs 2015-10-08 22:00:39 +03:00
ZyX
0564b30ef5 shada: Fix linter errors 2015-10-08 22:00:38 +03:00
ZyX
74d5084139 shada,functests: Add tests for merging ShaDa data 2015-10-08 22:00:38 +03:00
ZyX
0a334f9d33 shada: Merge changes regardless whether they are from current instance 2015-10-08 22:00:37 +03:00
ZyX
4dc3bc8fc1 shada,functests: Make sure that v:oldfiles list is reset on :rshada! 2015-10-08 22:00:37 +03:00
ZyX
c9963872ef shada: Always use merging when reading jumps and changes 2015-10-08 22:00:36 +03:00
ZyX
4371842bcc shada: Call regtilde when reading last replacement string 2015-10-08 22:00:36 +03:00