summaryrefslogtreecommitdiffstats
path: root/src/insexpand.c
AgeCommit message (Collapse)Author
2024-04-02patch 9.1.0254: [security]: Heap buffer overflow when calling complete_add() ↵v9.1.0254zeertzjq
in 'cfu' Problem: [security]: Heap buffer overflow when calling complete_add() in the first call of 'completefunc' Solution: Call check_cursor() after calling 'completefunc' (zeertzjq) closes: #14391 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-03-21patch 9.1.0194: gcc complains about uninitialized varv9.1.0194Christian Brabandt
Problem: gcc complains about uninitialized var (Tony Mechelynck) Solution: initialize to NULL Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-03-21patch 9.1.0193: May leak memory in completion when ga_grow() failsv9.1.0193zeertzjq
Problem: May leak memory in completion when ga_grow() fails. Solution: Free "wca" when ga_grow() fails (zeertzjq). fixes: #14248 closes: #14249 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-03-20patch 9.1.0190: complete_info() returns wrong order of itemsv9.1.0190Girish Palya
Problem: complete_info() returns wrong order of items (after v9.0.2018) Solution: Revert Patch v9.0.2018 (Girish Palya) bug fix: complete_info() gives wrong results 1) complete_info() reverses list of items during <c-p> 2) 'selected' item index is wrong during <c-p> 3) number of items returnd can be wrong Solution: - Decouple 'cp_number' from 'selected' index since they need not be correlated - Do not iterate the list backwards - Add targeted tests Regression introduced by https://github.com/vim/vim/commit/69fb5afb3bc9da24c2fb0eafb0027ba9c6502fc2 Following are unnecessary commits to patch problems from above: https://github.com/vim/vim/commit/fef66301665027f1801a18d796f74584666f41ef https://github.com/vim/vim/commit/daef8c74375141974d61b85199b383017644978c All the tests from above commits are retained though. fixes: #14204 closes: #14241 Signed-off-by: Girish Palya <girishji@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-03-12patch 9.1.0172: More code can use ml_get_buf_len() instead of STRLEN()v9.1.0172zeertzjq
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-03patch 9.1.0147: Cannot keep a buffer focused in a windowv9.1.0147Colin Kennedy
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-02-11patch 9.1.0098: CompletionChanged not triggered when new leader added ↵v9.1.0098glepnir
without matches Problem: CompletionChanged not triggered when new leader added causing no matching item in the completion menu Solution: When completion is active but no items matched still trigger CompletChanged event (glepnir) closes: #13982 Signed-off-by: glepnir <glephunter@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-02-03patch 9.1.0075: insert completion not correct when adding new leaderv9.1.0075glepnir
Problem: insert completion not correct when adding new leader Solution: Reset compl_curr_match to compl_shown_match (glepnir) closes: #13957 Co-authored-by: glepnir <glephunter@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-01-29patch 9.1.0065: Segfault with CompleteChanged autocommandv9.1.0065Christian Brabandt
Problem: Segfault with CompleteChanged autocommand (markonm ) Solution: Test match->cp_prev for being NULL before accessing it closes: #13929 Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-11-12patch 9.0.2102: matchparen highlight not cleared in completion modev9.0.2102Christian Brabandt
Problem: matchparen highlight not cleared in completion mode Solution: Clear matchparen highlighting in completion mode Remove hard-coded hack in insexpand.c to clear the :3match before displaying the completion menu. Add a test for matchparen highlighting. While at it, move all test tests related to the matchparen plugin into a separate test file. closes: #13493 closes: #13524 Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-11-04patch 9.0.2090: complete_info() skips entries with 'noselect'v9.0.2090Christian Brabandt
Problem: complete_info() skips entries with 'noselect' Solution: Check, if first entry is at original text state Unfortunately, Commit daef8c74375141974d61b85199b383017644978c introduced a regression, that when ':set completeopt+=noselect' is set and no completion item has been selected yet, it did not fill the complete_info['items'] list. This happened, because the current match item did not have the CP_ORIGINAL_TEXT flag set and then the cp->prev pointer did point to the original flag item, which caused the following while loop to not being run but being skipped instead. So when the 'noselect' is set, only start with to the previous selection item, if the initial completion item has the CP_ORIGINAL_TEXT flag set, else use the 2nd previous item instead. fixes: #13451 closes: #13452 Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-10-27patch 9.0.2074: Completion menu may be wrongv9.0.2074Christian Brabandt
Problem: Completion menu may be wrong Solution: Check for the original direction of the completion menu, add more tests, make it work with 'noselect' completion: move in right direction when filling completion_info() When moving through the insert completion menu and switching directions, we need to make sure we start at the correct position in the list and move correctly forward/backwards through it, so that we do not skip entries and the selected item points to the correct entry in the list of completion entries generated by the completion_info() function. The general case is this: 1) CTRL-X CTRL-N, we will traverse the list starting from compl_first_match and then go forwards (using the cp->next pointer) through the list (skipping the very first entry, which has the CP_ORIGINAL_TEXT flag set (since that is the empty/non-selected entry 2) CTRL-X CTRL-P, we will traverse the list starting from compl_first_match (which now points to the last entry). The previous entry will have the CP_ORIGINAL_TEXT flag set, so we need to start traversing the list from the second prev pointer. There are in fact 2 special cases after starting the completion menu with CTRL-X: 3) CTRL-N and then going backwards by pressing CTRL-P again. compl_first_match will point to the same entry as in step 1 above, but since compl_dir_foward() has been switched by pressing CTRL-P to backwards we need to pretend to be in still in case 1 and still traverse the list in forward direction using the cp_next pointer 4) CTRL-P and then going forwards by pressing CTRL-N again. compl_first_match will point to the same entry as in step 2 above, but since compl_dir_foward() has been switched by pressing CTRL-N to forwards we need to pretend to be in still in case 2 and still traverse the list in backward direction using the cp_prev pointer For the 'noselect' case however, this is slightly different again. When going backwards, we only need to go one cp_prev pointer back. And resting of the direction works again slightly different. So we need to take the noselect option into account when deciding in which direction to iterate through the list of matches. related: #13402 related: #12971 closes: #13408 Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-10-17patch 9.0.2039: completion shows current word after completion restartv9.0.2039nwounkn
Problem: completion shows current word after completion restart Solution: remove the word being completed after completion restart The word being completed is shown in a completion list after completion restart, because it isn't removed from the current buffer before searching for matches. Also adjust `Test_complete_add_onechar` to match the new behavior. closes: #13349 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: nwounkn <nwounkn@gmail.com>
2023-10-11patch 9.0.2018: complete_info() returns wrong indexv9.0.2018LemonBoy
Problem: complete_info() returns wrong index Solution: Make order of 'info' in completion_info consistent Start the iteration from the same point and follow the same direction as done when assigning the completion numbers. This way we remove the dependence on the completion direction and make the order of 'info' consistent. closes: #12230 closes: #12971 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: LemonBoy <thatlemon@gmail.com>
2023-09-09patch 9.0.1886: Various Typosv9.0.1886Christian Brabandt
Problem: Various Typos Solution: Fix Typos This is a collection of typo related commits. closes: #12753 closes: #13016 Co-authored-by: Adri Verhoef <a3@a3.xs4all.nl> Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: Viktor Szépe <viktor@szepe.net> Co-authored-by: nuid64 <lvkuzvesov@proton.me> Co-authored-by: Meng Xiangzhuo <aumo@foxmail.com> Co-authored-by: Dominique Pellé <dominique.pelle@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-09-03patch 9.0.1858: [security] heap use after free in ins_compl_get_exp()v9.0.1858Christian Brabandt
Problem: heap use after free in ins_compl_get_exp() Solution: validate buffer before accessing it Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-05-20patch 9.0.1571: RedrawingDisabled not used consistentlyv9.0.1571Bram Moolenaar
Problem: RedrawingDisabled not used consistently. Solution: Avoid RedrawingDisabled going negative. Set RedrawingDisabled in win_split_ins(). (closes #11961)
2023-04-22patch 9.0.1479: small source file problems; outdated list of distrib. filesv9.0.1479Bram Moolenaar
Problem: Small source file problems; outdated list of distributed files. Solution: Small updates to source files and list of distributed files.
2023-03-02patch 9.0.1371: ballooneval interferes with Insert completionv9.0.1371zeertzjq
Problem: Ballooneval interferes with Insert completion. Solution: Ignore mouse-move events when completing. (closes #12094, closes #12092)
2023-02-21patch 9.0.1336: functions without arguments are not always declared properlyv9.0.1336Yegappan Lakshmanan
Problem: Functions without arguments are not always declared properly. Solution: Use "(void)" instead of "()". (Yegappan Lakshmanan, closes #12031)
2023-02-20patch 9.0.1330: handling new value of an option has a long "else if" chainv9.0.1330Yegappan Lakshmanan
Problem: Handling new value of an option has a long "else if" chain. Solution: Use a function pointer. (Yegappan Lakshmanan, closes #12015)
2023-01-30patch 9.0.1262: the did_set_string_option function is too longv9.0.1262Yegappan Lakshmanan
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-22patch 9.0.1234: the code style has to be checked manuallyv9.0.1234Bram Moolenaar
Problem: The code style has to be checked manually. Solution: Add basic code style checks in a test. Fix or avoid uncovered problems.
2022-11-15patch 9.0.0885: informational message has an error message numberv9.0.0885Bram Moolenaar
Problem: Informational message has an error message number. Solution: Use a message without an error number. (closes #11530)
2022-10-13patch 9.0.0738: cannot suppress completion "scanning" messagesv9.0.0738=?UTF-8?q?Bj=C3=B6rn=20Linse?=
Problem: Cannot suppress completion "scanning" messages. Solution: Add the "C" flag in 'shortmess'. (Bjorn Linse, closes #11354)
2022-10-04patch 9.0.0657: too many #ifdefsv9.0.0657Martin Tournoij
Problem: Too many #ifdefs. Solution: Graduate the +cmdwin feature. Now the tiny and small builds are equal, drop the small build. (Martin Tournoij, closes #11268)
2022-09-24patch 9.0.0579: using freed memory when 'tagfunc' wipes out bufferv9.0.0579Bram Moolenaar
Problem: Using freed memory when 'tagfunc' wipes out buffer that holds 'complete'. Solution: Make a copy of the option. Make sure cursor position is valid.
2022-09-24patch 9.0.0567: 'completeopt' "longest" is not used for complete()v9.0.0567bfredl
Problem: 'completeopt' "longest" is not used for complete(). Solution: Also use "longest" for complete(). (Bjorn Linse, closes #11206)
2022-09-04patch 9.0.0376: clang warns for dead assignmentsv9.0.0376Yegappan Lakshmanan
Problem: Clang warns for dead assignments. Solution: Adjust the code. (Yegappan Lakshmanan, closes #11048)
2022-09-01patch 9.0.0345: error message for list argument could be clearerv9.0.0345Bram Moolenaar
Problem: Error message for list argument could be clearer. Solution: Include the argument number. (Yegappan Lakshmanan, closes #11027)
2022-08-24patch 9.0.0254: typo in function namev9.0.0254zeertzjq
Problem: Typo in function name. Solution: Rename the function. (closes #10971)
2022-07-28patch 9.0.0102: reading past end of line with insert mode completionv9.0.0102Bram Moolenaar
Problem: Reading past end of line with insert mode completion. Solution: Check text length.
2022-07-23patch 9.0.0063: too many type casts for dict_get functionsv9.0.0063Bram Moolenaar
Problem: Too many type casts for dict_get functions. Solution: Change the key argument from "char_u *" to "char *".
2022-07-23patch 9.0.0060: accessing uninitialized memory when completing long linev9.0.0060Bram Moolenaar
Problem: Accessing uninitialized memory when completing long line. Solution: Terminate string with NUL.
2022-07-15patch 9.0.0054: compiler warning for size_t to int conversionv9.0.0054Bram Moolenaar
Problem: Compiler warning for size_t to int conversion. Solution: Add type cast. (Mike Williams, closes #10741)
2022-07-07patch 9.0.0046: reading past end of completion with duplicate matchv9.0.0046Bram Moolenaar
Problem: Reading past end of completion with duplicate match. Solution: Check string length
2022-07-07patch 9.0.0045: reading past end of completion with a long linev9.0.0045Bram Moolenaar
Problem: Reading past end of completion with a long line and 'infercase' set. Solution: Allocate the string if needed.
2022-07-01patch 9.0.0020: with some completion reading past end of stringv9.0.0020Bram Moolenaar
Problem: With some completion reading past end of string. Solution: Check the length of the string.
2022-06-16patch 8.2.5107: some callers of rettv_list_alloc() check for not OKv8.2.5107Bram Moolenaar
Problem: Some callers of rettv_list_alloc() check for not OK. (Christ van Willegen) Solution: Use "==" instead of "!=" when checking the return value.
2022-05-27patch 8.2.5029: "textlock" is always zerov8.2.5029zeertzjq
Problem: "textlock" is always zero. Solution: Remove "textlock" and rename "textwinlock" to "textlock". (closes #10489)
2022-05-26patch 8.2.5022: 'completefunc'/'omnifunc' error does not end completionv8.2.5022LemonBoy
Problem: 'completefunc'/'omnifunc' error does not end completion. Solution: Check if there was an error or exception. (closes #10486, closes #4218)
2022-05-21patch 8.2.4993: smart/C/lisp indenting is optionalv8.2.4993Bram Moolenaar
Problem: smart/C/lisp indenting is optional, which makes the code more complex, while it only reduces the executable size a bit. Solution: Graduate FEAT_CINDENT, FEAT_SMARTINDENT and FEAT_LISP.
2022-05-09patch 8.2.4928: various white space and cosmetic mistakesv8.2.4928Bram Moolenaar
Problem: Various white space and cosmetic mistakes. Solution: Change spaces to tabs, improve comments.
2022-05-07patch 8.2.4911: the mode #defines are not clearly namedv8.2.4911Bram Moolenaar
Problem: The mode #defines are not clearly named. Solution: Prepend MODE_. Renumber them to put the mapped modes first.
2022-04-09patch 8.2.4723: the ModeChanged autocmd event is inefficientv8.2.4723LemonBoy
Problem: The ModeChanged autocmd event is inefficient. Solution: Avoid allocating memory. (closes #10134) Rename trigger_modechanged() to may_trigger_modechanged().
2022-01-15patch 8.2.4099: Vim9: cannot use Vim9 syntax in mappingv8.2.4099Bram Moolenaar
Problem: Vim9: cannot use Vim9 syntax in mapping. Solution: Add <ScriptCmd> to use the script context for a command.
2022-01-08patch 8.2.4038: various code not used when features are disabledv8.2.4038Dominique Pelle
Problem: Various code not used when features are disabled. Solution: Add #ifdefs. (Dominique Pellé, closes #9491)
2022-01-08patch 8.2.4037: Insert mode completion is insufficiently testedv8.2.4037Yegappan Lakshmanan
Problem: Insert mode completion is insufficiently tested. Solution: Add more tests. Fix uncovered memory leak. (Yegappan Lakshmanan, closes #9489)
2022-01-05patch 8.2.4010: error messages are spread outv8.2.4010Bram Moolenaar
Problem: Error messages are spread out. Solution: Move more error messages to errors.h.
2022-01-05patch 8.2.4008: error messages are spread outv8.2.4008Bram Moolenaar
Problem: Error messages are spread out. Solution: Move more error messages to errors.h.