aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/state.c
Commit message (Collapse)AuthorAge
* refactor: move function macros out of vim_defs.h (#26300)zeertzjq2023-11-29
|
* refactor: fix headers with IWYUdundargoc2023-11-28
|
* vim-patch:9.0.2133: Cannot detect overstrike mode in Cmdline mode (#26263)zeertzjq2023-11-28
| | | | | | | | Problem: Cannot detect overstrike mode in Cmdline mode Solution: Make mode() return "cr" for overstrike closes: vim/vim#13569 https://github.com/vim/vim/commit/d1c3ef1f47c87d1da056c56564e1985fe6f2931d
* refactor: rename types.h to types_defs.hdundargoc2023-11-27
|
* refactor: move Arena and ArenaMem to memory_defs.h (#26240)zeertzjq2023-11-27
|
* build: remove PVSdundargoc2023-11-12
| | | | | | | We already have an extensive suite of static analysis tools we use, which causes a fair bit of redundancy as we get duplicate warnings. PVS is also prone to give false warnings which creates a lot of work to identify and disable.
* fix(f_wait): flush UI before blocking (#25962)zeertzjq2023-11-10
|
* fix(event-loop): flush UI when no input is available (#25728)zeertzjq2023-10-20
| | | | | | Problem: With lots of events, UI flush may be delayed for too long. Solution: Flush UI when no input is available. This still flushes less frequently than before #25629, when a flush also happens when typeahead buffer is empty but input is available.
* refactor: reorganize option header files (#25437)zeertzjq2023-09-30
| | | | | | - Move vimoption_T to option.h - option_defs.h is for option-related types - option_vars.h corresponds to Vim's option.h - option_defs.h and option_vars.h don't include each other
* build(iwyu): add a few more _defs.h mappings (#25435)zeertzjq2023-09-30
|
* vim-patch:8.2.4299: SafeState autocommand interferes with debuggingzeertzjq2023-08-21
| | | | | | | | | Problem: SafeState autocommand interferes with debugging. Solution: Do not trigger SafeState while debugging. (closes vim/vim#9697) https://github.com/vim/vim/commit/46f3080e5cd4cd1bae23e72a429a8195eb1ded7a Co-authored-by: Bram Moolenaar <Bram@vim.org>
* vim-patch:8.1.2053: SafeStateAgain not triggered if callback uses feedkeys()zeertzjq2023-08-21
| | | | | | | | | | | | Problem: SafeStateAgain not triggered if callback uses feedkeys(). Solution: Check for safe state in the input loop. Make log messages easier to find. Add 'S' flag to state(). https://github.com/vim/vim/commit/d103ee78432f9036d243b18dd5aac1263d3b7dc9 Include misc1.c change from patch 8.1.2062. Co-authored-by: Bram Moolenaar <Bram@vim.org>
* vim-patch:8.1.2048: not clear why SafeState and SafeStateAgain are not triggeredzeertzjq2023-08-21
| | | | | | | | | Problem: Not clear why SafeState and SafeStateAgain are not triggered. Solution: Add log statements. https://github.com/vim/vim/commit/37d1807a801d5296f00b3ac85a38b26cfe6de55c Co-authored-by: Bram Moolenaar <Bram@vim.org>
* vim-patch:8.1.2046: SafeState may be triggered at the wrong momentzeertzjq2023-08-21
| | | | | | | | | | | | | Problem: SafeState may be triggered at the wrong moment. Solution: Move it up higher to after where messages are processed. Add a SafeStateAgain event to tigger there. https://github.com/vim/vim/commit/69198cb8c08f124729c41a4681f2d142228a9139 SafeStateAgain is N/A. Move SafeState functions to state.c. Co-authored-by: Bram Moolenaar <Bram@vim.org>
* refactor: uncrustifydundargoc2023-04-26
| | | | Notable changes: replace all infinite loops to `while(true)` and remove `int` from `unsigned int`.
* refactor: remove char_u (#22829)dundargoc2023-04-02
| | | Closes https://github.com/neovim/neovim/issues/459
* refactor(screen): screen.c delenda estbfredl2023-03-14
| | | | | | | | | | | | | drawscreen.c vs screen.c makes absolutely no sense. The screen exists only to draw upon it, therefore helper functions are distributed randomly between screen.c and the file that does the redrawing. In addition screen.c does a lot of drawing on the screen. It made more sense for vim/vim as our grid.c is their screen.c Not sure if we want to dump all the code for option chars into optionstr.c, so keep these in a optionchar.c for now.
* refactor(log): reduce compile time LOG_LEVEL granularitybfredl2023-03-04
|
* build: allow IWYU to fix includes for all .c filesdundargoc2022-11-15
| | | | | | | | | | Allow Include What You Use to remove unnecessary includes and only include what is necessary. This helps with reducing compilation times and makes it easier to visualise which dependencies are actually required. Work on https://github.com/neovim/neovim/issues/549, but doesn't close it since this only works fully for .c files and not headers.
* vim-patch:9.0.0788: ModeChanged autocmd not executed when Visual ends with ↵zeertzjq2022-10-19
| | | | | | | | | | CTRL-C (#20722) Problem: ModeChanged autocmd not executed when Visual mode is ended with CTRL-C. Solution: Do not trigger the autocmd when got_int is set. (closes vim/vim#11394) https://github.com/vim/vim/commit/61c4b04799bf114cadc3bbf212ae8b2ad22a6980 Cherry-pick removal of cmdwin feature check from patch 9.0.0663.
* refactor(redraw): no type argument in update_screen()bfredl2022-10-05
| | | | | | | | | | This was used in the past with assumption that curwin/curbuf is "special" but this has not been true since basically forever at this point. Reduce NOT_VALID/CLEAR panic in options.lua . These should not be set if an effect of the option is causing something which by itself invokes redraw_later().
* refactor: move klib out of src/nvim/ #20341dundargoc2022-09-25
| | | | It's confusing to mix vendored dependencies with neovim source code. A clean separation is simpler to keep track of and simpler to document.
* fix(events): make CursorHold behave as documentedzeertzjq2022-09-17
|
* refactor: replace char_u with charDundar Göc2022-09-09
| | | | Work on https://github.com/neovim/neovim/issues/459
* vim-patch:8.1.2057: the screen.c file is much too bigLewis Russell2022-08-19
| | | | | | | | | | | | | | | Problem: The screen.c file is much too big. Solution: Split it in three parts. (Yegappan Lakshmanan, closes vim/vim#4943) https://github.com/vim/vim/commit/7528d1f6b5422750eb778dfb550cfd0b0e540964 This is an approximation vim-patch 8.1.2057. Applying the patch directly isn't feasible since our version of screen.c has diverged too much, however we still introduce drawscreen.c and drawline.c: - screen.c is now a much smaller file used for low level screen functions - drawline.c contains everything needed for win_line() - drawscreen.c contains everything needed for update_screen() Co-authored-by: zeertzjq <zeertzjq@outlook.com>
* feat(terminal): implement <c-\><c-o> for terminal modebfredl2022-08-02
| | | | this works similar to <c-o> or <c-\><c-o> in insert mode
* vim-patch:8.1.1076: file for Insert mode is much too bigzeertzjq2022-07-20
| | | | | | | | | | | | Problem: File for Insert mode is much too big. Solution: Split off the code for Insert completion. (Yegappan Lakshmanan, closes vim/vim#4044) https://github.com/vim/vim/commit/7591bb39d58ece38a5fef984a08ea9012616c1f9 Cherry-pick ins_compl_len() -> get_compl_len() from patch 8.2.4001. Revert a71c5e9eb98fbb2ca88510269935cdcda37369fc: ctrl_x_mode is no longer a global variable, so l_ctrl_x_mode is no longer needed.
* docs: fix typos (#18269)dundargoc2022-06-04
| | | | | | | | | | Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: Dan Sully <dan+github@sully.org> Co-authored-by: saher <msaher.shair@gmail.com> Co-authored-by: Stephan Seitz <stephan.seitz@fau.de> Co-authored-by: Benedikt Müller <d12bb@posteo.de> Co-authored-by: Andrey Mishchenko <mishchea@gmail.com> Co-authored-by: Famiu Haque <famiuhaque@protonmail.com> Co-authored-by: Oliver Marriott <hello@omarriott.com>
* fix(logging): skip recursion, fix crash #18764Justin M. Keyes2022-05-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: 1. The main log routine does not protect itself against recursion. log_lock() doesn't guard against recursion, it would deadlock... 2. 22b52dd462e5 (#11501) regressed 6f27f5ef91b3 (#10172), because set_init_1..process_spawn tries to log (see backtrace below), but the mutex isn't initialized yet. Even if the mutex were valid, we don't want early logging to fallback to stderr because that can break embedders when stdio is used for RPC. frame 1: 0x00000001001d54f4 nvim`open_log_file at log.c:205:7 frame 2: 0x00000001001d5390 nvim`logmsg(log_level=1, context="UI: ", func_name=0x0000000000000000, line_num=-1, eol=true, fmt="win_viewport") at log.c:150:20 frame : 0x000000010039aea2 nvim`ui_call_win_viewport(grid=2, win=1000, topline=0, botline=1, curline=0, curcol=0, line_count=1) at ui_events_call.generated.h:321:3 frame 4: 0x00000001003dfefc nvim`ui_ext_win_viewport(wp=0x0000000101816400) at window.c:939:5 frame 5: 0x00000001003ec5b4 nvim`win_ui_flush at window.c:7303:7 frame 6: 0x00000001003a04c0 nvim`ui_flush at ui.c:508:3 frame 7: 0x00000001002966ba nvim`do_os_system(argv=0x0000600000c0c000, input=0x0000000000000000, len=0, output=0x0000000000000000, nread=0x00007ff7bfefe830, silent=false, forward_output=false) at shell.c:894:3 frame 8: 0x0000000100295f68 nvim`os_call_shell(cmd="unset nonomatch; vimglob() { while [ $# -ge 1 ]; do echo \"$1\"; shift; done }; vimglob >/var/folders/gk/3tttv_md06987tlwpyp62jrw0000gn/T/nvimwwvwfD/0 ~foo", opts=kShellOptExpand | kShellOptSilent | kShellOptHideMess, extra_args=0x0000000000000000) at shell.c:663:18 frame 9: 0x0000000100295845 nvim`call_shell(cmd="unset nonomatch; vimglob() { while [ $# -ge 1 ]; do echo \"$1\"; shift; done }; vimglob >/var/folders/gk/3tttv_md06987tlwpyp62jrw0000gn/T/nvimwwvwfD/0 ~foo", opts=kShellOptExpand | kShellOptSilent | kShellOptHideMess, extra_shell_arg=0x0000000000000000) at shell.c:712:14 frame 10: 0x0000000100294c6f nvim`os_expand_wildcards(num_pat=1, pat=0x00007ff7bfefeb20, num_file=0x00007ff7bfefee58, file=0x00007ff7bfefee60, flags=43) at shell.c:328:7 ... frame 23: 0x000000010028ccef nvim`expand_env_esc(srcp=",~foo", dst="~foo", dstlen=4094, esc=false, one=false, prefix=0x0000000000000000) at env.c:673:17 frame 24: 0x000000010026fdd5 nvim`option_expand(opt_idx=29, val=",~foo") at option.c:1950:3 frame 25: 0x000000010026f129 nvim`set_init_1(clean_arg=false) at option.c:558:19 frame 26: 0x00000001001ea25e nvim`early_init(paramp=0x00007ff7bfeff5f0) at main.c:198:3 frame 27: 0x00000001001ea6bf nvim`main(argc=1, argv=0x00007ff7bfeff848) at main.c:255:3 Solution: 1. Check for recursion, show "internal error" message. - FUTURE: when "remote TUI" is merged, can we remove log_lock()? 2. Skip logging if log_init wasn't called yet.
* refactor(uncrustify): set maximum number of consecutive newlines to 2 (#18695)dundargoc2022-05-25
|
* refactor: replace char_u variables and functions with charDundar Goc2022-05-16
| | | | Work on https://github.com/neovim/neovim/issues/459
* vim-patch:8.2.4911: the mode #defines are not clearly named (#18499)zeertzjq2022-05-10
| | | | | | | | Problem: The mode #defines are not clearly named. Solution: Prepend MODE_. Renumber them to put the mapped modes first. https://github.com/vim/vim/commit/249591057b4840785c50e41dd850efb8a8faf435 A hunk from the patch depends on patch 8.2.4861, which hasn't been ported yet, but that should be easy to notice.
* vim-patch:8.2.4845: duplicate codezeertzjq2022-04-30
| | | | | | | | | | | | | | | | | | | | Problem: Duplicate code. Solution: Move code below if/else. (closes vim/vim#10314) https://github.com/vim/vim/commit/590f365f91511c164253c5b5812d4d0fc4a238d6 N/A patches for version.c: vim-patch:8.2.4844: <C-S-I> is simplified to <S-Tab> Problem: <C-S-I> is simplified to <S-Tab>. Solution: Do not simplify CTRL if there is also SHIFT. (closes vim/vim#10313) https://github.com/vim/vim/commit/758a8d199988b5b25566b2820db60dc2c9de3e58 vim-patch:8.2.4846: termcodes test fails Problem: Termcodes test fails. Solution: use CTRL-SHIFT-V to insert an unsimplified key. (closes vim/vim#10316) https://github.com/vim/vim/commit/bad8a013c238595aa206690210eb1367fbc878f9
* vim-patch:8.2.4723: the ModeChanged autocmd event is inefficientzeertzjq2022-04-10
| | | | | | | | | Problem: The ModeChanged autocmd event is inefficient. Solution: Avoid allocating memory. (closes vim/vim#10134) Rename trigger_modechanged() to may_trigger_modechanged(). https://github.com/vim/vim/commit/2bf52dd065495cbf28e28792f2c2d50d44546d9f Make v:event readonly for ModeChanged.
* fix(event-loop): check if executed register has endedzeertzjq2022-04-07
|
* fix(event-loop): duplicate display updating logic in vgetorpeek() (#17913)zeertzjq2022-03-30
|
* fix(event-loop): call vpeekc() directly first to check for characterzeertzjq2022-02-03
| | | | Expand mappings first by calling `vpeekc()` directly.
* vim-patch:8.2.3227: 'virtualedit' can only be set globallyzeertzjq2022-01-15
| | | | | | | | Problem: 'virtualedit' can only be set globally. Solution: Make 'virtualedit' global-local. (Gary Johnson, closes vim/vim#8638) https://github.com/vim/vim/commit/53ba05b09075f14227f9be831a22ed16f7cc26b2 I changed some macros to unsigned integer literals to avoid compiler warnings.
* fix: make mode() return correct value in ex modebrian m. carlson2022-01-08
| | | | | | | | | When the user is in ex mode, a call to mode(1) is documented to return "cv". However, it does not currently do so, because the check which checks for ex mode is nested inside a conditional which is never reached in ex mode. Vim uses an explicit check for exmode_active, so let's do the same thing here. Add some tests for this case both with a TTY and in silent mode.
* refactor(misc1): move out autocmd related functionsBjörn Linse2021-12-09
|
* vim-patch:8.2.3430: no generic way to trigger an autocommand on mode changeMagnus Groß2021-11-18
| | | | | | | | | | | | | | | | | Problem: No generic way to trigger an autocommand on mode change. Solution: Add the ModeChanged autocommand event. (Magnus Gross, closes vim/vim#8856) https://github.com/vim/vim/commit/f1e8876fa2359b572d262772747405d3616db670 N/A patches for version.c: vim-patch:8.2.3434: function prototype for trigger_modechanged() is incomplete Problem: Function prototype for trigger_modechanged() is incomplete. Solution: Add "void". https://github.com/vim/vim/commit/28e591dd5080bbcd0f468f9d9597cedb716e28c9 Fixes #4399. Fixes #7416.
* vim-patch:8.2.3461: distinguish Normal and Terminal-Normal mode #15878zeertzjq2021-10-09
| | | | | Problem: Cannot distinguish Normal and Terminal-Normal mode. Solution: Make mode() return "nt" for Terminal-Normal mode. (issue vim/vim#8856) https://github.com/vim/vim/commit/72406a4bd2896915b6f541e26d41521a59b1f846
* vim-patch:8.2.3466: completion submode not indicated for virtual replace ↵zeertzjq2021-10-03
| | | | | | | (#15886) Problem: Completion submode not indicated for virtual replace. Solution: Add submode to "Rv". (closes vim/vim#8945) https://github.com/vim/vim/commit/cc8cd4453332276d55b4a1109eace5785a4f319d
* refactor: format with uncrustify #15778dundargoc2021-09-25
| | | * fixup: force exactly one whitespace between type and variable
* vim-patch:8.2.3236: mode() does not indicate using CTRL-O in Select modezeertzjq2021-07-29
| | | | | | Problem: mode() does not indicate using CTRL-O in Select mode. Solution: Use "vs" and similar. (closes vim/vim#8640) https://github.com/vim/vim/commit/eaf3f36168f85c8e0ab7083cd996b9fbe937045d
* Remove EXMODE_NORMALmatveyt2021-07-23
|
* state: throttle batched event processing when input is availableBjörn Linse2021-03-08
| | | | | | | before, calling vim.schedule() from inside an event would execute the scheduled callback immediately after this event without checking for user input in between. Break event processing whenever user input or an interrupt is available.
* doc + extmarks tweaks #11421Justin M. Keyes2019-11-25
| | | | - nvim_buf_get_extmarks: rename "amount" => "limit" - rename `set_extmark_index_from_obj`
* refactor: allow us to process a child queue only while waiting on inputBjörn Linse2019-09-08
|
* log: log_key()Justin M. Keyes2019-08-27
|