aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/regexp.c
Commit message (Collapse)AuthorAge
...
* refactor: reorganize option header files (#25437)zeertzjq2023-09-30
| | | | | | - Move vimoption_T to option.h - option_defs.h is for option-related types - option_vars.h corresponds to Vim's option.h - option_defs.h and option_vars.h don't include each other
* build(iwyu): add a few more _defs.h mappings (#25435)zeertzjq2023-09-30
|
* refactor(message): smsg_attr -> smsgbfredl2023-09-29
|
* vim-patch:9.0.1908: undefined behaviour upper/lower function ptrs (#25238)zeertzjq2023-09-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: undefined behaviour upper/lower function ptrs Solution: Fix UBSAN error in regexp and simplify upper/lowercase modifier code The implementation of \u / \U / \l / \L modifiers in the substitute command relies on remembering the state by setting function pointers on func_all/func_one in the code. The code signature of `fptr_T` is supposed to return void* (due to C function signatures not being able to return itself due to type recursion), and the definition of the functions (e.g. to_Upper) didn't follow this rule, and so the code tries to cast functions of different signatures, resulting in undefined behavior error under UBSAN in Clang 17. See vim/vim#12745. We could just fix `do_Upper`/etc to just return void*, which would fix the problem. However, these functions actually do not need to return anything at all. It used to be the case that there was only one pointer "func" to store the pointer, which is why the function needs to either return itself or NULL to indicate whether it's a one time or ongoing modification. However, c2c355df6f094cdb9e599fd395a78c14486ec697 (7.3.873) already made that obsolete by introducing `func_one` and `func_all` to store one-time and ongoing operations separately, so these functions don't actually need to return anything anymore because it's implicit whether it's a one-time or ongoing operation. Simplify the code to reflect that. closes: vim/vim#13117 https://github.com/vim/vim/commit/d25021cf036c63d539f845a1ee05b03ea21d61ff Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
* vim-patch:9.0.1848: [security] buffer-overflow in vim_regsub_both() (#25001)zeertzjq2023-09-03
| | | | | | | | | | | | | | | | | Problem: buffer-overflow in vim_regsub_both() Solution: Check remaining space https://github.com/vim/vim/commit/ced2c7394aafdc90fb7845e09b3a3fee23d48cb1 The change to do_sub() looks confusing. Maybe it's an overflow check? Then the crash may not be applicable to Nvim because of different casts. The test also looks confusing. It seems to source itself recursively. Also don't call strlen() twice on evaluation result. N/A patches for version.c: vim-patch:9.0.1849: CI error on different signedness in ex_cmds.c vim-patch:9.0.1853: CI error on different signedness in regexp.c Co-authored-by: Christian Brabandt <cb@256bit.org>
* refactor(memline): distinguish mutating uses of ml_get_buf()bfredl2023-08-24
| | | | | | | | | | | | | | ml_get_buf() takes a third parameters to indicate whether the caller wants to mutate the memline data in place. However the vast majority of the call sites is using this function just to specify a buffer but without any mutation. This makes it harder to grep for the places which actually perform mutation. Solution: Remove the bool param from ml_get_buf(). it now works like ml_get() except for a non-current buffer. Add a new ml_get_buf_mut() function for the mutating use-case, which can be grepped along with the other ml_replace() etc functions which can modify the memline.
* refactor: remove some (const char **) casts (#24423)zeertzjq2023-07-22
|
* vim-patch:8.2.4890: inconsistent capitalization in error messageszeertzjq2023-05-05
| | | | | | | | | Problem: Inconsistent capitalization in error messages. Solution: Make capitalization consistent. (Doug Kearns) https://github.com/vim/vim/commit/cf030578b26460643dca4a40e7f2e3bc19c749aa Co-authored-by: Bram Moolenaar <Bram@vim.org>
* refactor: uncrustifydundargoc2023-04-26
| | | | Notable changes: replace all infinite loops to `while(true)` and remove `int` from `unsigned int`.
* fix(runtime): do not allow breakcheck inside runtime path calculationbfredl2023-04-19
| | | | | | | | | problem: breakcheck might run arbitrary lua code, which might require modules and thus invoke runtime path calculation recursively. solution: Block the use of breakcheck when expanding glob patterns inside 'runtimepath' fixes #23012
* vim-patch:8.2.1049: Vim9: leaking memory when using continuation linezeertzjq2023-04-14
| | | | | | | | | | | | | | | | | | | Problem: Vim9: leaking memory when using continuation line. Solution: Keep a pointer to the continuation line in evalarg_T. Centralize checking for a next command. https://github.com/vim/vim/commit/b171fb179053fa631fec74911b5fb9374cb6a8a1 Omit eval_next_line(): Vim9 script only. vim-patch:8.2.1050: missing change in struct Problem: Missing change in struct. Solution: Add missing change. https://github.com/vim/vim/commit/65a8ed37f7bc61fbe5c612a7b0eb0dfc16ad3e11 Co-authored-by: Bram Moolenaar <Bram@vim.org>
* 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: add const and remove unnecessary casts (#22841)ii142023-04-01
|
* refactor: replace char_u with char 25 (#21838)dundargoc2023-01-19
| | | | | refactor: replace char_u with char Work on https://github.com/neovim/neovim/issues/459
* vim-patch:9.0.1221: code is indented more than necessary (#21891)zeertzjq2023-01-19
| | | | | | | | | Problem: Code is indented more than necessary. Solution: Use an early return where it makes sense. (Yegappan Lakshmanan, closes vim/vim#11833) https://github.com/vim/vim/commit/f97a295ccaa9803367f3714cdefce4e2283c771d Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
* 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 22 (#21786)dundargoc2023-01-17
| | | Work on https://github.com/neovim/neovim/issues/459
* 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
* refactor: replace char_u with char 17 - remove STRLCPY (#21235)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
* refactor: replace char_u with char 16 - remove STRNCMP (#21208)dundargoc2022-12-21
| | | | | refactor: replace char_u with char Work on https://github.com/neovim/neovim/issues/459
* vim-patch:8.2.2295: incsearch does not detect empty pattern properlyzeertzjq2022-12-04
| | | | | | | | Problem: Incsearch does not detect empty pattern properly. Solution: Return magic state when skipping over a pattern. (Christian Brabandt, closes vim/vim#7612, closes vim/vim#6420) https://github.com/vim/vim/commit/d93a7fc1a98a58f8101ee780d4735079ad99ae35
* vim-patch:8.2.4262: some search tests failzeertzjq2022-12-03
| | | | | | | | | Problem: Some search tests fail. Solution: Use a better way to reject searching for the Visual area. https://github.com/vim/vim/commit/44a4d947bbc2c5ddb2908346a7c61ef93b59a3ca Co-authored-by: Bram Moolenaar <Bram@vim.org>
* vim-patch:8.2.4261: accessing invalid memory in a regular expressionzeertzjq2022-12-03
| | | | | | | | | | | | Problem: Accessing invalid memory when a regular expression checks the Visual area while matching in a string. Solution: Do not try matching the Visual area in a string. https://github.com/vim/vim/commit/679d66c2d21dfe03d0f89b9a818b0aaebb4c3b87 Use CheckScriptFailure() instead of v9.CheckScriptFailure(). Co-authored-by: Bram Moolenaar <Bram@vim.org>
* refactor: replace char_u with chardundargoc2022-11-28
| | | | Work on https://github.com/neovim/neovim/issues/459
* Merge pull request #20196 from dundargoc/refactor/char_u/14bfredl2022-11-26
|\ | | | | refactor: replace char_u with char 14: remove `STRLEN` part final
| * refactor: replace char_u with charDundar Göc2022-11-26
| | | | | | | | Work on https://github.com/neovim/neovim/issues/459
* | vim-patch:9.0.0951: trying every character position for a match is ↵zeertzjq2022-11-26
|/ | | | | | | | | | inefficient (#21198) Problem: Trying every character position for a match is inefficient. Solution: Use the start position of the match ignoring "\zs". https://github.com/vim/vim/commit/01105b37a108022515d364201767f7f111ec4222 Co-authored-by: Bram Moolenaar <Bram@vim.org>
* vim-patch:8.2.0260: several lines of code are duplicated (#21108)zeertzjq2022-11-19
| | | | | | | | | Problem: Several lines of code are duplicated. Solution: Move duplicated code to a function. (Yegappan Lakshmanan, closes vim/vim#5330) https://github.com/vim/vim/commit/f4140488c72cad4dbf5449dba099cfa7de7bbb22 Using sizeof seems better than ARRAY_SIZE for vim_snprintf().
* build: allow IWYU to fix includes for all .c filesdundargoc2022-11-15
| | | | | | | | | | Allow Include What You Use to remove unnecessary includes and only include what is necessary. This helps with reducing compilation times and makes it easier to visualise which dependencies are actually required. Work on https://github.com/neovim/neovim/issues/549, but doesn't close it since this only works fully for .c files and not headers.
* refactor: more clint (#20910)Lewis Russell2022-11-07
|
* vim-patch:8.2.4978: no error if engine selection atom is not at the startzeertzjq2022-11-05
| | | | | | | | | Problem: No error if engine selection atom is not at the start. Solution: Give an error. (Christian Brabandt, closes vim/vim#10439) https://github.com/vim/vim/commit/360da40b47a84ee8586c3b5d062f8c64a2ac9cc6 Co-authored-by: Christian Brabandt <cb@256bit.org>
* vim-patch:8.2.4688: new regexp engine does not give an error for "\%v"zeertzjq2022-11-05
| | | | | | | | | Problem: New regexp engine does not give an error for "\%v". Solution: Check for a value argument. (issue vim/vim#10079) https://github.com/vim/vim/commit/91ff3d4f52a55a7c37a52aaad524cd9dd12efae4 Co-authored-by: Bram Moolenaar <Bram@vim.org>
* vim-patch:8.2.0612: Vim9: no check for space before #commentzeertzjq2022-11-05
| | | | | | | | | | | Problem: Vim9: no check for space before #comment. Solution: Add space checks. https://github.com/vim/vim/commit/2c5ed4e3300378ce76c8d9c3818d6f73e5119f68 Omit ends_excmd2(): the same as ends_excmd() in legacy Vim script. Co-authored-by: Bram Moolenaar <Bram@vim.org>
* vim-patch:8.2.0502: Vim9: some code is not testedzeertzjq2022-11-05
| | | | | | | | | Problem: Vim9: some code is not tested. Solution: Add more tests. Fix uncovered problems. https://github.com/vim/vim/commit/e8c4abbbd711af8fd3ed85ea69e9ac3d63a0d879 Co-authored-by: Bram Moolenaar <Bram@vim.org>
* build(lint): remove clint.py rules for braces #20880dundargoc2022-11-01
| | | | | Uncrustify is the source of truth where possible. Remove any redundant checks from clint.py. See also https://github.com/neovim/neovim/pull/18563
* refactor(clint): convert short to int16_t (#20815)dundargoc2022-10-27
|
* vim-patch:9.0.0476: varargs does not work for replacement function of ↵zeertzjq2022-09-16
| | | | | | | substitute() (#20216) Problem: Varargs does not work for replacement function of substitute(). Solution: Check the varargs flag of the function. (closes vim/vim#11142) https://github.com/vim/vim/commit/48db5dafecacced4a9e42de3f92838b2d59beb4c
* vim-patch:8.2.3796: the funcexe_T struct members are not named consistently ↵zeertzjq2022-09-16
| | | | | | | | | (#20214) Problem: The funcexe_T struct members are not named consistently. Solution: Prefix "fe_" to all the members. https://github.com/vim/vim/commit/851f86b951cdd67ad9cf3149e46169d1375c8d82 Omit fe_check_type: always NULL in legacy Vim script.
* refactor: replace char_u with charDundar Göc2022-09-11
| | | | Work on https://github.com/neovim/neovim/issues/459
* refactor: replace char_u with charDundar Göc2022-09-10
| | | | Work on https://github.com/neovim/neovim/issues/459
* refactor: replace char_u with charDundar Göc2022-09-06
| | | | Work on https://github.com/neovim/neovim/issues/459
* refactor: replace char_u with charDundar Göc2022-09-01
| | | | Work on https://github.com/neovim/neovim/issues/459
* refactor: replace char_u with charDundar Göc2022-08-31
| | | | Work on https://github.com/neovim/neovim/issues/459
* refactor: replace char_u with charDundar Göc2022-08-31
| | | | Work on https://github.com/neovim/neovim/issues/459
* refactor: replace char_u with charDundar Göc2022-08-29
| | | | Work on https://github.com/neovim/neovim/issues/459
* refactor(plines): use a struct for chartabsize statebfredl2022-08-29
| | | | | | | | | This is a refactor extracted from vim-patch 9.0.0067: cannot show virtual text The logic for inline virtual text is going to be different in nvim than text property based text in vim, but this refactor is still useful, as calculation of displayed linesize is going to be stateful in a similar way.
* refactor: change pre-decrement/increment to post (#19799)Lewis Russell2022-08-16
| | | Co-authored-by: zeertzjq <zeertzjq@outlook.com>