1
0
forked from aniani/vim

471 Commits

Author SHA1 Message Date
John Marriott
8c85a2a49a
patch 9.1.0426: too many strlen() calls in search.c
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: #14796

Signed-off-by: John Marriott <basilisk@internode.on.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-05-20 19:18:26 +02:00
zeertzjq
c7a8eb5ff2
patch 9.1.0397: Wrong display with 'smoothscroll' when changing quickfix list
Problem:  Wrong display with 'smoothscroll' when changing quickfix list.
Solution: Reset w_skipcol when replacing quickfix list (zeertzjq).

closes: #14730

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-05-08 20:22:40 +02:00
zeertzjq
5bf6c2117f
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
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: #14344

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-03-31 18:41:27 +02:00
zeertzjq
8c55d60658
patch 9.1.0177: Coverity reports dead code
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: #14189

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-03-13 20:42:26 +01:00
zeertzjq
94b7c3233e
patch 9.1.0172: More code can use ml_get_buf_len() instead of STRLEN()
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: #14183

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-03-12 21:50:32 +01:00
Sean Dewar
769eb2d0c3
patch 9.1.0156: Make 'wfb' failing to split still report E1513
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: #14152

Signed-off-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-03-07 21:38:21 +01:00
Sean Dewar
4bb505e28c
patch 9.1.0150: Several minor 'winfixbuf' issues
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: #14142

Signed-off-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-03-05 20:39:07 +01:00
Sean Dewar
5131f224da
patch 9.1.0149: null pointer member access when accessing 'winfixbuf' 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: #14140

Signed-off-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-03-04 19:09:26 +01:00
Colin Kennedy
2157035637
patch 9.1.0147: Cannot keep a buffer focused in a window
Problem:  Cannot keep a buffer focused in a window
          (Amit Levy)
Solution: Add the 'winfixbuf' window-local option
          (Colin Kennedy)

fixes:  #6445
closes: #13903

Signed-off-by: Colin Kennedy <colinvfx@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-03-03 16:16:47 +01:00
Christian Brabandt
9071ed8107
patch 9.1.0113: duplicate code when cleaning undo stack
Problem:  duplicate code when cleaning undo stack
Solution: refactor undo cleanup into a single public function

related: #13928

Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-02-15 20:17:37 +01:00
Christian Brabandt
f0d3d4a426
patch 9.1.0112: Remove undo information, when cleaning quickfix buffer
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: #13905
closes: #13928

Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-02-15 20:15:04 +01:00
Christian Brabandt
567cae2630
patch 9.0.2117: [security] use-after-free in qf_free_items
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.

Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-11-21 19:52:12 +01:00
zeertzjq
b0221819f3
patch 9.0.2073: typo in quickfix.c comments
Problem:  typo in quickfix.c comments
Solution: fix them

closes: #13422

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2023-10-26 23:15:44 +02:00
Yegappan Lakshmanan
b731800522
patch 9.0.2064: cannot use buffer-number for errorformat
Problem:  cannot use buffer-number for errorformat
Solution: add support for parsing a buffer number using '%b' in
          'errorformat'

closes: #13419

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-10-25 20:50:28 +02:00
Christian Brabandt
fc68299d43
patch 9.0.1857: [security] heap-use-after-free in is_qf_win()
Problem:  heap-use-after-free in is_qf_win()
Solution: Check buffer is valid before accessing it

Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-09-03 20:20:52 +02:00
Yegappan Lakshmanan
d4e4ecbb37
patch 9.0.1795: Indentation issues
Problem:  Indentation issues
Solution: Fix code indentation issues.

closes: #12906

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-08-27 18:35:45 +02:00
Tom Praschan
ca6ac99077
patch 9.0.1688: cannot store custom data in quickfix list
Problem: cannot store custom data in quickfix list
Solution: add `user_data` field for the quickfix list

closes: #11818

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Tom Praschan <13141438+tom-anders@users.noreply.github.com>
2023-08-11 23:26:12 +02:00
Shane Harper
5bf042810b patch 9.0.1616: quickfix text field is truncated
Problem:    Quickfix text field is truncated.
Solution:   Fix output of text field after pattern field in quickfix buffer.
            (Shane Harper, closes #12498)
2023-06-07 19:09:57 +01:00
Bram Moolenaar
caf642c25d patch 9.0.1499: using uninitialized memory with fuzzy matching
Problem:    Using uninitialized memory with fuzzy matching.
Solution:   Initialize the arrays used to store match positions.
2023-04-29 21:38:04 +01:00
Yegappan Lakshmanan
960dcbd098 patch 9.0.1391: "clear" macros are not always used
Problem:    "clear" macros are not always used.
Solution:   Use ALLOC_ONE, VIM_CLEAR, CLEAR_POINTER and CLEAR_FIELD in more
            places. (Yegappan Lakshmanan, closes #12104)
2023-03-07 17:45:11 +00:00
Yegappan Lakshmanan
a23a11b5bf patch 9.0.1336: functions without arguments are not always declared properly
Problem:    Functions without arguments are not always declared properly.
Solution:   Use "(void)" instead of "()". (Yegappan Lakshmanan, closes #12031)
2023-02-21 14:27:41 +00:00
Yegappan Lakshmanan
af93691b53 patch 9.0.1330: handling new value of an option has a long "else if" chain
Problem:    Handling new value of an option has a long "else if" chain.
Solution:   Use a function pointer. (Yegappan Lakshmanan, closes #12015)
2023-02-20 12:16:39 +00:00
Yegappan Lakshmanan
f2e30d0c44 patch 9.0.1262: the did_set_string_option function is too long
Problem:    The did_set_string_option function is too long.
Solution:   Split off functionality to individual functions.  (Yegappan
            Lakshmanan, Lewis Russell, closes #11904)
2023-01-30 13:04:42 +00:00
Bram Moolenaar
ebfec1c531 patch 9.0.1234: the code style has to be checked manually
Problem:    The code style has to be checked manually.
Solution:   Add basic code style checks in a test.  Fix or avoid uncovered
            problems.
2023-01-22 21:14:53 +00:00
Yegappan Lakshmanan
f97a295cca patch 9.0.1221: code is indented more than necessary
Problem:    Code is indented more than necessary.
Solution:   Use an early return where it makes sense. (Yegappan Lakshmanan,
            closes #11833)
2023-01-18 18:17:48 +00:00
Bram Moolenaar
c96b7f5d2a patch 9.0.0990: callback name argument is changed by setqflist()
Problem:    Callback name argument is changed by setqflist().
Solution:   Use the expanded function name for the callback, do not store it
            in the argument. (closes #11653)
2022-12-02 15:58:38 +00:00
Bram Moolenaar
84497cd06f patch 9.0.0967: leaking memory from autocmd windows
Problem:    Leaking memory from autocmd windows.
Solution:   Free window when auc_win is not NULL.
2022-11-28 20:34:52 +00:00
Bram Moolenaar
e76062c078 patch 9.0.0965: using one window for executing autocommands is insufficient
Problem:    Using one window for executing autocommands is insufficient.
Solution:   Use up to five windows for executing autocommands.
2022-11-28 18:51:43 +00:00
Bram Moolenaar
2f7bfe66a1 patch 9.0.0870: get E967 when using text property in quickfix window
Problem:    Get E967 when using text property in quickfix window. (Sergey
            Vlasov)
Solution:   Do not add an extra NUL and compute the text length correctly.
            (closes #11513)
2022-11-13 12:54:50 +00:00
Bram Moolenaar
d0fab10ed2 patch 9.0.0805: filetype autocmd may cause freed memory access
Problem:    Filetype autocmd may cause freed memory access.
Solution:   Set the quickfix-busy flag while filling the buffer.
2022-10-20 16:03:33 +01:00
Yegappan Lakshmanan
d8cd6f7427 patch 9.0.0770: quickfix commands may keep memory allocated
Problem:    Quickfix commands may keep memory allocated.
Solution:   Free memory when it's a bit much. (Yegappan Lakshmanan,
            closes #11379)
2022-10-16 11:30:48 +01:00
Yegappan Lakshmanan
975a665d48 patch 9.0.0749: alloc/free of buffer for each quickfix entry is inefficient
Problem:    Alloc/free of buffer for each quickfix entry is inefficient.
Solution:   Use a shared grow array. (Yegappan Lakshmanan, closes #11365)
2022-10-14 13:11:13 +01:00
Yegappan Lakshmanan
f8412c9d7c patch 9.0.0736: quickfix listing does not handle very long messages
Problem:    Quickfix listing does not handle very long messages.
Solution:   Use a growarray instead of a fixed size buffer. (Yegappan
            Lakshmanan, closes #11357)
2022-10-13 11:59:22 +01:00
Bram Moolenaar
4f1b083be4 patch 9.0.0322: crash when no errors and 'quickfixtextfunc' is set
Problem:    Crash when no errors and 'quickfixtextfunc' is set.
Solution:   Do not handle errors if there aren't any.
2022-08-29 20:45:16 +01:00
Yegappan Lakshmanan
6d24a51b94 patch 9.0.0286: using freed memory when location list changed in autocmd
Problem:    Using freed memory when location list changed in autocmd.
Solution:   Return QF_ABORT and handle it. (Yegappan Lakshmanan,
            closes #10993)
2022-08-27 20:59:57 +01:00
Bram Moolenaar
d6c67629ed patch 9.0.0260: using freed memory when using 'quickfixtextfunc' recursively
Problem:    Using freed memory when using 'quickfixtextfunc' recursively.
Solution:   Do not allow for recursion.
2022-08-24 20:07:22 +01:00
Bram Moolenaar
a4d158b3c8 patch 9.0.0206: redraw flags are not named specifically
Problem:    Redraw flags are not named specifically.
Solution:   Prefix "UPD_" to the flags, for UPDate_screen().
2022-08-14 14:17:45 +01:00
Mike Williams
ab146dac6b patch 9.0.0129: compiler warning for int/size_t usage
Problem:    Compiler warning for int/size_t usage.
Solution:   Add a type cast. (Mike Williams, closes #10830)
2022-08-01 14:00:31 +01:00
Bram Moolenaar
5f30e26f69 patch 9.0.0097: long quickfix line is truncated for :clist
Problem:    Long quickfix line is truncated for :clist.
Solution:   Allocate a buffer if needed.
2022-07-28 11:56:01 +01:00
Bram Moolenaar
d61efa50f8 patch 9.0.0063: too many type casts for dict_get functions
Problem:    Too many type casts for dict_get functions.
Solution:   Change the key argument from "char_u *" to "char *".
2022-07-23 09:52:04 +01:00
Paul Ollis
6574577cac patch 8.2.5057: using gettimeofday() for timeout is very inefficient
Problem:    Using gettimeofday() for timeout is very inefficient.
Solution:   Set a platform dependent timer. (Paul Ollis, closes #10505)
2022-06-05 16:55:54 +01:00
=?UTF-8?q?Dundar=20G=C3=B6c?=
dd41037552 patch 8.2.4958: a couple conditions are always true
Problem:    A couple conditions are always true.
Solution:   Remove the conditions. (Goc Dundar, closes #10428)
2022-05-15 13:59:11 +01:00
Bram Moolenaar
31e5c60a68 patch 8.2.4753: error from setting an option is silently ignored
Problem:    Error from setting an option is silently ignored.
Solution:   Handle option value errors better.  Fix uses of N_().
2022-04-15 13:53:33 +01:00
=?UTF-8?q?Dundar=20G=C3=B6c?=
b836658a04 patch 8.2.4750: small pieces of dead code
Problem:    Small pieces of dead code.
Solution:   Remove the dead code. (Goc Dundar, closes #10190) Rename the
            qftf_cb struct member to avoid confusion.
2022-04-14 20:43:56 +01:00
Yegappan Lakshmanan
4829c1c9e9 patch 8.2.4683: verbose check with dict_find() to see if a key is present
Problem:    Verbose check with dict_find() to see if a key is present.
Solution:   Add dict_has_key(). (Yegappan Lakshmanan, closes #10074)
2022-04-04 15:16:54 +01:00
Bram Moolenaar
b4ad3b0dea patch 8.2.4649: various formatting problems
Problem:    Various formatting problems.
Solution:   Improve the code formatting.
2022-03-30 10:57:45 +01:00
Yegappan Lakshmanan
df1bbea436 patch 8.2.4512: the find_tags_in_file() function is much too long
Problem:    The find_tags_in_file() function is much too long.
Solution:   Refactor into multiple smaller functions. (Yegappan Lakshmanan,
            closes #9892)
2022-03-05 14:35:12 +00:00
Yegappan Lakshmanan
2f87a99b6e patch 8.2.4494: the find_tags() function is much too long
Problem:    The find_tags() function is much too long.
Solution:   Refactor the function. (Yegappan Lakshmanan, closes #9869)
2022-03-02 20:29:35 +00:00
Yegappan Lakshmanan
5a2d4a3ecb patch 8.2.4474: memory allocation failures not tested in quickfix code
Problem:    Memory allocation failures not tested in quickfix code.
Solution:   Add alloc IDs and tests. (Yegappan Lakshmanan, closes #9848)
2022-02-26 10:31:32 +00:00
Yegappan Lakshmanan
9c9be05b17 patch 8.2.4462: not enough testing for quickfix code
Problem:    Not enough testing for quickfix code.
Solution:   Add more tests. Fix uncovered problem. (Yegappan Lakshmanan,
            closes #9839)
2022-02-24 12:33:17 +00:00