aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/quickfix.c
Commit message (Collapse)AuthorAge
* refactor: iwyu #31637Justin M. Keyes2024-12-23
| | | Result of `make iwyu` (after some "fixups").
* fix(messages): typo and unwanted truncation in msg_outtrans_long #31669luukvbaal2024-12-22
| | | | | | | | | | - 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.
* refactor(options): autogenerate valid values and flag enums for options (#31089)Famiu Haque2024-11-23
| | | | | | | | | | | | | | 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>
* refactor(highlight): make enum of builtin highlights start with 1bfredl2024-11-13
| | | | | This makes it possible to use HLF_ values directly as highlight id:s and avoids +1 adjustments especially around messages.
* refactor(message): propagate highlight id instead of attrsLuuk van Baal2024-11-08
| | | | | | | 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.
* refactor(options): always allocate option values (#30917)Famiu Haque2024-10-27
| | | | | | | 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
* vim-patch:9.1.0785: cannot preserve error position when setting quickfix ↵zeertzjq2024-10-15
| | | | | | | | | | | | | | 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>
* vim-patch:9.1.0755: quickfix list does not handle hardlinks well (#30637)zeertzjq2024-10-03
| | | | | | | | | | | | | | | | | | | | | 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>
* vim-patch:9.1.0728: [security]: heap-use-after-free in garbage collection ↵zeertzjq2024-09-14
| | | | | | | | | | | | | 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
* refactor: collapse statements in single assignmentsLewis Russell2024-07-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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; ```
* fix(quickfix): make shortmess+=O work with cmdheight=0 (#29609)zeertzjq2024-07-08
|
* refactor(memory): use builtin strcat() instead of STRCAT()bfredl2024-06-11
| | | | | | | | 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.
* refactor: replace '\0' with NULJames Tirta Halim2024-06-04
|
* refactor: move shared messages to errors.h #26214Justin M. Keyes2024-06-01
|
* vim-patch:9.1.0426: too many strlen() calls in search.czeertzjq2024-05-22
| | | | | | | | | | | | | 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>
* vim-patch:9.1.0397: Wrong display with 'smoothscroll' when changing quickfix ↵zeertzjq2024-05-09
| | | | | | | | | | 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
* vim-patch:9.1.0231: Filetype may be undetected when SwapExists sets ft in ↵zeertzjq2024-04-01
| | | | | | | | | | | | 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
* refactor(options): remove `set_string_option_direct()`Famiu Haque2024-03-21
| | | | | | Problem: `set_string_option_direct()` contains a separate codepath specifically for setting string options. Not only is that unnecessary code duplication, but it's also limited to only string options. Solution: Replace `set_string_option_direct()` with `set_option_direct()` which calls `set_option()` under the hood. This reduces code duplication and allows directly setting an option of any type.
* vim-patch:9.1.0177: Coverity reports dead codezeertzjq2024-03-14
| | | | | | | | | | Problem: Coverity reports dead code. Solution: Remove the dead code. Also fix a mistake in ml_get_pos_len() and update some comments (zeertzjq). closes: vim/vim#14189 https://github.com/vim/vim/commit/8c55d60658b7ee3458dca57fc5eec90ca9bb9bf3
* vim-patch:9.1.0172: More code can use ml_get_buf_len() instead of STRLEN()zeertzjq2024-03-14
| | | | | | | | | | | | Problem: More code can use ml_get_buf_len() instead of STRLEN(). Solution: Change more STRLEN() calls to ml_get_buf_len(). Also do not set ml_line_textlen in ml_replace_len() if "has_props" is set, because "len_arg" also includes the size of text properties in that case. (zeertzjq) closes: vim/vim#14183 https://github.com/vim/vim/commit/94b7c3233ef534acc669b3083ed1fe59cf3a090b
* fix(api/buffer): fix handling of viewport of non-current bufferbfredl2024-03-13
| | | | | | | | | | | A lot of functions in move.c only worked for curwin, alternatively took a `wp` arg but still only work if that happens to be curwin. Refactor those that are needed for update_topline(wp) to work for any window. fixes #27723 fixes #27720
* vim-patch:9.1.0156: Make 'wfb' failing to split still report E1513zeertzjq2024-03-11
| | | | | | | | | | | | | | | Problem: may not be clear why failing to split causes an ":Xdo" command to abort if 'wfb' is set. Solution: do not return immediately if win_split fails, so E1513 is still given. Expect both errors in the test. Also fix tests to pass CI. (Sean Dewar) closes: vim/vim#14152 https://github.com/vim/vim/commit/769eb2d0c3614f9ea6fffa82329558f1a4af384f Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
* vim-patch:9.1.0150: Several minor 'winfixbuf' issuesColin Kennedy2024-03-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: several minor 'winfixbuf' issues exist, mostly relating to the quickfix list Solution: address them and adjust tests. Retab and reflow a few things too. (Sean Dewar) Things touched include: - Replace the semsgs with gettext'd emsgs. - Handle window switching in ex_listdo properly, so curbuf and curwin are kept in-sync and trigger autocommands; handle those properly. - Don't change the list entry index in qf_jump_edit_buffer if we fail due to 'wfb' (achieved by returning FAIL; QF_ABORT should only be used if the list was changed). - Make qf_jump_edit_buffer actually switch to prevwin when using `:cXX` commands **outside** of the list window if 'wfb' is set in curwin. Handle autocommands properly in case they mess with the list. NOTE: previously, it seemed to split if 'wfb' was set, but do nothing and fail if prevwin is *valid*. This behaviour seemed strange, and maybe unintentional? Now it aligns more with what's described for the `:cXX` commands in the original PR description when used outside a list window, I think. - In both functions, only consider prevwin if 'wfb' isn't set for it; fallback to splitting otherwise. - Use win_split to split. Not sure if there was a specific reason for using ex_splitview. win_split is simpler and respects modifiers like :vertical that may have been used. Plus, its return value can be checked for setting opened_window in qf code (technically win_split_ins autocmds could immediately close it or change windows, in which the qf code might close some other window on failure; it's already the case elsewhere, though). closes: vim/vim#14142 https://github.com/vim/vim/commit/4bb505e28cac0389561fff78d8bbe0319c2bcf2f Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
* vim-patch:9.1.0149: null pointer member access when accessing 'winfixbuf' ↵Colin Kennedy2024-03-11
| | | | | | | | | | | | | | | property Problem: qf_goto_win_with_qfl_file may check if prevwin has 'winfixbuf' set without checking if it's valid first. Solution: Reverse the condition. Add a test, a modeline, and a missing CheckFeature. (Searn Dewar) closes: vim/vim#14140 https://github.com/vim/vim/commit/5131f224da93f2e042a4b22545ef62b1b2ab8460 Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
* vim-patch:9.1.0147: Cannot keep a buffer focused in a windowColin Kennedy2024-03-11
| | | | | | | | | | | | | | | Problem: Cannot keep a buffer focused in a window (Amit Levy) Solution: Add the 'winfixbuf' window-local option (Colin Kennedy) fixes: vim/vim#6445 closes: vim/vim#13903 https://github.com/vim/vim/commit/215703563757a4464907ead6fb9edaeb7f430bea N/A patch: vim-patch:58f1e5c0893a
* vim-patch:9.1.0113: duplicate code when cleaning undo stackzeertzjq2024-02-16
| | | | | | | | | | | Problem: duplicate code when cleaning undo stack Solution: refactor undo cleanup into a single public function related: vim/vim#13928 https://github.com/vim/vim/commit/9071ed8107244e0c56a16b77d1c28e975cb21dd2 Co-authored-by: Christian Brabandt <cb@256bit.org>
* vim-patch:9.1.0112: Remove undo information, when cleaning quickfix bufferzeertzjq2024-02-16
| | | | | | | | | | | | | Problem: When the quickfix buffer has been modified an autocommand may invalidate the undo stack (kawarimidoll) Solution: When clearing the quickfix buffer, also wipe the undo stack fixes: vim/vim#13905 closes: vim/vim#13928 https://github.com/vim/vim/commit/f0d3d4a42657dca996e790aa829de3c6be7fdb63 Co-authored-by: Christian Brabandt <cb@256bit.org>
* feat(quickfix): support -q - to read 'errorfile' from stdin (#27303)zeertzjq2024-02-02
| | | Note that this only works when stdin is a pipe.
* vim-patch:9.1.0009: Cannot easily get the list of matches (#27028)zeertzjq2024-01-16
| | | | | | | | | | | | | | | | | | | | Problem: Cannot easily get the list of matches Solution: Add the matchstrlist() and matchbufline() Vim script functions (Yegappan Lakshmanan) closes: vim/vim#13766 Omit CHECK_LIST_MATERIALIZE(): it populates a List with numbers only, and there is a check for strings below. https://github.com/vim/vim/commit/f93b1c881a99fa847a1bafa71877d7e16f18e6ef vim-patch:eb3475df0d92 runtime(doc): Replace non-breaking space with normal space (vim/vim#13868) https://github.com/vim/vim/commit/eb3475df0d927a178789cf8e7fc4983932e1cdbe Co-authored-by: Yegappan Lakshmanan <4298407+yegappan@users.noreply.github.com>
* refactor(IWYU): fix headersdundargoc2024-01-11
| | | | | | Remove `export` pramgas from defs headers as it causes IWYU to believe that the definitions from the defs headers comes from main header, which is not what we really want.
* refactor(options): remove `OPT_FREE` (#26963)Famiu Haque2024-01-10
| | | | | | Problem: `OPT_FREE` macro doesn't seem to do anything as `P_ALLOCED` already handles allocations. Solution: Remove `OPT_FREE`.
* refactor: remove redundant struct namesdundargoc2024-01-02
| | | | A struct can be anonymous if only its typedef is used.
* refactor: remove redundant NOLINT commentsdundargoc2024-01-01
|
* refactor: follow style guidedundargoc2023-12-30
|
* refactor: eliminate cyclic includesdundargoc2023-12-20
|
* refactor: use `bool` to represent boolean valuesdundargoc2023-12-19
|
* refactor(options): reduce `findoption()` usageFamiu Haque2023-12-09
| | | | | | Problem: Many places in the code use `findoption()` to access an option using its name, even if the option index is available. This is very slow because it requires looping through the options array over and over. Solution: Use option index instead of name wherever possible. Also introduce an `OptIndex` enum which contains the index for every option as enum constants, this eliminates the need to pass static option names as strings.
* build: don't define FUNC_ATTR_* as empty in headers (#26317)zeertzjq2023-11-30
| | | | | | FUNC_ATTR_* should only be used in .c files with generated headers. Defining FUNC_ATTR_* as empty in headers causes misuses of them to be silently ignored. Instead don't define them by default, and only define them as empty after a .c file has included its generated header.
* refactor: move some constants out of vim_defs.h (#26298)zeertzjq2023-11-29
|
* refactor: fix headers with IWYUdundargoc2023-11-28
|
* refactor: rename types.h to types_defs.hdundargoc2023-11-27
|
* build(IWYU): fix includes for undo_defs.hdundargoc2023-11-27
|
* build(IWYU): fix includes for func_attr.hdundargoc2023-11-27
|
* build(IWYU): replace most private mappings with pragmas (#26247)zeertzjq2023-11-27
|
* vim-patch:9.0.2117: [security] use-after-free in qf_free_items (#26148)zeertzjq2023-11-22
| | | | | | | | | | | | | | Problem: [security] use-after-free in qf_free_items Solution: only access qfpnext, if it hasn't been freed Coverity discovered a possible use-after-free in qf_free_items. When freeing the qfline items, we may access freed memory, when qfp == qfpnext. So only access qfpnext, when it hasn't been freed. https://github.com/vim/vim/commit/567cae2630a51efddc07eacff3b38a295e1f5671 Co-authored-by: Christian Brabandt <cb@256bit.org>
* refactor: enable formatting for ternariesdundargoc2023-11-20
| | | | | | This requires removing the "Inner expression should be aligned" rule from clint as it prevents essentially any formatting regarding ternary operators.
* vim-patch:9.0.1857: [security] heap-use-after-free in is_qf_win()zeertzjq2023-11-17
| | | | | | | | | Problem: heap-use-after-free in is_qf_win() Solution: Check buffer is valid before accessing it https://github.com/vim/vim/commit/fc68299d436cf87453e432daa77b6d545df4d7ed Co-authored-by: Christian Brabandt <cb@256bit.org>
* 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.
* refactor: remove redundant castsdundargoc2023-11-11
|
* fix(diagnostic): check if delete failed in `qf_fill_buffer()` (#25932)voidiz2023-11-08
| | | | | | | When the contents of a quickfix buffer are replaced, there is a chance that deletion of the previous lines fails. This ensures that we don't get stuck in an infinite loop of retrying. Fix #25402