Commit Graph

4225 Commits

Author SHA1 Message Date
ZyX
be45e75026 shada: Refuse to write ShaDa file when ShaDa was disabled 2015-10-08 22:00:46 +03:00
ZyX
e2c3ea4445 os/time: Make Timestamp be 64-bit unsigned integer 2015-10-08 22:00:46 +03:00
ZyX
0caf17d0e8 search: When freeing search patterns also clear them 2015-10-08 22:00:45 +03:00
ZyX
d1830e1433 config: Check order and endianess even when cross-compiling 2015-10-08 22:00:45 +03:00
ZyX
b249529676 functests: Make one recover_spec test also use gdb or valgrind 2015-10-08 22:00:45 +03:00
ZyX
804e074096 eval,functests: Reference all additional_* items created by ShaDa 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
8f7ddfb9a4 documentation: Update vim differences list, reference critical errors 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
0960e16908 functests: Disable some tests when running with address sanitizer
Ref #1350
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
bcd8789609 ex_getln: Return something from hist_type2char without asserts
Otherwise QuickBuild shows a warning that control may reach end of non-void
function.
2015-10-08 22:00:42 +03:00
ZyX
5941380f49 mark: Avoid address sanitizer error 2015-10-08 22:00:42 +03:00
ZyX
e4c0741206 ops: Fix access to unsaved register when iterating over registers 2015-10-08 22:00:41 +03:00
ZyX
689390210a mark: Fix out-of-bounds array access when iterating over global marks 2015-10-08 22:00:41 +03:00
ZyX
1a348f8ed8 ops: Fix “conditional … depends on unitialized …” error in op_yank_reg 2015-10-08 22:00:40 +03:00
ZyX
597da19777 shada: Fix incompatible pointer types error in non-glibc builds 2015-10-08 22:00:40 +03:00
ZyX
563f5c2650 shada: Fix memory leak when reading registers from ShaDa file
Occures once register from ShaDa file overwrites non-empty register in the
current instance.
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
fcb3e96cbd undo: When reading persistent undo file give marks current time
Guess this is better then zero time which will give ShaDa marks the priority
almost always.
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
ZyX
830c8bd23e functests: Add a number of “generic” functional tests 2015-10-08 22:00:36 +03:00
ZyX
c5554cbb87 shada: Use hash for searching for history entries 2015-10-08 22:00:35 +03:00
ZyX
bcdda63e3a shada: Allocate all hashes on stack 2015-10-08 22:00:35 +03:00
ZyX
fd4d5521a3 shada,functests: Use special sd_reader function for skipping 2015-10-08 22:00:34 +03:00
ZyX
17b5d27d85 functests: Move wshada and sdrcmd commands to helpers 2015-10-08 22:00:34 +03:00
ZyX
42fbfd3aee shada: Add warning about removing/renaming temporary file 2015-10-08 22:00:30 +03:00
ZyX
1542fc221e shada,functests: Improve detection of invalid ShaDa files
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.
2015-10-08 22:00:29 +03:00
ZyX
1e06792099 scripts: Improve shadacat to work with unknown items 2015-10-08 22:00:29 +03:00
ZyX
d8b0cd5c17 documentation: Add extended ShaDa format description 2015-10-08 22:00:28 +03:00
ZyX
aea7f6aa72 ex_getln: Refactor HIST_\* list of macros to enum 2015-10-08 22:00:27 +03:00
ZyX
fce9590cfc shada: When packing header, pack mapping keys as strings, not binary 2015-10-08 22:00:25 +03:00
ZyX
12a31c70c1 shada,functests: Test compatibility support
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.
2015-10-08 22:00:25 +03:00
ZyX
82934e8797 shada: Fix GCC -Wconversion warnings in srni_flags definitions 2015-10-08 22:00:25 +03:00
ZyX
278de872f7 shada: Synchronize sd_writer file before closing 2015-10-08 22:00:24 +03:00
ZyX
21056bad57 documentation: Describe forward compatibility limitations 2015-10-08 22:00:24 +03:00
ZyX
2244db67aa shada: Do not allow empty keys 2015-10-08 22:00:22 +03:00
ZyX
5b3e668f3e shada: When reading marks or registers, free items when set fails 2015-10-08 22:00:17 +03:00
ZyX
07d9ab26c6 *: Make ShaDa code use VimL values for additional_\* data 2015-10-08 22:00:16 +03:00