aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/shada.c
Commit message (Collapse)AuthorAge
...
* refactor: missing parenthesis may cause unexpected problems (#17443)kylo2522022-05-26
| | | related vim-8.2.{4402,4639}
* refactor(uncrustify): set maximum number of consecutive newlines to 2 (#18695)dundargoc2022-05-25
|
* feat(defaults): session data in $XDG_STATE_HOME #15583Ivan2022-05-12
| | | | | | | | | | | | See: https://gitlab.freedesktop.org/xdg/xdg-specs/-/commit/4f2884e16db35f2962d9b64312917c81be5cb54b - Move session persistent data to $XDG_STATE_HOME Change 'directory', 'backupdir', 'undodir', 'viewdir' and 'shadafile' default location to $XDG_STATE_HOME/nvim. - Move logs to $XDG_STATE_HOME, too. - Add stdpath('log') support. Fixes: #14805
* refactor: replace char_u variables and functions with charDundar Goc2022-05-09
| | | | Work on https://github.com/neovim/neovim/issues/459
* refactor: move macro definiton outside of enumsDundar Goc2022-05-06
| | | | | | Uncrustify version 0.75 assumes the macro inside the enum is an enum element, and thus adds a comma after it. This breaks neovim and makes it impossible to build it.
* refactor: replace char_u variables and functions with charDundar Goc2022-05-04
| | | | Work on https://github.com/neovim/neovim/issues/459
* refactor(uncrustify): change rules to better align with the style guideDundar Goc2022-04-29
| | | | | | | | | | | | | Add space around arithmetic operators '+' and '-'. Remove space between back-to-back parentheses, i.e. ')(' vs. ') ('. Remove space between '((' or '))' of control statements. Add space between ')' and '{' of control statements. Remove space between function name and '(' on function declaration. Collapse empty blocks between '{' and '}'. Remove newline at the end of the file. Remove newline between 'enum' and '{'. Remove newline between '}' and ')' in a function invocation. Remove newline between '}' and 'while' of 'do' statement.
* refactor: convert macros to all-caps (#17895)dundargoc2022-04-24
| | | Closes https://github.com/neovim/neovim/issues/6297
* refactor: pass "preview" to regtilde()zeertzjq2022-04-04
|
* feat(lua): show proper verbose output for lua configurationshadmansaleh2022-02-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `:verbose` didn't work properly with lua configs (For example: options or keymaps are set from lua, just say that they were set from lua, doesn't say where they were set at. This fixes that issue. Now `:verbose` will provide filename and line no when option/keymap is set from lua. Changes: - compiles lua/vim/keymap.lua as vim/keymap.lua - When souring a lua file current_sctx.sc_sid is set to SID_LUA - Moved finding scripts SID out of `do_source()` to `get_current_script_id()`. So it can be reused for lua files. - Added new function `nlua_get_sctx` that extracts current lua scripts name and line no with debug library. And creates a sctx for it. NOTE: This function ignores C functions and blacklist which currently contains only vim/_meta.lua so vim.o/opt wrappers aren't targeted. - Added function `nlua_set_sctx` that changes provided sctx to current lua scripts sctx if a lua file is being executed. - Added tests in tests/functional/lua/verbose_spec.lua - add primary support for additional types (:autocmd, :function, :syntax) to lua verbose Note: These can't yet be directly set from lua but once that's possible :verbose should work for them hopefully :D - add :verbose support for nvim_exec & nvim_command within lua Currently auto commands/commands/functions ... can only be defined by nvim_exec/nvim_command this adds support for them. Means if those Are defined within lua with vim.cmd/nvim_exec :verbose will show their location . Though note it'll show the line no on which nvim_exec call was made.
* refactor: saner options for uncrustify (#16204)dundargoc2021-11-19
| | | | | | | | | | | | | | | | | | | | | | | | * sp_enum_after_assign = force * sp_brace_typedef = force * nl_do_brace = remove * sp_do_brace_open = force * sp_brace_close_while = force * sp_before_semi = remove * sp_before_semi_for = remove * sp_before_semi_for_empty = remove * sp_between_semi_for_empty = remove * sp_after_semi_for_empty = remove * sp_before_square = remove * sp_before_squares = remove * sp_inside_square = remove * sp_inside_fparens = remove * sp_inside_fparen = remove * sp_inside_tparen = remove * sp_after_tparen_close = remove * sp_return_paren = force * pos_bool = lead * sp_pp_concat = remove * sp_pp_stringify = remove * fixup: disable formatting for the INIT section
* vim-patch:8.1.0743: giving error messages is not flexibleJames McCoy2021-11-01
| | | | | | | | | Problem: Giving error messages is not flexible. Solution: Add semsg(). Change argument from "char_u *" to "char *", also for msg() and get rid of most MSG macros. (Ozaki Kiichi, closes vim/vim#3302) Also make emsg() accept a "char *" argument. Get rid of an enormous number of type casts. https://github.com/vim/vim/commit/f9e3e09fdc93be9f0d47afbc6c7df1188c2a5a0d
* refactor: reduce number of unique char casts (#15995)dundargoc2021-10-12
|
* refactor: remove redundant castsDundar Göc2021-10-07
|
* refactor: remove superfluous function-like macros #15918dundargoc2021-10-06
| | | | | | | | | Remove following macros: CONVERTED HMLL_ITER_BACK PACK_STRUCT IGNORE_BUF find_shada_parameter path_try_shorten_fname
* refactor: inline unnecessary macros #15890dundargoc2021-10-04
|
* refactor: remove redundant char casts #15888dundargoc2021-10-04
|
* Refactor/uncrustify (#15790)dundargoc2021-09-29
| | | | | | | | | | | | | * refactor: format with uncrustify * fixup(dundar): fix functions comments * fixup(dundar): remove space between variable and ++/-- * fixup(dundar): better workaround for macro attributes This is done to be able to better use uncrustify rules for macros * fixup(justin): make preprocessors follow neovim style guide
* refactor: format with uncrustify #15778dundargoc2021-09-25
| | | * fixup: force exactly one whitespace between type and variable
* feat(shada): restore Blob globals properlySean Dewar2021-09-15
| | | | | | | | | | | As Strings and Blobs are encoded as msgpack BINs, the current ShaDa implementation will restore global Blob variables as Strings (or msgpack special dicts if they contain NULs). Encode an additional element with Blob globals to differentiate them from Strings so that we can restore them with the correct type. Adjust variables_spec.lua's autotest() to also check for proper type.
* Use abort() instead of assert(false) for things that should never happenJames McCoy2021-01-31
| | | | | | | | assert() is compiled out for release builds, but we don't want to continue running in these impossible situations. This also resolves the "implicit fallthrough" warnings for the asserts in switch cases.
* shada: fix pvs/v1004Jan Edmund Lazo2020-08-15
|
* shada: fix failed assertion on exit (#12692)erw72020-07-31
| | | | | | 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
* vim-patch:8.2.0920: writing viminfo fails with a circular referenceerw72020-06-09
| | | | | | Problem: Writing viminfo fails with a circular reference. Solution: Use copyID to detect the cycle. (closes vim/vim#6217) https://github.com/vim/vim/commit/5b157fe2edfdce5f77080aeac2b4a03f39eb1c1a
* shada: fix write E5004 error on exiterw72020-06-08
| | | | | Fix the problem of failing to write shada when the global variable contains Funcref or Partial.
* doc: fix typos [ci skip] #11787Hye Sung Jung2020-01-30
|
* Remove excess <stdint.h>Jan Edmund Lazo2019-09-11
|
* shada: initialize jumplist before search pattern (#10964)Abdelhakeem Osama2019-09-07
| | | | | | | 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.
* shada/context: fully remove jumplist duplicates #10898Abdelhakeem Osama2019-09-03
| | | | | | | | | | | | | | | | - Always load files when cleaning up jumplist. - For Shada: avoids writing duplicate entries, which happens when you read from a shada file with duplicate entries (merging the jumplist while writing sometimes produces duplicate entries, bug?) and then write right away (i.e.: without any `:jumps`, `getjumplist()`, or any jump movement, that is: nothing that calls `cleanup_jumplist` with `loadfiles == true`). - For Context: avoids non-idempotent behavior for the same reason (i.e.: first call to `shada_encode_jumps` does not remove duplicate entries). - Do not set pcmark when dumping jumplist for Context. - Retrieving current Context shouldn't add an entry to the jumplist (which will be removed by a subsequent `cleanup_jumplist` anyway, i.e.: tail entry matching current position), just act like `getjumplist` for instance.
* vim-patch:8.0.1768: SET_NO_HLSEARCH() used in a wrong wayJan Edmund Lazo2019-09-02
| | | | | | | Problem: SET_NO_HLSEARCH() used in a wrong way. Solution: Make it a function. (suggested by Dominique Pelle, closes vim/vim#2850) https://github.com/vim/vim/commit/451fc7b954906069f1830a8092ad85616049a828
* vim-patch:8.0.0930: terminal buffers are stored in the viminfo file (#10889)Jaskaran Singh2019-08-30
| | | | | | Problem: Terminal buffers are stored in the viminfo file while they can't be useful. Solution: Skip terminal buffers for file marks and buffer list https://github.com/vim/vim/commit/e62780543f403186b27b210dd087dd8ba74159fc
* context: shada_encode_regs(): init WriteMergerState #10637Justin M. Keyes2019-07-28
| | | | | | | | | | | | | | | | | | | | | | | - Check shada_pack_xx() result, abort on failure. - Use xcalloc() to zero-initialize `wms`, fixes below ASAN failure. ASAN failure (running vim_spec.lua in a loop): ../src/nvim/shada.c:1773:13: runtime error: load of value 224, which is not a valid value for type 'bool' SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../src/nvim/shada.c:1773:13 Adding an explicit check just before the ASAN failed line: case kSDItemRegister: { if (*((int *)(void *)&entry.data.reg.is_unnamed) != 1 && *((int *)(void *)&entry.data.reg.is_unnamed) != 0) { abort(); (gdb) p entry.data.reg +p entry.data.reg $5 = {name = 49 '1', type = kMTLineWise, contents = 0x60200000c250, is_unnamed = true, contents_size = 1, width = 0, additional_data = 0x0} (gdb) p *((uint8_t *)(void *)&entry.data.reg.is_unnamed) +p *((uint8_t *)(void *)&entry.data.reg.is_unnamed) $7 = 2049
* API: ContextJustin M. Keyes2019-07-27
|
* vim-patch:8.0.1496: VIM_CLEAR()Justin M. Keyes2019-05-25
| | | | | | | | Problem: Clearing a pointer takes two lines. Solution: Add VIM_CLEAR() and replace vim_clear(). (Hirohito Higashi, closes #2629) vim-patch:8.0.1481
* vim-patch:8.0.1513: the jumplist is not always properly cleaned upJan Edmund Lazo2019-05-19
| | | | | | Problem: The jumplist is not always properly cleaned up. Solution: Call fname2fnum() before cleanup_jumplist(). (Yegappan Lakshmanan) https://github.com/vim/vim/commit/486797413791f6be12dcec6e5faf4f952e4647ae
* vim-patch:8.0.1498: getjumplist() returns duplicate entriesJan Edmund Lazo2019-05-19
| | | | | | Problem: Getjumplist() returns duplicate entries. (lacygoill) Solution: Call cleanup_jumplist(). (Yegappan Lakshmanan) https://github.com/vim/vim/commit/a7e18d237f817637815f0de44b08df1e0ca0f4f9
* options: avoid using empty 'shadafile'Marco Hinz2019-04-16
| | | | | References https://github.com/neovim/neovim/pull/9907 Fixes https://github.com/neovim/neovim/issues/9912
* vim-patch:8.0.0716: "--clean", 'shadafile' #9907Justin M. Keyes2019-04-15
| | | | | | | | | | | | Nvim notes: - Nvim does not support "-u DEFAULTS", that change is omitted. - Also add 'shadafile' as an alias to 'viminfofile'. - Deprecate 'viminfofile'. Problem: Not easy to start Vim cleanly without changing the viminfo file. Not possible to know whether the -i command line flag was used. Solution: Add the --clean command line argument. Add the 'viminfofile' option. Add "-u DEFAULTS". https://github.com/vim/vim/commit/c4da113ef98dcfd6f2a088b1693c0317dcb5bf42
* jumplist: avoid extra tail entry #9805Abdelhakeem Osama2019-04-02
| | | fixes #9775
* clang/"null passed to nonnull arg": shada.cJustin M. Keyes2019-01-13
|
* PVS/V535: shada.c: variable reassigned in inner loopJustin M. Keyes2019-01-04
| | | | | False positive: `i` is intentionally, temporarily reassigned. See a70fde1b4585 #9425
* build: enable -WshadowJustin M. Keyes2019-01-02
| | | | | | | | | | Note about shada.c: - shada_read_next_item_start was intentionally shadowing `unpacked` and `i` because many of the macros (e.g. ADDITIONAL_KEY) implicitly depended on those variable names. - Macros were changed to parameterize `unpacked` (but not `i`). Macros like CLEAR_GA_AND_ERROR_OUT do control-flow (goto), so any other approach is messy.
* fixed lint errorsMichaHoffmann2018-09-24
|
* add func_attr_printf in :MichaHoffmann2018-09-24
| | | | | | | | | | | | | | | | | | | | | | log.c message.c strings.c fixed some printf warnings in: src/nvim/undo.c src/nvim/eval.c src/nvim/eval/encode.c src/nvim/eval/typval.c src/nvim/ex_getln.c src/nvim/fileio.c src/nvim/lua/executor.c src/nvim/main.c src/nvim/regexp_nfa.c src/nvim/shada.c src/nvim/spellfile.c src/nvim/tui/terminfo.c src/nvim/garray.h
* IO: shada should respect 'fsync' optionJustin M. Keyes2018-04-21
| | | | | | | shada_write_file() is called on exit (:quit and friends), this can be very slow. Note: AFAICT Vim (do_viminfo()) does not appear to fsync() viminfo.
* shada: Fix conversion warningsZyX2018-04-01
|
* shada: Fix some memory leaks and completely ignore numbered mark namesZyX2018-04-01
| | | | | | | | | | | | | 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.)
* shada: Add functions to format ShaDa entries for debugging purposesZyX2018-04-01
| | | To be used in debugging printfs.
* shada: When storing numeric marks reset the numbersZyX2018-04-01
| | | Attempt to fix observed crash. Crash currently not reproduced.
* Revert "shada: In place of ignoring cursor position with lnum 0 save with 1"ZyX2018-03-27
| | | | This reverts commit aa728798b4bd89b59cee86103885c15d386f73ba.