summaryrefslogtreecommitdiffstatshomepage
path: root/src/nvim/quickfix.c
AgeCommit message (Collapse)AuthorFiles
2026-04-24fix(path): normalize path slashes on Windows #37729tao1
Problem: On Windows, path separators may become inconsistent for various reasons, which makes normalization quite painful. Solution: Normalize paths to `/` at the entry boundaries and always use it internally, converting back only in rare cases where `\` is really needed (e.g. cmd.exe/bat scripts?). This is the first commit in a series of incremental steps. Note: * some funcs won't respect shellslash. e.g. `expand/fnamemodify` * some funcs still respect shellslash, but will be updated in a follow PR. e.g. `ex_pwd/f_chdir/f_getcwd` * uv's built-in funcs always return `\`. e.g. `uv.cwd/uv.exepath` Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2026-04-20vim-patch:partial:9.2.0368: too many strlen() calls when adding strings to ↵zeertzjq1
dicts (#39237) Problem: too many strlen() calls when adding strings to dicts Solution: Refactor code to use string_T, use dict_add_string_len() instead of dict_add_string() (John Marriott) Additionally: - In textprop.c, in function prop_fill_dict() use a string_T to store local variable text_align. - In popupwin.c, use a string_T to store struct member pp_name in struct poppos_entry_T. - In mark.c, refactor function add_mark() to pass in the length of argument mname. - In insexpand.c: ->Use a string_T to store the elements of static array ctrl_x_mode_names. ->Refactor function trigger_complete_done_event(): ->->change type of argument char_u *word to string_T *word. ->->make one access of array ctrl_x_mode_names instead of two. ->Refactor function ins_compl_mode() to accept a string_T to return the resulting string. - In fileio.c: ->Refactor function getftypewfd() to accept a string_T to return the resulting string. ->In function create_readdirex_item() use a string_T to store local variable q. - In cmdexpand.c, store global cmdline_orig as a string_T. - In autocmd.c, in function f_autocmd_get() use a string_T to store local variables event_name and group_name. Measure their lengths once when they are assigned so they are not remeasured on each call to dict_add_string() in the subsequent for loop. - In channel.c, in function channel_part_info() drop local variable status and use s instead. Make s a string_T. closes: vim/vim#19999 https://github.com/vim/vim/commit/c13232699db413e735f30b5649c78a7f38a9a069 Co-authored-by: John Marriott <basilisk@internode.on.net>
2026-04-14build: update clang v21, fix warningsdundargoc1
- `src/nvim/ex_cmds_defs.h`: use "U" instead of "u" per `readability-uppercase-literal-suffix`
2026-04-06vim-patch:9.2.0291: too many strlen() callszeertzjq1
Problem: too many strlen() calls Solution: refactor concat_fname() and remove calls to strlen() (John Marriott) Function `concat_fnames()` can make up to 5 calls to `STRLEN()` (either directly or indirectly via `STRCAT()`). In many cases the lengths of arguments `fname1` and/or `fname2` are either known or can simply be calculated. This Commit refactors this function to accept the lengths of arguments `fname1` and `fname2` as arguments. It also adds new argument `ret` to return the resulting string as a `string_T`. Additionally: - function `add_pack_dir_to_rtp()` in `scriptfile.c`: Use a `string_T` to store local variables `new_rtp` and `afterdir`. Replace calls to `STRCAT()` with calls to `STRCPY()`. Change type of variable `keep` to `size_t` for consistency with other lengths. - function `qf_get_fnum()` in `quickfix.c`: Use a `string_T` to store local variables `ptr` and `bufname` - function `qf_push_dir()` in `quickfix.c`: Use a `string_T` to store local variable `dirname`. Replace call to `vim_strsave()` with `vim_strnsave()`. - function `qf_guess_filepath()` in `quickfix.c`: Use a `string_T` to store local variable `fullname`. - function `make_percent_swname()` in `memline.c`: Rename some variables to better reflect their use. Use a `string_T` to store local variables `d` and `fixed_name`. Slightly refactor to remove need to create an extra string. - function `get_file_in_dir()` in `memline.c`: Use a `string_T` to store local variables `tail` and `retval`. Move some variables closer to where they are used. - function `cs_resolve_file()` in `if_cscope.c`: Use a `string_T` to store local variable `csdir`. Remove one call to `STRLEN()`. - function `add_pathsep()` in `filepath.c`: Refactor and remove 1 call to `STRLEN()` - function `set_init_xdg_rtp()` in `option.c`: Use a `string_T` to store local variable `vimrc_xdg`. closes: vim/vim#19854 https://github.com/vim/vim/commit/cb51add7ae400a47407fb7fb7b7a54e238d4fdf4 Co-authored-by: John Marriott <basilisk@internode.on.net> Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-03-29vim-patch:9.2.0253: various issues with wrong b_nwindows after closing buffersSean Dewar1
Problem: close_buffer() callers incorrectly handle b_nwindows, especially after nasty autocmds, allowing it to go out-of-sync. May lead to buffers that can't be unloaded, or buffers that are prematurely freed whilst displayed. Solution: Modify close_buffer() and review its callers; let them decrement b_nwindows if it didn't unload the buffer. Remove some now unneeded workarounds like 8.2.2354, 9.1.0143, 9.1.0764, which didn't always work (Sean Dewar) (endless yapping omitted) related: vim/vim#19728 https://github.com/vim/vim/commit/bf21df1c7bc772e3a29961c961d0821584d50ee0 b_nwindows = 0 change for free_all_mem() was already ported. Originally Nvim returned true when b_nwindows was decremented before the end was reached (to better indicate the decrement). That's not needed anymore, so just return true only at the end, like Vim. (retval isn't used anywhere now anyways) Set textlock for dict watchers at the end of close_buffer() to prevent them from switching windows, as that can leave a window with a NULL buffer. (possible before this PR, but the new assert catches it; added a test) Despite textlock, things still aren't ideal, as watchers may observe the buffer as unloaded and hidden (b_nwindows was decremented), yet still in a window... Likewise, for Nvim, wipe_qf_buffer()'s comment may not be entirely accurate; autocmds are blocked, but on_detach callbacks (textlocked) and dict watchers may still run. Might be problematic, but those aren't new issues. Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
2026-03-15vim-patch:9.2.0159: Crash when reading quickfix linezeertzjq1
Problem: Crash when reading quickfix line (Kaiyu Xie) Solution: Make sure line is terminated by NUL closes: vim/vim#19667 Supported by AI https://github.com/vim/vim/commit/8d13b8244a41d2457bc5049bdd0bb0238a754ede Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-03-04vim-patch:9.2.0097: Memory leak in qf_push_dir()zeertzjq1
Problem: Memory leak in qf_push_dir() (after v9.2.0091) Problem: free dirname, if it is not a directory. closes: vim/vim#19552 https://github.com/vim/vim/commit/e352bb632ab17e5d7b83d43b78a1005507322402 Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-03-04vim-patch:9.2.0091: missing out-of-memory checks in quickfix.czeertzjq1
Problem: missing out-of-memory checks in quickfix.c Solution: Improve error handline, refactor qf_push_dir() slightly (John Marriott). closes: vim/vim#19528 https://github.com/vim/vim/commit/01554015384e1f8016ee29209e0c370a9e79b80d Co-authored-by: John Marriott <basilisk@internode.on.net>
2026-02-08fix(messages): unwanted newlines with ext_messages #37733luukvbaal1
Problem: Newlines intended to write messages below the cmdline or to mark the start of a new message on message grid are emitted through ext_messages. This results in unnecessary newlines for a UI that has decoupled its message area from the cmdline. msg_col is set directly in some places which is not transmitted to msg_show events. Various missing message kind for list commands. Trailing newlines on various list commands. Solution: Only emit such newlines without ext_messages enabled. Use msg_advance() instead of setting msg_col directly. Assign them the "list_cmd" kind. Ensure no trailing newline is printed.
2026-01-12vim-patch:9.1.2079: use-after-free with 'qftf' wiping buffer (#37364)zeertzjq1
Problem: use-after-free with 'quickfixtextfunc' wiping buffer (henices) Solution: Evaluate 'quickfixtextfunc' with textlock enabled. closes: vim/vim#19142 https://github.com/vim/vim/commit/300ea1133fba310ae8acd7fadc3ab3cc24e8402f Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-01-05vim-patch:8.1.0753: printf format not checked for semsg() (#37248)zeertzjq1
Problem: printf format not checked for semsg(). Solution: Add GNUC attribute and fix reported problems. (Dominique Pelle, closes vim/vim#3805) https://github.com/vim/vim/commit/b5443cc46dd1485d6c785dd8c65a2c07bd5a17f3 Cherry-pick a change from patch 8.2.3830. Co-authored-by: Bram Moolenaar <Bram@vim.org>
2026-01-03vim-patch:partial:9.1.2044: Inefficient use of ga_concat() (#37209)zeertzjq1
Problem: Inefficient use of ga_concat() Solution: Use ga_concat_len() when the length is already known to avoid use of strlen() (John Marriott). Additionally the following changes are done: os_unix.c: - in function `socket_server_list_sockets()` use a `string_T` for the strings `buf` and `path` for use in `ga_concat_len()` and drop un-needed variable `dir`. quickfix.c: - in function `qf_jump_print_msg()` use a `string_T` for the string `IObuff` for use in `ga_concat_len()`. - in function `qf_range_text()` use a `string_T` for the string `buf` for use in `ga_concat_len()`. register.c: - simplify function `execreg_line_continuation()`. terminal.c: - in function `read_dump_file()` use a `string_T` for the string `prev_char` for use in `ga_concat_len()`. tuple.c: - in function `tuple_join_inner()` use a `string_T` for the string `s` for use in `ga_concat_len()`. Also, change local struct `join_T` to use `string_T`. vim9type.c: - in functions `type_name_tuple()` and `type_name_func()` use a `string_T` for the string `arg_type` for use in `ga_concat_len()`. closes: vim/vim#19038 https://github.com/vim/vim/commit/a7e671fbb9fa2af9ad6c4ba9a7a881df431cd02b Skip tuple. Co-authored-by: John Marriott <basilisk@internode.on.net>
2025-12-21vim-patch:9.1.2001: cursor may end up in wrong window after :botright copen ↵zeertzjq1
(#37056) Problem: After :botright copen and closing the quikfix window, the cursor ends up in the wrong window. The problem is fr_child always points to the first (leftmost for FR_ROW, topmost for FR_COL) child frame. When do :vsplit, the new window is created on the left, and frame_insert() updates the parent's fr_child to point to this new left window. Solution: Create a snapshot before open the quickfix window and restore it when close it (glepnir). closes: vim/vim#18961 https://github.com/vim/vim/commit/b43f9ded7e98261e3e662a8e919f54e7399b0316 Co-authored-by: glepnir <glephunter@gmail.com>
2025-12-10vim-patch:8.2.4474: memory allocation failures not tested in quickfix codeJan Edmund Lazo1
Problem: Memory allocation failures not tested in quickfix code. Solution: Add alloc IDs and tests. (Yegappan Lakshmanan, closes vim/vim#9848) https://github.com/vim/vim/commit/5a2d4a3ecb67942d47615507a163ffcd5863c073 Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2025-12-10vim-patch:8.2.2834: Vim9: :cexpr does not work with local variablesJan Edmund Lazo1
Problem: Vim9: :cexpr does not work with local variables. Solution: Compile :cexpr. https://github.com/vim/vim/commit/5f7d4c049e934dbc8d2c3f2720797c10ee3c55c2 Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-12-10vim-patch:8.2.1618: Vim9: cannot pass "true" to setloclist()Jan Edmund Lazo1
Problem: Vim9: cannot pass "true" to setloclist(). Solution: Use dict_get_bool(). (closes vim/vim#6882) https://github.com/vim/vim/commit/401f0c07982247cc6d1cd22be08b05c44f7fd040 Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-10-12vim-patch:8.2.3968: build failureJan Edmund Lazo1
Problem: Build failure. Solution: Add missing changes. https://github.com/vim/vim/commit/e70cec976026ce72d09b6589ebba4677581063ac Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-10-04vim-patch:partial:8.1.1939: code for handling v: variables in generic eval ↵Jan Edmund Lazo1
file (#35968) Problem: Code for handling v: variables in generic eval file. Solution: Move v: variables to evalvars.c. (Yegappan Lakshmanan, closes vim/vim#4872) https://github.com/vim/vim/commit/e5cdf153bcb348c68011b308c8988cea42d6ddeb Remove direct reference to "vimvars" for following functions: - assert_error() - get_vim_var_nr() - get_vim_var_list() - get_vim_var_dict() - get_vim_var_str() - set_cmdarg() - set_reg_var() - set_vcount() - set_vexception() - set_vthrowpoint() - set_vim_var_bool() - set_vim_var_dict() - set_vim_var_list() - set_vim_var_nr() - set_vim_var_special() - set_vim_var_string() - set_vim_var_type() Reorder functions based on v8.2.4930 for eval_one_expr_in_str() and eval_all_expr_in_str(). Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-08-20vim-patch:8.2.0853: ml_delete() often called with FALSE argumentJan Edmund Lazo1
Problem: ml_delete() often called with FALSE argument. Solution: Use ml_delete_flags(x, ML_DEL_MESSAGE) when argument is TRUE. https://github.com/vim/vim/commit/ca70c07b72c24aae3d141e67d08f50361f051af5 Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-08-14refactor(build): remove INCLUDE_GENERATED_DECLARATIONS guardsbfredl1
These are not needed after #35129 but making uncrustify still play nice with them was a bit tricky. Unfortunately `uncrustify --update-config-with-doc` breaks strings with backslashes. This issue has been reported upstream, and in the meanwhile auto-update on every single run has been disabled.
2025-08-14vim-patch:9.1.1627: fuzzy matching can be improvedzeertzjq1
Problem: fuzzy-matching can be improved Solution: Implement a better fuzzy matching algorithm (Girish Palya) Replace fuzzy matching algorithm with improved fzy-based implementation The [current](https://www.forrestthewoods.com/blog/reverse_engineering_sublime_texts_fuzzy_match/) fuzzy matching algorithm has several accuracy issues: * It struggles with CamelCase * It fails to prioritize matches at the beginning of strings, often ranking middle matches higher. After evaluating alternatives (see my comments [here](https://github.com/vim/vim/issues/17531#issuecomment-3112046897) and [here](https://github.com/vim/vim/issues/17531#issuecomment-3121593900)), I chose to adopt the [fzy](https://github.com/jhawthorn/fzy) algorithm, which: * Resolves the aforementioned issues. * Performs better. Implementation details This version is based on the original fzy [algorithm](https://github.com/jhawthorn/fzy/blob/master/src/match.c), with one key enhancement: **multibyte character support**. * The original implementation supports only ASCII. * This patch replaces ascii lookup tables with function calls, making it compatible with multibyte character sets. * Core logic (`match_row()` and `match_positions()`) remains faithful to the original, but now operates on codepoints rather than single-byte characters. Performance Tested against a dataset of **90,000 Linux kernel filenames**. Results (in milliseconds) show a **\~2x performance improvement** over the current fuzzy matching algorithm. ``` Search String Current Algo FZY Algo ------------------------------------------------- init 131.759 66.916 main 83.688 40.861 sig 98.348 39.699 index 109.222 30.738 ab 72.222 44.357 cd 83.036 54.739 a 58.94 62.242 b 43.612 43.442 c 64.39 67.442 k 40.585 36.371 z 34.708 22.781 w 38.033 30.109 cpa 82.596 38.116 arz 84.251 23.964 zzzz 35.823 22.75 dimag 110.686 29.646 xa 43.188 29.199 nha 73.953 31.001 nedax 94.775 29.568 dbue 79.846 25.902 fp 46.826 31.641 tr 90.951 55.883 kw 38.875 23.194 rp 101.575 55.775 kkkkkkkkkkkkkkkkkkkkkkkkkkkkk 48.519 30.921 ``` ```vim vim9script var haystack = readfile('/Users/gp/linux.files') var needles = ['init', 'main', 'sig', 'index', 'ab', 'cd', 'a', 'b', 'c', 'k', 'z', 'w', 'cpa', 'arz', 'zzzz', 'dimag', 'xa', 'nha', 'nedax', 'dbue', 'fp', 'tr', 'kw', 'rp', 'kkkkkkkkkkkkkkkkkkkkkkkkkkkkk'] for needle in needles var start = reltime() var tmp = matchfuzzy(haystack, needle) echom $'{needle}' (start->reltime()->reltimefloat() * 1000) endfor ``` Additional changes * Removed the "camelcase" option from both matchfuzzy() and matchfuzzypos(), as it's now obsolete with the improved algorithm. related: neovim/neovim#34101 fixes vim/vim#17531 closes: vim/vim#17900 https://github.com/vim/vim/commit/7e0df5eee9eab872261fd5eb0068cec967a2ba77 Co-authored-by: Girish Palya <girishji@gmail.com>
2025-06-29fix(help): :help can focus unfocusable/hide window #34442phanium1
Problem: :help/:helpgrep/:lhelpgrep can focus unfocusable/hide window Solution: Ignore unfocusable/hidden window when reusing help buffer.
2025-06-23fix(quickfix): use correct lnume when appending (#34611)glepnir1
Problem: ml_get error when updating quickfix buffer with nvim_buf_attach Solution: use correct lnume parameter in changed_lines for append mode Fix #34610
2025-06-17fix(api): buffer updates in quickfix buffer #31105glepnir1
Problem: Buffer events (specifically on_bytes callbacks) weren't triggered when the quickfix list was modified, preventing buffer change notifications. Solution: Add code to send both bytes and lines change notifications after quickfix buffer updates to properly trigger all attached callbacks.
2025-05-17vim-patch:9.1.1396: 'grepformat' is a global option (#34060)zeertzjq1
Problem: The 'grepformat' option is global option, but it would be useful to have it buffer-local, similar to 'errorformat' and other quickfix related options (Dani Dickstein) Solution: Add the necessary code to support global-local 'grepformat', allowing different buffers to parse different grep output formats (glepnir) fixes: vim/vim#17316 closes: vim/vim#17315 https://github.com/vim/vim/commit/7b9eb6389d693dafcd502cda2ffc62564a2dbba9 Co-authored-by: glepnir <glephunter@gmail.com>
2025-05-11vim-patch:9.1.1376: quickfix dummy buffer may remain as dummy bufferSean Dewar1
Problem: when failing to wipeout a quickfix dummy buffer, it will remain as a dummy buffer, despite being kept. Solution: clear its dummy BF_DUMMY flag in this case (Sean Dewar). closes: vim/vim#17283 https://github.com/vim/vim/commit/270124f46ae6266ac7eee871e28d3072dd7d5a92 Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
2025-05-11vim-patch:9.1.1375: [security]: possible heap UAF with quickfix dummy bufferSean Dewar1
Problem: heap use-after-free possible when autocommands switch away from the quickfix dummy buffer, but leave it open in a window. Solution: close its windows first before attempting the wipe. (Sean Dewar) related: vim/vim#17283 https://github.com/vim/vim/commit/b4074ead5cd8751f0460e157471028dbb77ca1e9 Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
2025-05-03fix(quickfix): always split from current window #33807luukvbaal1
Problem: `:copen` opens at the bottom by switching to `lastwin`, needlessly changing the window it inherits context from. Solution: Use the `WSP_BOT` flag to `win_split()` to open at the bottom.
2025-04-09vim-patch:9.1.1288: Using wrong window in ll_resize_stack() (#33397)zeertzjq1
Problem: Using wrong window in ll_resize_stack() (after v9.1.1287) Solution: Use "wp" instead of "curwin", even though they are always the same value. Fix typos in documentation (zeertzjq). closes: vim/vim#17080 https://github.com/vim/vim/commit/b71f1309a210bf8f61a24f4eda336de64c6f0a07
2025-04-08vim-patch:9.1.1287: quickfix code can be further improvedzeertzjq1
Problem: quickfix code can be further improved (after v9.1.1283) Solution: slightly refactor quickfix.c (Hirohito Higashi) - remove error message output - adjust comments - rename functions: - qf_init_quickfix_stack() --> qf_init_stack() - qf_resize_quickfix_stack() --> qf_resize_stack() - qf_resize_stack() --> qf_resize_stack_base() Now qf_alloc_stack() can handle both quickfix/location lists. closes: vim/vim#17068 https://github.com/vim/vim/commit/adcfb6caeb1c9c54448fff8d5812c3dca2ba0d03 Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2025-04-08vim-patch:9.1.1283: quickfix stack is limited to 10 itemszeertzjq1
Problem: quickfix and location-list stack is limited to 10 items Solution: add the 'chistory' and 'lhistory' options to configure a larger quickfix/location list stack (64-bitman) closes: vim/vim#16920 https://github.com/vim/vim/commit/88d41ab270a8390a43da97a903b1a4d76b89d330 Co-authored-by: 64-bitman <60551350+64-bitman@users.noreply.github.com> Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2025-04-08vim-patch:9.1.1253: abort when closing window with attached quickfix datazeertzjq1
Problem: If win_close() is called with a window that has quickfix stack attached to it, the corresponding quickfix buffer will be closed and freed after the buffer was already closed. At that time curwin->w_buffer points to NULL, which the CHECK_CURBUF will catch and abort if ABORT_ON_ERROR is defined Solution: in wipe_qf_buffer() temporarily point curwin->w_buffer back to curbuf, the window will be closed anyhow, so it shouldn't matter that curbuf->b_nwindows isn't incremented. closes: vim/vim#16993 closes: vim/vim#16985 https://github.com/vim/vim/commit/ce80c59bfd3c0087a354ee549639ca60fa192fba Co-authored-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2025-03-27vim-patch:9.1.1214: matchfuzzy() can be improved for camel case matchesglepnir1
Problem: When searching for "Cur", CamelCase matches like "lCursor" score higher than exact prefix matches like Cursor, which is counter-intuitive (Maxim Kim). Solution: Add a 'camelcase' option to matchfuzzy() that lets users disable CamelCase bonuses when needed, making prefix matches rank higher. (glepnir) fixes: vim/vim#16504 closes: vim/vim#16797 https://github.com/vim/vim/commit/28e40a7b55ce471656cccc2260c11a29d5da447e Co-authored-by: glepnir <glephunter@gmail.com>
2024-12-23refactor: iwyu #31637Justin M. Keyes1
Result of `make iwyu` (after some "fixups").
2024-12-22fix(messages): typo and unwanted truncation in msg_outtrans_long #31669luukvbaal1
- Typo/bug in msg_outtrans_long passing string length as "hist" argument. - Avoid truncating message in msg_outtrans_long with ext_messages (followup to 1097d239c307a10a87fa995c4cfbe5987939e177). - Remove `_hl` from `msg_keep`, `smsg_keep` as there is no non-`_hl` variant. - `msg_printf_hl` is removed (identical to `smsg` except it sets `msg_scroll = true`, seemingly as a caveat to force a more prompt in cmdline mode). Move this logic to the only the only place this was used in ex_getln.c.
2024-11-23refactor(options): autogenerate valid values and flag enums for options (#31089)Famiu Haque1
Problem: Option metadata like list of valid values for an option and option flags are not listed in the `options.lua` file and are instead manually defined in C, which means option metadata is split between several places. Solution: Put metadata such as list of valid values for an option and option flags in `options.lua`, and autogenerate the corresponding C variables and enums. Supersedes #28659 Co-authored-by: glepnir <glephunter@gmail.com>
2024-11-13refactor(highlight): make enum of builtin highlights start with 1bfredl1
This makes it possible to use HLF_ values directly as highlight id:s and avoids +1 adjustments especially around messages.
2024-11-08refactor(message): propagate highlight id instead of attrsLuuk van Baal1
Problem: Highlight group id is not propagated to the end of the message call stack, where ext_messages are emitted. Solution: Refactor message functions to pass along highlight group id instead of attr id.
2024-10-27refactor(options): always allocate option values (#30917)Famiu Haque1
Instead of keeping `P_ALLOCED` and `P_DEF_ALLOCED` flags to check if an option value is allocated, always allocate option values to simplify the logic. Ref: #25672
2024-10-15vim-patch:9.1.0785: cannot preserve error position when setting quickfix ↵zeertzjq1
list (#30820) Problem: cannot preserve error position when setting quickfix lists Solution: Add the 'u' action for setqflist()/setloclist() and try to keep the closes target position (Jeremy Fleischman) fixes: vim/vim#15839 closes: vim/vim#15841 https://github.com/vim/vim/commit/27fbf6e5e8bee5c6b61819a5e82a0b50b265f0b0 Co-authored-by: Jeremy Fleischman <jeremyfleischman@gmail.com>
2024-10-03vim-patch:9.1.0755: quickfix list does not handle hardlinks well (#30637)zeertzjq1
Problem: quickfix list does not handle hardlinks well Solution: store original file name with quickfix entry (Austin Chang) Quickfix list shows entries with duplicate name if the file is opened with the path of hard links. The major cause is that qflist assumed that the filename passed into `qf_add_entry` matches the filename opened with the buffer. This patch handles this case by introduce a `qf_fname` into `qfline_S` structure. It stores the filename from `qf_add_entry` for each quickfix line. closes: vim/vim#15687 https://github.com/vim/vim/commit/29822996996550f68a781e85753ebd4d177f22da Co-authored-by: Austin Chang <austin880625@gmail.com>
2024-09-14vim-patch:9.1.0728: [security]: heap-use-after-free in garbage collection ↵zeertzjq1
with location list user data (#30377) Problem: heap-use-after-free in garbage collection with location list user data. Solution: Mark user data as in use when no other window is referencing the location list (zeertzjq) fixes: neovim/neovim#30371 closes: vim/vim#15683 https://github.com/vim/vim/commit/be4bd189d23854ddf1d85ad291d8f7ad3f22b7a0
2024-07-30refactor: collapse statements in single assignmentsLewis Russell1
Problem: Variables are often assigned multiple places in common patterns. Solution: Replace these common patterns with different patterns that reduce the number of assignments. Use `MAX` and `MIN`: ```c if (x < y) { x = y; } // --> x = MAX(x, y); ``` ```c if (x > y) { x = y; } // --> x = MIN(x, y); ``` Use ternary: ```c int a; if (cond) { a = b; } els { a = c; } // --> int a = cond ? b : c; ```
2024-07-08fix(quickfix): make shortmess+=O work with cmdheight=0 (#29609)zeertzjq1
2024-06-11refactor(memory): use builtin strcat() instead of STRCAT()bfredl1
The latter was mostly relevant with the past char_u madness. NOTE: STRCAT also functioned as a counterfeit "NOLINT" for clint apparently. But NOLINT-ing every usecase is just the same as disabling the check entirely.
2024-06-04refactor: replace '\0' with NULJames Tirta Halim1
2024-06-01refactor: move shared messages to errors.h #26214Justin M. Keyes1
2024-05-22vim-patch:9.1.0426: too many strlen() calls in search.czeertzjq1
Problem: too many strlen() calls in search.c Solution: refactor code and remove more strlen() calls, use explicit variable to remember strlen (John Marriott) closes: vim/vim#14796 https://github.com/vim/vim/commit/8c85a2a49acf80e4f53ec51e6ff2a5f3830eeddb Co-authored-by: John Marriott <basilisk@internode.on.net>
2024-05-09vim-patch:9.1.0397: Wrong display with 'smoothscroll' when changing quickfix ↵zeertzjq1
list (#28674) Problem: Wrong display with 'smoothscroll' when changing quickfix list. Solution: Reset w_skipcol when replacing quickfix list (zeertzjq). closes: vim/vim#14730 https://github.com/vim/vim/commit/c7a8eb5ff2ddd919e6f39faec93d81c52874695a
2024-04-01vim-patch:9.1.0231: Filetype may be undetected when SwapExists sets ft in ↵zeertzjq1
other buf (#28136) Problem: Filetype may be undetected when a SwapExists autocommand sets filetype in another buffer. Solution: Make filetype detection state buffer-specific. Also fix a similar problem for 'modified' (zeertzjq). closes: vim/vim#14344 https://github.com/vim/vim/commit/5bf6c2117fcef85fcf046c098dd3eb72a0147859