aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_getln.c
Commit message (Collapse)AuthorAge
...
* refactor: remove some (const char **) casts (#24423)zeertzjq2023-07-22
|
* fix(inccommand): block errors when parsing command line again (#24374)zeertzjq2023-07-17
| | | Revert the change to ex_getln.c from a741c7fd0465c949a0016fcbee5f4526b65f8c02
* refactor: remove longdundargoc2023-07-03
| | | | | long is 32-bits even on 64-bit windows which makes the type suboptimal for a codebase meant to be cross-platform.
* fix(api): nvim_parse_cmd error message in pcall() #23297Alexandre Teoi2023-07-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: nvim_parse_cmd() in pcall() may show an error message (side-effect): :lua pcall(vim.api.nvim_parse_cmd, vim.fn.getcmdline(), {}) E16: Invalid range Solution: Avoid emsg() in the nvim_parse_cmd() codepath. - refactor(api): add error message output parameter to get_address() - fix: null check emsg() parameter - refactor: remove emsg_off workaround from do_incsearch_highlighting() - refactor: remove emsg_off workaround from cmdpreview_may_show() - refactor: remove remaining calls to emsg() from parse_cmd_address() and get_address() - (refactor): lint set_cmd_dflall_range() - refactor: addr_error() - move output parameter to return value Fix #20339 TODO: These are the functions called by `get_address()`: ``` nvim_parse_cmd() -> parse_cmdline() -> parse_cmd_address() -> get_address() skipwhite() addr_error() qf_get_cur_idx() qf_get_cur_valid_idx() qf_get_size() qf_get_valid_size() mark_get() mark_check() assert() skip_regexp() magic_isset() > do_search() > searchit() ascii_isdigit() getdigits() getdigits_int32() compute_buffer_local_count() hasFolding() ``` From these functions, I found at least two that call emsg directly: - do_search() - seems to be simple to refactor - searchit() - will be more challenging because it may generate multiple error messages, which can't be handled by the current `errormsg` out-parameter. For example, it makes multiple calls to `vim_regexec_multi()` in a loop that possibly generate error messages, and later `searchit()` itself may generate another one: - https://github.com/neovim/neovim/blob/c194acbfc479d8e5839fa629363f93f6550d035c/src/nvim/search.c#L631-L647 - https://github.com/neovim/neovim/blob/c194acbfc479d8e5839fa629363f93f6550d035c/src/nvim/search.c#L939-L954 --------- Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
* fix(cmdline): don't redraw 'tabline' in Ex mode (#24123)zeertzjq2023-06-23
| | | | | | | | Redrawing of 'statusline' and 'winbar' are actually already inhibited by RedawingDisabled in Ex mode. In Vim there is a check for `msg_scrolled == 0` (which is false in Ex mode) since Vim doesn't have msgsep. Add a `!exmode_active` check here in Nvim instead.
* refactor(options): remove `getoption_T` and introduce `OptVal` (#23850)Famiu Haque2023-06-07
| | | | | | | | Removes the `getoption_T` struct and also introduces the `OptVal` struct to unify the methods of getting/setting different option value types. This is the first of many PRs to reduce code duplication in the Vim option code as well as to make options easier to maintain. It also increases the flexibility and extensibility of options. Which opens the door for things like Array and Dictionary options.
* vim-patch:9.0.1588: Incsearch not triggered when pasting clipboard register ↵zeertzjq2023-05-30
| | | | | | | | | | | | (#23817) Problem: Incsearch not triggered when pasting clipboard register on the command line. Solution: Also set "literally" when using a clipboard register. (Ken Takata, closes vim/vim#12460) https://github.com/vim/vim/commit/9cf6ab133227ac7e9169941752293bb7178d8e38 Co-authored-by: K.Takata <kentkt@csc.jp>
* refactor(api): new helper macrosFamiu Haque2023-05-23
| | | | Adds new API helper macros `CSTR_AS_OBJ()`, `STATIC_CSTR_AS_OBJ()`, and `STATIC_CSTR_TO_OBJ()`, which cleans up a lot of the current code. These macros will also be used extensively in the upcoming option refactor PRs because then API Objects will be used to get/set options. This PR also modifies pre-existing code to use old API helper macros like `CSTR_TO_OBJ()` to make them cleaner.
* vim-patch:9.0.0490: using freed memory with cmdwin and BufEnter autocmdzeertzjq2023-05-13
| | | | | | | | | Problem: Using freed memory with cmdwin and BufEnter autocmd. Solution: Make sure pointer to b_p_iminsert is still valid. https://github.com/vim/vim/commit/1c3dd8ddcba63c1af5112e567215b3cec2de11d0 Co-authored-by: Bram Moolenaar <Bram@vim.org>
* fix(redo): make redo of Lua mappings in op-pending mode work (#23566)zeertzjq2023-05-10
|
* vim-patch:9.0.0892: may redraw when not neededLuuk van Baal2023-05-02
| | | | | | | | | | Problem: May redraw when not needed, causing slow scrolling. Solution: Do not redraw when w_skipcol doesn't change. When w_skipcol changes only redraw from the top. (issue vim/vim#11559) https://github.com/vim/vim/commit/f32fb93e431e4db95a8663d86dfeb6bffa5896f6 Co-authored-by: Bram Moolenaar <Bram@vim.org>
* vim-patch:8.2.0578: heredoc for interfaces does not support "trim"zeertzjq2023-04-29
| | | | | | | | Problem: Heredoc for interfaces does not support "trim". Solution: Update the script heredoc support to be same as the :let command. (Yegappan Lakshmanan, closes vim/vim#5916) https://github.com/vim/vim/commit/6c2b7b8055b96463f78abb70f58c4c6d6d4b9d55
* vim-patch:9.0.1330: handling new value of an option has a long "else if" chainLewis Russell2023-04-28
| | | | | | | Problem: Handling new value of an option has a long "else if" chain. Solution: Use a function pointer. (Yegappan Lakshmanan, closes vim/vim#12015) https://github.com/vim/vim/commit/af93691b53f38784efce0b93fe7644c44a7e382e
* refactor: uncrustifydundargoc2023-04-26
| | | | Notable changes: replace all infinite loops to `while(true)` and remove `int` from `unsigned int`.
* fix(ex_getln): initialize pointer with NULLAndreas Schneider2023-04-21
| | | | | | | | In function ‘cmdpreview_open_win’, inlined from ‘cmdpreview_may_show’ at gsrc/nvim/ex_getln.c:2487:28: gsrc/nvim/ex_getln.c:2251:16: warning: ‘cmdpreview_buf’ may be used uninitialized [-Wmaybe-uninitialized] 2251 | int result = do_buffer(DOBUF_GOTO, DOBUF_FIRST, FORWARD, cmdpreview_buf->handle, 0); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* vim-patch:9.0.1460: insufficient testing for getcmdcompltype() (#23159)zeertzjq2023-04-17
| | | | | | Problem: Insufficient testing for getcmdcompltype(). Solution: Add a few more test cases. (closes vim/vim#12268) https://github.com/vim/vim/commit/961b2e54bdbe1c06e4bf8ccf7a7e3deb129b45de
* vim-patch:9.0.1444: crash when passing NULL to setcmdline() (#23048)zeertzjq2023-04-12
| | | | | | | Problem: Crash when passing NULL to setcmdline(). (Andreas Louv) Solution: Use tv_get_string() instead of using v_string directly. (closes vim/vim#12231, closes vim/vim#12227) https://github.com/vim/vim/commit/ac6cd31afcbdd08bfa92ca33f7d4ce5773ba4353
* refactor: remove redundant castsii142023-04-07
|
* refactor: remove redundant const char * castsii142023-04-07
|
* refactor: make error message definitions constii142023-04-05
| | | | message.c functions now take const char * as a format. Error message definitions can be made const.
* refactor: remove char_u (#22829)dundargoc2023-04-02
| | | Closes https://github.com/neovim/neovim/issues/459
* feat(api): add filetype option nvim_get_option_valueLewis Russell2023-03-20
| | | | | - Also adjust the expr-mapping behaviour so normal commands and text changes are allowed in internal dummy buffers.
* 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.
* perf(statusline): UI elements are always redrawn on K_EVENTLuuk van Baal2023-03-08
| | | | | Problem: 'statusline'-format UI elements are redrawn on each K_EVENT. Solution: Only redraw UI elements when something relevant has changed.
* vim-patch:9.0.1380: CTRL-X on 2**64 subtracts two (#22530)zeertzjq2023-03-05
| | | | | | | | Problem: CTRL-X on 2**64 subtracts two. (James McCoy) Solution: Correct computation for large number. (closes vim/vim#12103) https://github.com/vim/vim/commit/5fb78c3fa5c996c08a65431d698bd2c251eef5c7 Co-authored-by: Bram Moolenaar <Bram@vim.org>
* Merge pull request #22429 from bfredl/hkmapbfredl2023-02-28
|\ | | | | feat(edit)!: remove old c implementation of hebrew keymap
| * feat(edit)!: remove old c implementation of hebrew keymapbfredl2023-02-28
| | | | | | | | | | | | | | This feature has long been obsolete. The 'keymap' option can be used to support language keymaps, including hebrew and hebrewp (phonetic mapping). There is no need to keep the old c code with hardcoded keymaps for some languages.
* | refactor(getchar.c): change most char_u to uint8_t (#22444)zeertzjq2023-02-28
| |
* | fix: address -Wmaybe-uninitialized warnings (#22436)Lewis Russell2023-02-27
|/
* vim-patch:9.0.1299: change for triggering incsearch not sufficiently testedzeertzjq2023-02-11
| | | | | | | Problem: Change for triggering incsearch not sufficiently tested. Solution: Add a test case. Simplify the code. (closes vim/vim#11971) https://github.com/vim/vim/commit/412e0e4ed903682f352d8ea58ded480930cc664f
* vim-patch:9.0.1298: inserting register on the cmdline does not trigger incsearchzeertzjq2023-02-11
| | | | | | | | | | | Problem: Inserting a register on the command line does not trigger incsearch or update hlsearch. Solution: Have cmdline_insert_reg() return CMDLINE_CHANGED when appropriate and handle it correctly. (Ken Takata, closes vim/vim#11960) https://github.com/vim/vim/commit/c4b7dec38292fe1cfad7aa5f244031fc6f7c7a09 Co-authored-by: K.Takata <kentkt@csc.jp>
* refactor: replace char_u with char (#21901)dundargoc2023-02-11
| | | | | refactor: replace char_u with char Work on https://github.com/neovim/neovim/issues/459
* refactor: reduce scope of locals as per the style guide (#22206)dundargoc2023-02-11
|
* vim-patch:9.0.1290: CTRL-N and -P on cmdline don't trigger CmdlineChanged ↵zeertzjq2023-02-07
| | | | | | | | | | | (#22151) Problem: CTRL-N and -P on cmdline don't trigger CmdlineChanged. Solution: Jump to cmdline_changed instead of cmdline_not_changed. (closes vim/vim#11956) https://github.com/vim/vim/commit/af9e28a5b8f888b79459393ddb26fffe613c3f3c Cherry-pick Test_Cmdline() change from patch 9.0.1039.
* refactor(optionstr.c): break up did_set_string_option 7Lewis Russell2023-01-25
|
* revert: "refactor(win_close): remove "force", don't pass on "free_buf" ↵zeertzjq2023-01-24
| | | | | | | | (#21921)" (#21979) This reverts commit 0371d0f7afa5e01dd2ac8bbd3abcf0f7454872b3. > 'bufhidden' option exists. I don't think we should assume autoclosing windows are fine just because 'hidden' is set.
* refactor(win_close): remove "force", don't pass on "free_buf" (#21921)zeertzjq2023-01-23
| | | | | | | | | | | | | Problem: The "force" flag of win_close() complicates the code and adds edge cases where it is not clear what the correct behavior should be. The "free_buf" flag of win_close() is passed on to float windows when closing the last window of a tabpage, which doesn't make much sense. Solution: Remove the "force" flag and always close float windows as if :close! is used when closing the last window of a tabpage, and set the "free_buf" flag for a float window based on whether its buffer can be freed. As 'hidden' is on by default, this change shouldn't affect many people.
* refactor: replace char_u with char 24 (#21823)dundargoc2023-01-18
| | | | | refactor: replace char_u with char Work on https://github.com/neovim/neovim/issues/459
* refactor: replace char_u with char 23 (#21798)dundargoc2023-01-18
| | | Work on https://github.com/neovim/neovim/issues/459
* refactor: replace char_u with char 22 (#21786)dundargoc2023-01-17
| | | Work on https://github.com/neovim/neovim/issues/459
* refactor: remove E5500, adjust testszeertzjq2023-01-16
| | | | | | Now with try_end() including more exception info, E5500 looks like redundant information. Adjust tests for more exception information.
* vim-patch:8.2.4585: cannot use keypad page-up/down for completion menuzeertzjq2023-01-15
| | | | | | | | | Problem: Cannot use keypad page-up/down for completion menu. Solution: Recognize the keypad keys. (Yegappan Lakshmanan, closes vim/vim#9963) https://github.com/vim/vim/commit/155b0882088ff115dcfb6ce466fe7c8cc2bef349 Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
* vim-patch:8.2.4579: cannot use page-up and page-down in the cmdline popup menuzeertzjq2023-01-15
| | | | | | | | | | | Problem: Cannot use page-up and page-down in the command line completion popup menu. Solution: Check for to page-up and page-down keys. (Yegappan Lakshmanan, closes vim/vim#9960) https://github.com/vim/vim/commit/5cffa8df7e3c28681b9e5deef6df395784359b6b Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
* vim-patch:partial:8.2.4339: CTRL-A does not work properly with the cmdline ↵zeertzjq2023-01-14
| | | | | | | | | | | | | | popup menu (#21791) Problem: CTRL-A does not work properly with the cmdline popup menu. Solution: Fix issues with CTRL-A. Add more tests for the cmdline popup menu. Remove TermWait() before VeriryScreenDump(). Refactor the cmdline popup code. (Yegappan Lakshmanan, closes vim/vim#9735) https://github.com/vim/vim/commit/560dff49c0095111fc96b4b8dd7f4d269aba9473 Only port cmdexpand.c and test_cmdline.vim changes. Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
* refactor: replace char_u with char 21 (#21779)dundargoc2023-01-14
| | | | | refactor: replace char_u with char Work on https://github.com/neovim/neovim/issues/459
* refactor: replace char_u with char 20 (#21714)dundargoc2023-01-13
| | | | | refactor: replace char_u with char Work on https://github.com/neovim/neovim/issues/459
* vim-patch:partial:9.0.1166: code is indented more than necessary (#21716)zeertzjq2023-01-10
| | | | | | | | | | | | | | | | | | | | | | Problem: Code is indented more than necessary. Solution: Use an early return where it makes sense. (Yegappan Lakshmanan, closes vim/vim#11792) https://github.com/vim/vim/commit/1cfb14aa972ccf3235ac67f07b7db1175b7c5384 Partial port as some highlight.c changes depend on previous patches. Cherry-pick fname_match() change from patch 8.2.4959. Omit internal_func_check_arg_types(): only used for Vim9 script. N/A patches for version.c: vim-patch:9.0.1167: EditorConfig files do not have their own filetype Problem: EditorConfig files do not have their own filetype. Solution: Add the "editorconfig" filetype. (Gregory Anders, closes vim/vim#11779) https://github.com/vim/vim/commit/d41262ed06564cef98a3800e2928e6e0db91abbf Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
* refactor: replace char_u with char 18 (#21237)dundargoc2023-01-09
| | | | | refactor: replace char_u with char Work on https://github.com/neovim/neovim/issues/459
* refactor: replace char_u with chardundargoc2023-01-09
| | | | Work on https://github.com/neovim/neovim/issues/459
* Merge #21580 cmdline issues with cmdheight=0Justin M. Keyes2023-01-03
|\