summaryrefslogtreecommitdiffstats
path: root/src/mbyte.c
AgeCommit message (Collapse)Author
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-02-26patch 9.1.0137: <Del> in cmdline mode doesn't delete composing charsv9.1.0137zeertzjq
Problem: <Del> in cmdline mode doesn't delete composing chars Solution: Use mb_head_off() and mb_ptr2len() (zeertzjq) closes: #14095 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-02-12patch 9.1.0101: upper-case of German sharp s should be U+1E9Ev9.1.0101glepnir
Problem: upper-case of ß should be U+1E9E (CAPITAL LETTER SHARP S) (fenuks) Solution: Make gU, ~ and g~ convert the U+00DF LATIN SMALL LETTER SHARP S (ß) to U+1E9E LATIN CAPITAL LETTER SHARP S (ẞ), update tests (glepnir) This is part of Unicode 5.1.0 from April 2008, so should be fairly safe to use now and since 2017 is part of the German standard orthography, according to Wikipedia: https://en.wikipedia.org/wiki/Capital_%E1%BA%9E#cite_note-auto-12 There is however one exception: UnicodeData.txt for U+00DF LATIN SMALL LETTER SHARP S does NOT define U+1E9E LATIN CAPITAL LETTER SHARP S as its upper case version. Therefore, toupper() won't be able to convert from lower sharp s to upper case sharp s (the other way around however works, since U+00DF is considered the lower case character of U+1E9E and therefore tolower() works correctly for the upper case version). fixes: #5573 closes: #14018 Signed-off-by: glepnir <glephunter@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-02-09patch 9.1.0089: qsort() comparison functions should be transitivev9.1.0089Christian Brabandt
Problem: qsort() comparison functions should be transitive Solution: Do not subtract values, but rather use explicit comparisons Improve qsort() comparison functions There has been a recent report on qsort() causing out-of-bounds read & write in glibc for non transitive comparison functions https://www.qualys.com/2024/01/30/qsort.txt Even so the bug is in glibc's implementation of the qsort() algorithm, it's bad style to just use substraction for the comparison functions, which may cause overflow issues and as hinted at in OpenBSD's manual page for qsort(): "It is almost always an error to use subtraction to compute the return value of the comparison function." So check the qsort() comparison functions and change them to be safe. closes: #13980 Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-01-04patch 9.1.0006: is*() and to*() function may be unsafev9.1.0006Keith Thompson
Problem: is*() and to*() function may be unsafe Solution: Add SAFE_* macros and start using those instead (Keith Thompson) Use SAFE_() macros for is*() and to*() functions The standard is*() and to*() functions declared in <ctype.h> have undefined behavior for negative arguments other than EOF. If plain char is signed, passing an unchecked value from argv for from user input to one of these functions has undefined behavior. Solution: Add SAFE_*() macros that cast the argument to unsigned char. Most implementations behave sanely for negative arguments, and most character values in practice are non-negative, but it's still best to avoid undefined behavior. The change from #13347 has been omitted, as this has already been separately fixed in commit ac709e2fc0db6d31abb7da96f743c40956b60c3a (v9.0.2054) fixes: #13332 closes: #13347 Signed-off-by: Keith Thompson <Keith.S.Thompson@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-10-11patch 9.0.2013: Unicode tables outdatedv9.0.2013Christian Brabandt
Problem: Unicode tables outdated Solution: Update Unicode tables to v15.1 (released 23.09.2023) closes: #13311 Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-09-29patch 9.0.1958: cannot complete option valuesv9.0.1958Yee Cheng Chin
Problem: cannot complete option values Solution: Add completion functions for several options Add cmdline tab-completion for setting string options Add tab-completion for setting string options on the cmdline using `:set=` (along with `:set+=` and `:set-=`). The existing tab completion for setting options currently only works when nothing is typed yet, and it only fills in with the existing value, e.g. when the user does `:set diffopt=<Tab>` it will be completed to `set diffopt=internal,filler,closeoff` and nothing else. This isn't too useful as a user usually wants auto-complete to suggest all the possible values, such as 'iblank', or 'algorithm:patience'. For set= and set+=, this adds a new optional callback function for each option that can be invoked when doing completion. This allows for each option to have control over how completion works. For example, in 'diffopt', it will suggest the default enumeration, but if `algorithm:` is selected, it will further suggest different algorithm types like 'meyers' and 'patience'. When using set=, the existing option value will be filled in as the first choice to preserve the existing behavior. When using set+= this won't happen as it doesn't make sense. For flag list options (e.g. 'mouse' and 'guioptions'), completion will take into account existing typed values (and in the case of set+=, the existing option value) to make sure it doesn't suggest duplicates. For set-=, there is a new `ExpandSettingSubtract` function which will handle flag list and comma-separated options smartly, by only suggesting values that currently exist in the option. Note that Vim has some existing code that adds special handling for 'filetype', 'syntax', and misc dir options like 'backupdir'. This change preserves them as they already work, instead of converting to the new callback API for each option. closes: #13182 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yee Cheng Chin <ychin.git@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-03-07patch 9.0.1391: "clear" macros are not always usedv9.0.1391Yegappan Lakshmanan
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-07patch 9.0.1390: FOR_ALL_ macros are defined in an unexpected filev9.0.1390Yegappan Lakshmanan
Problem: FOR_ALL_ macros are defined in an unexpected file. Solution: Move FOR_ALL_ macros to macros.h. Add FOR_ALL_HASHTAB_ITEMS. (Yegappan Lakshmanan, closes #12109)
2023-01-20patch 9.0.1223: cannot use setcellwidths() below 0x100v9.0.1223K.Takata
Problem: Cannot use setcellwidths() below 0x100. Solution: Also accept characters between 0x80 and 0x100. (Ken Takata, closes #11834)
2023-01-18patch 9.0.1216: Coverity warns for ignoring return valuev9.0.1216Bram Moolenaar
Problem: Coverity warns for ignoring return value. Solution: Break out of loop if function fails.
2023-01-17patch 9.0.1212: cannot read back what setcellwidths() has donev9.0.1212Kota Kato
Problem: Cannot read back what setcellwidths() has done. Solution: Add getcellwidths(). (Kota Kato, closes #11837)
2023-01-14patch 9.0.1196: code is indented more than necessaryv9.0.1196Yegappan Lakshmanan
Problem: Code is indented more than necessary. Solution: Use an early return where it makes sense. (Yegappan Lakshmanan, closes #11813)
2023-01-10patch 9.0.1171: screen is not redrawn after using setcellwidths()v9.0.1171Yasuhiro Matsumoto
Problem: Screen is not redrawn after using setcellwidths(). Solution: Redraw the screen when the cell widths have changed. (Yasuhiro Matsumoto, closes #11800)
2022-11-07patch 9.0.0842: Unicode range for Apple SF symbols is outdatedv9.0.0842Yee Cheng Chin
Problem: Unicode range for Apple SF symbols is outdated. Solution: Update to SF Symbols 4. (Yee Cheng Chin, closes #11474)
2022-10-05patch 9.0.0666: spacing-combining characters handled as composingv9.0.0666Bram Moolenaar
Problem: Spacing-combining characters handled as composing, causing text to take more space than expected. Solution: Handle characters marked with "Mc" not as composing. (closes #11282
2022-09-25patch 9.0.0587: Unicode tables are outdatedv9.0.0587Christian Brabandt
Problem: Unicode tables are outdated. Solution: Update to Unicode release 15. (Christian Brabandt, closes #11220)
2022-09-03patch 9.0.0364: clang static analyzer gives warningsv9.0.0364Yegappan Lakshmanan
Problem: Clang static analyzer gives warnings. Solution: Avoid the warnings. (Yegappan Lakshmanan, closes #11043)
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-16patch 9.0.0220: invalid memory access with for loop over NULL stringv9.0.0220Bram Moolenaar
Problem: Invalid memory access with for loop over NULL string. Solution: Make sure mb_ptr2len() consistently returns zero for NUL.
2022-08-09patch 9.0.0176: checking character options is duplicated and incompletev9.0.0176zeertzjq
Problem: Checking character options is duplicated and incomplete. Solution: Move checking to check_chars_options(). (closes #10863)
2022-07-04patch 9.0.0040: use of set_chars_option() is confusingv9.0.0040Bram Moolenaar
Problem: Use of set_chars_option() is confusing. Solution: Add "apply" argument to store the result or not. Merge similar code.
2022-07-04patch 9.0.0036: 'fillchars' cannot have window-local valuesv9.0.0036Bram Moolenaar
Problem: 'fillchars' cannot have window-local values. Solution: Make 'fillchars' global-local. (closes #5206)
2022-06-09patch 8.2.5073: clang on MS-Windows produces warningsv8.2.5073Bram Moolenaar
Problem: Clang on MS-Windows produces warnings. Solution: Avoid the warnings. (Yegappan Lakshmanan, closes #10546)
2022-05-08patch 8.2.4919: can add invalid bytes with :spellgoodv8.2.4919Bram Moolenaar
Problem: Can add invalid bytes with :spellgood. Solution: Check for a valid word string.
2022-04-11patch 8.2.4736: build problem for Cygwin with Motifv8.2.4736Bram Moolenaar
Problem: Build problem for Cygwin with Motif. Solution: Undefine ControlMask. (Kelvin Lee, closes #10152)
2022-02-22patch 8.2.4439: accepting "iso8859" 'encoding' as "iso-8859-"v8.2.4439Bram Moolenaar
Problem: Accepting "iso8859" 'encoding' as "iso-8859-". Solution: use "iso8859" as "iso-8859-1".
2022-01-02patch 8.2.3987: error messages are spread outv8.2.3987Bram Moolenaar
Problem: Error messages are spread out. Solution: Move more error messages to errors.h.
2022-01-01patch 8.2.3967: error messages are spread outv8.2.3967Bram Moolenaar
Problem: Error messages are spread out. Solution: Move more errors to errors.h.
2021-12-31patch 8.2.3961: error messages are spread outv8.2.3961Bram Moolenaar
Problem: Error messages are spread out. Solution: Move more errors to errors.h.
2021-12-16patch 8.2.3825: various comments could be improvedv8.2.3825Bram Moolenaar
Problem: Various comments could be improved. Solution: Improve the comments.
2021-11-02patch 8.2.3571: some unicode control characters are considered printablev8.2.3571Bram Moolenaar
Problem: Some unicode control characters are considered printable. Solution: Make 0x2060 - 0x2069 not printable.
2021-10-20patch 8.2.3545: setcellwidths() may make 'listchars' or 'fillchars' invalidv8.2.3545zeertzjq
Problem: setcellwidths() may make 'listchars' or 'fillchars' invalid. Solution: Check the value and give an error. (closes #9024)
2021-07-27patch 8.2.3229: Vim9: runtime and compile time type checks are not the samev8.2.3229Yegappan Lakshmanan
Problem: Vim9: runtime and compile time type checks are not the same. Solution: Add more runtime type checks for builtin functions. (Yegappan Lakshmanan, closes #8646)
2021-07-24patch 8.2.3208: dynamic library load error does not mention why it failedv8.2.3208Martin Tournoij
Problem: Dynamic library load error does not mention why it failed. Solution: Add the error message. (Martin Tournoij, closes #8621)
2021-07-10patch 8.2.3139: functions for string manipulation are spread outv8.2.3139Yegappan Lakshmanan
Problem: Functions for string manipulation are spread out. Solution: Move string related functions to a new source file. (Yegappan Lakshmanan, closes #8470)
2021-07-02patch 8.2.3083: crash when passing null string to charclass()v8.2.3083Christian Brabandt
Problem: Crash when passing null string to charclass(). Solution: Bail out when string pointer is NULL. (Christian Brabandt, closes #8498, closes #8260)
2021-06-27patch 8.2.3068: Unicode tables are slightly outdatedv8.2.3068Christian Brabandt
Problem: Unicode tables are slightly outdated. Solution: Update the tables for Unicode release 13. (Christian Brabandt closes #8430)
2021-06-13patch 8.2.2993: 'fileencodings' default value should depend on 'encoding'v8.2.2993Bram Moolenaar
Problem: 'fileencodings' default value should depend on 'encoding'. (Gary Johnson) Solution: When 'encoding' is "utf-8" use a different default value for 'fileencodings'.
2021-06-04patch 8.2.2933: when 'clipboard' is "unnamed" zp does not work correctlyv8.2.2933Bram Moolenaar
Problem: When 'clipboard' is "unnamed" zp and zP do not work correctly. Solution: Pass -1 to str_to_reg() and fix computing the character width instead of using the byte length. (Christian Brabandt, closes #8301, closes #8317)
2021-06-02patch 8.2.2922: computing array length is done in various waysv8.2.2922K.Takata
Problem: Computing array length is done in various ways. Solution: Use ARRAY_LENGTH everywhere. (Ken Takata, closes #8305)
2021-05-31patch 8.2.2915: MS-Windows: when using "default" for encoding utf-8 is usedv8.2.2915K.Takata
Problem: MS-Windows: when using "default" for encoding utf-8 is used. Solution: Use the system encoding. (Ken Takata, closes #8300)
2021-05-30patch 8.2.2912: MS-Windows: most users expect using Unicodev8.2.2912K.Takata
Problem: MS-Windows: most users expect using Unicode. Solution: Default 'encoding' to utf-8 on MS-Windows. (Ken Takata, closes #3907)
2021-04-07patch 8.2.2731: Mac: SF symbols are not displayed properlyv8.2.2731Bram Moolenaar
Problem: Mac: SF symbols are not displayed properly. Solution: Add custom range to list of double-width characters. (Yee Cheng Chin, closes #8077)
2021-03-27patch 8.2.2664: Vim9: not enough function arguments checked for stringv8.2.2664Bram Moolenaar
Problem: Vim9: not enough function arguments checked for string. Solution: Check in balloon functions. Refactor function arguments.
2021-03-22patch 8.2.2646: Vim9: error for not using string doesn't mentionargumentv8.2.2646Bram Moolenaar
Problem: Vim9: error for not using string doesn't mention argument. Solution: Add argument number.
2021-01-10patch 8.2.2326: build error with +eval feature but without +spellv8.2.2326Bram Moolenaar
Problem: Build error with +eval feature but without +spell. Solution: Adjust #ifdef. (John Marriott)
2020-12-09patch 8.2.2117: some functions use any value as a stringv8.2.2117Bram Moolenaar
Problem: Some functions use any value as a string. Solution: Check that the value is a non-empty string.
2020-08-30patch 8.2.1547: various comment problemsv8.2.1547Bram Moolenaar
Problem: Various comment problems. Solution: Update comments.