Christian Brabandt
7c71db3a58
patch 9.1.0043: ml_get: invalid lnum when :s replaces visual selection
...
Problem: ml_get: invalid lnum when :s replaces visual selection
(@ropery)
Solution: substitute may decrement the number of lines in a buffer,
so validate, that the bottom lines of the visual selection
stays within the max buffer line
fixes : #13890
closes : #13892
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-01-22 20:12:34 +01:00
Christian Brabandt
d2cc51f9a1
patch 9.1.0011: regexp cannot match combining chars in collection
...
Problem: regexp cannot match combining chars in collection
Solution: Check for combining characters in regex collections for the
NFA and BT Regex Engine
Also, while at it, make debug mode work again.
fixes #10286
closes : #12871
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-01-04 22:54:08 +01:00
Yee Cheng Chin
d25021cf03
patch 9.0.1908: undefined behaviour upper/lower function ptrs
...
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 #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 : #13117
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2023-09-18 19:51:56 +02:00
Christian Brabandt
15cbaae313
patch 9.0.1853: CI error on different signedness in regexp.c
...
Problem: CI error on different signedness in regexp.c
(after patch 9.0.1848)
Solution: Cast strlen() call to int
Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-09-02 22:08:43 +02:00
Christian Brabandt
ced2c7394a
patch 9.0.1848: [security] buffer-overflow in vim_regsub_both()
...
Problem: buffer-overflow in vim_regsub_both()
Solution: Check remaining space
Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-09-02 21:37:04 +02:00
RestorerZ
68ebcee023
patch 9.0.1594: some internal error messages are translated
...
Problem: Some internal error messages are translated.
Solution: Consistently do not translate internal error messages.
(closes #12459 )
2023-05-31 17:12:14 +01:00
Bram Moolenaar
ab9a2d884b
patch 9.0.1532: crash when expanding "~" in substitute causes very long text
...
Problem: Crash when expanding "~" in substitute causes very long text.
Solution: Limit the text length to MAXCOL.
2023-05-09 21:15:30 +01:00
Dominique Pelle
e764d1b421
patch 9.0.1403: unused variables and functions
...
Problem: Unused variables and functions.
Solution: Delete items and adjust #ifdefs. (Dominique Pellé, closes #12145 )
2023-03-12 21:20:59 +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
01105b37a1
patch 9.0.0951: trying every character position for a match is inefficient
...
Problem: Trying every character position for a match is inefficient.
Solution: Use the start position of the match ignoring "\zs".
2022-11-26 11:47:10 +00:00
Bram Moolenaar
c96311b5be
patch 9.0.0950: the pattern "\_s\zs" matches at EOL
...
Problem: The pattern "\_s\zs" matches at EOL.
Solution: Make the pattern "\_s\zs" match at the start of the next line.
(closes #11617 )
2022-11-25 21:13:47 +00:00
dundargoc
c57b5bcd22
patch 9.0.0828: various typos
...
Problem: Various typos.
Solution: Correct typos. (closes #11432 )
2022-11-02 13:30:51 +00:00
Bram Moolenaar
a4e0b9785e
patch 9.0.0634: evaluating "expr" options has more overhead than needed
...
Problem: Evaluating "expr" options has more overhead than needed.
Solution: Use call_simple_func() for 'foldtext', 'includeexpr', 'printexpr',
"expr" of 'spellsuggest', 'diffexpr', 'patchexpr', 'balloonexpr',
'formatexpr', 'indentexpr' and 'charconvert'.
2022-10-01 19:43:52 +01:00
Bram Moolenaar
9781d9c005
patch 9.0.0513: may not be able to use a pattern ad the debug prompt
...
Problem: May not be able to use a pattern ad the debug prompt.
Solution: Temporarily disable the timeout. (closes #11164 )
2022-09-20 13:51:25 +01:00
zeertzjq
abd58d8aee
patch 9.0.0480: cannot use a :def varargs function with substitute()
...
Problem: Cannot use a :def varargs function with substitute().
Solution: Use has_varargs(). (closes #11146 )
2022-09-16 16:06:32 +01:00
zeertzjq
48db5dafec
patch 9.0.0476: varargs does not work for replacement function of substitute()
...
Problem: Varargs does not work for replacement function of substitute().
Solution: Check the varargs flag of the function. (closes #11142 )
2022-09-16 12:10:03 +01:00
Bram Moolenaar
0f61838636
patch 9.0.0282: a nested timout stops the previous timeout
...
Problem: A nested timout stops the previous timeout.
Solution: Ignore any nested timeout.
2022-08-26 21:33:04 +01:00
Bram Moolenaar
f50940531d
patch 9.0.0105: illegal memory access when pattern starts with illegal byte
...
Problem: Illegal memory access when pattern starts with illegal byte.
Solution: Do not match a character with an illegal byte.
2022-07-29 16:22:25 +01:00
Bram Moolenaar
7f9969c559
patch 9.0.0067: cannot show virtual text
...
Problem: Cannot show virtual text.
Solution: Initial changes for virtual text support, using text properties.
2022-07-25 18:13:54 +01:00
Bram Moolenaar
32acf1f1a7
patch 9.0.0047: using freed memory with recursive substitute
...
Problem: Using freed memory with recursive substitute.
Solution: Always make a copy for reg_prev_sub.
2022-07-07 22:20:31 +01:00
Bram Moolenaar
abd56da30b
patch 8.2.5154: still mentioning version8, some cosmetic issues
...
Problem: Still mentioning version8, some cosmetic issues.
Solution: Prefer mentioning version9, cosmetic improvements.
2022-06-23 20:46:27 +01:00
Bram Moolenaar
44ddf19ec0
patch 8.2.5146: memory leak when substitute expression nests
...
Problem: Memory leak when substitute expression nests.
Solution: Use an array of expression results.
2022-06-21 22:15:25 +01:00
Bram Moolenaar
155f2d1451
patch 8.2.5141: using "volatile int" in a signal handler might be wrong
...
Problem: Using "volatile int" in a signal handler might be wrong.
Solution: Use "volatile sig_atomic_t".
2022-06-20 13:38:33 +01:00
Bram Moolenaar
1f30caff8b
patch 8.2.5129: timeout handling is not optimal
...
Problem: Timeout handling is not optimal.
Solution: Avoid setting timeout_flag twice. Adjust the pointer when
stopping the regexp timeout. Adjust variable name.
2022-06-19 14:36:35 +01:00
Bram Moolenaar
616592e081
patch 8.2.5115: search timeout is overrun with some patterns
...
Problem: Search timeout is overrun with some patterns.
Solution: Check for timeout in more places. Make the flag volatile and
atomic. Use assert_inrange() to see what happened.
2022-06-17 15:17:10 +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
Bram Moolenaar
4aaf3e7f4d
patch 8.2.5046: vim_regsub() can overwrite the destination
...
Problem: vim_regsub() can overwrite the destination.
Solution: Pass the destination length, give an error when it doesn't fit.
2022-05-30 20:58:55 +01:00
LemonBoy
f3b4895f27
patch 8.2.4870: Vim9: expression in :substitute is not compiled
...
Problem: Vim9: expression in :substitute is not compiled.
Solution: Use an INSTR instruction if possible. (closes #10334 )
2022-05-05 13:53:03 +01:00
Bram Moolenaar
56dba60216
patch 8.2.4810: missing changes in one file
...
Problem: Missing changes in one file.
Solution: Also change the struct initializers.
2022-04-23 11:03:58 +01:00
Bram Moolenaar
e8a4c0d91f
patch 8.2.4687: "vimgrep /\%v/ *" may cause a crash
...
Problem: "vimgrep /\%v/ *" may cause a crash.
Solution: When compiling the pattern with the old engine fails, restore the
regprog of the new engine instead of leaving it NULL.
(closes #10079 )
2022-04-04 18:14:34 +01:00
kylo252
ae6f1d8b14
patch 8.2.4402: missing parenthesis may cause unexpected problems
...
Problem: Missing parenthesis may cause unexpected problems.
Solution: Add more parenthesis is macros. (closes #9788 )
2022-02-16 19:24:07 +00:00
Bram Moolenaar
424bcae1fb
patch 8.2.4273: the EBCDIC support is outdated
...
Problem: The EBCDIC support is outdated.
Solution: Remove the EBCDIC support.
2022-01-31 14:59:41 +00:00
Bram Moolenaar
44a4d947bb
patch 8.2.4262: some search tests fail
...
Problem: Some search tests fail.
Solution: Use a better way to reject searching for the Visual area.
2022-01-30 17:17:41 +00:00
Bram Moolenaar
679d66c2d2
patch 8.2.4261: accessing invalid memory in a regular expression
...
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.
2022-01-30 16:42:56 +00:00
Bram Moolenaar
d82a47dd04
patch 8.2.4012: error messages are spread out
...
Problem: Error messages are spread out.
Solution: Move the last error messages to errors.h.
2022-01-05 20:24:39 +00:00
Bram Moolenaar
9d00e4a814
patch 8.2.4010: error messages are spread out
...
Problem: Error messages are spread out.
Solution: Move more error messages to errors.h.
2022-01-05 17:49:15 +00:00
Bram Moolenaar
677658ae49
patch 8.2.4008: error messages are spread out
...
Problem: Error messages are spread out.
Solution: Move more error messages to errors.h.
2022-01-05 16:09:06 +00:00
Bram Moolenaar
a6f7929e62
patch 8.2.4005: error messages are spread out
...
Problem: Error messages are spread out.
Solution: Move more error messages to errors.h.
2022-01-04 21:30:47 +00:00
Bram Moolenaar
1d423ef75f
patch 8.2.3987: error messages are spread out
...
Problem: Error messages are spread out.
Solution: Move more error messages to errors.h.
2022-01-02 21:26:16 +00:00
Bram Moolenaar
ac78dd4a35
patch 8.2.3985: error messages are spread out
...
Problem: Error messages are spread out.
Solution: Move more error messages to errors.h.
2022-01-02 19:25:26 +00:00
Bram Moolenaar
4c13e5e676
patch 8.2.3949: using freed memory with /\%V
...
Problem: Using freed memory with /\%V.
Solution: Get the line again after getvvcol().
2021-12-30 14:49:43 +00:00
Bram Moolenaar
851f86b951
patch 8.2.3796: the funcexe_T struct members are not named consistently
...
Problem: The funcexe_T struct members are not named consistently.
Solution: Prefix "fe_" to all the members.
2021-12-13 14:26:44 +00:00
Bram Moolenaar
12f3c1b77f
patch 8.2.3749: error messages are everywhere
...
Problem: Error messages are everywhere.
Solution: Move more error messages to errors.h and adjust the names.
2021-12-05 21:46:34 +00:00
Bram Moolenaar
651fca85c7
patch 8.2.3699: the +title feature adds a lot of #ifdef but little code
...
Problem: The +title feature adds a lot of #ifdef but little code.
Solution: Graduate the +title feature.
2021-11-29 20:39:38 +00:00
Bram Moolenaar
64066b9acd
patch 8.2.3612: using freed memory with regexp using a mark
...
Problem: Using freed memory with regexp using a mark.
Solution: Get the line again after getting the mark position.
2021-11-17 18:22:56 +00:00
Bram Moolenaar
d8e44476d8
patch 8.2.3197: error messages are spread out
...
Problem: Error messages are spread out.
Solution: Move a few more error messages to errors.h.
2021-07-21 22:20:33 +02:00
Bram Moolenaar
e29a27f6f8
patch 8.2.3190: error messages are spread out
...
Problem: Error messages are spread out.
Solution: Move error messages to errors.h and give them a clear name.
2021-07-20 21:07:36 +02:00
K.Takata
eeec254878
patch 8.2.2922: computing array length is done in various ways
...
Problem: Computing array length is done in various ways.
Solution: Use ARRAY_LENGTH everywhere. (Ken Takata, closes #8305 )
2021-06-02 13:28:16 +02:00
Bram Moolenaar
e71c0ebe2c
patch 8.2.2911: pattern "\%V" does not match all of block selection
...
Problem: Pattern "\%V" does not match all of block selection. (Rick Howe)
Solution: Use the value of vi_curswant. (closes #8285 )
2021-05-30 16:43:11 +02:00
Bram Moolenaar
4c13721482
patch 8.2.2784: Vim9: cannot use \=expr in :substitute
...
Problem: Vim9: cannot use \=expr in :substitute.
Solution: Compile the expression into instructions and execute them when
invoked.
2021-04-19 16:48:48 +02:00