summaryrefslogtreecommitdiffstats
path: root/src/optionstr.c
AgeCommit message (Collapse)Author
2024-03-01patch 9.1.0146: v:echospace wrong with invalid value of 'showcmdloc'v9.1.0146zeertzjq
Problem: v:echospace wrong after setting invalid value to 'showcmdloc'. Solution: Only call comp_col() if value is valid. (zeertzjq) closes: #14119 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-02-29patch 9.1.0145: v:echospace not correct when 'showcmdloc' != lastv9.1.0145Sam-programs
Problem: the amount of available space (v:echospace) on the command line is not correct when showcmdloc is drawn into the statusline or tabline. Solution: only add SHOWCMD_COLS to the shown command column when 'showcmdloc' is set to last (Sam-programs) closes: #14108 Co-authored-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Sam-programs <130783534+Sam-programs@users.noreply.github.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-02-26patch 9.1.0139: MS-Windows: ligatures map cleared on startupv9.1.0139Erik S. V. Jansson
Problem: MS-Windows: ligatures map cleared on startup Solution: Don't clear the ligatures_map, if the guiligatures option has already been set (Erik S. V. Jansson) If guiligatures is set from a .vimrc it's possible that it will be cleared on start-up (e.g. in Win32 that's what happens). So don't clear the ligatures map if gui_set_ligatures() has already been called (e.g. after setting 'ligatures' from .vimrc) closes: #14094 Signed-off-by: Erik S. V. Jansson <caffeineviking@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-02-24patch 9.1.0133: MS-Windows: ligatures not rendering correctlyv9.1.0133Erik S. V. Jansson
Problem: font ligatures don't render correctly in the Win32 GUI-version of gvim even when set rop=type:directx is used. Setting guiligatures also doesn't make any difference. This leads to broken font ligatures when the cursor passes through them. It does not recover from this, and they remain broken until you re-render the whole buffer (e.g. by using Ctrl+L). Solution: the problem is that we only re-draw the current and previous character in gui_undraw_cursor() and only have the special case for GTK when it comes to rendering ligatures. So let's enable gui_adjust_undraw_cursor_for_ligatures() to also happen for Win32 GUI if guiligatures is setup correctly (all this does is expand the range of gui_undraw_cursor() with ligature characters). related: #9181 related: #12901 closes: #14084 Signed-off-by: Erik S. V. Jansson <caffeineviking@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-02-18patch 9.1.0114: Setting some options may change curswantv9.1.0114zeertzjq
Problem: Setting some options changes curswant unnecessarily. Solution: Add a P_HLONLY flag that prevents changing curswant. (zeertzjq) closes: #14044 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-02-03patch 9.1.0074: did_set_breakat() should be in optionstr.cv9.1.0074zeertzjq
Problem: did_set_breakat() should be in optionstr.c as 'breakat' is a string option. Solution: Move did_set_breakat() to optionstr.c. (zeertzjq) closes: #13958 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-01-17patch 9.1.0039: too vague errors for 'listchars'/'fillchars'v9.1.0039zeertzjq
Problem: too vague errors for 'listchars'/'fillchars' Solution: Include the field name in error message. (zeertzjq) related: neovim/neovim#27050 closes: #13877 Co-authored-by: Cole Frankenhoff <cole.nhf@gmail.com> Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-01-03patch 9.1.0004: reloading colorscheme when not changing 'background'v9.1.0004Gregory Anders
Problem: reloading colorscheme when not changing 'background' Solution: Check, if the background option value actually changed, if not, return early. Only reload colorscheme when bg is changed Currently the highlight groups are re-initialized and the colorscheme (if any) is reloaded anytime 'background' is set, even if it is not changed. This is unnecessary, because if the value was not changed then there is no need to change highlight groups or do anything with the colorscheme. Instead, only reload the colorscheme if the value of 'background' was actually changed. closes: #13700 Signed-off-by: Gregory Anders <greg@gpanders.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-12-19patch 9.0.2175: Compile error with Motif UI + mouse supportv9.0.2176Ken Takata
Problem: Compile error with Motif UI + mouse support (after v9.0.1262) Solution: Use correct oldval option pointer Fix compilation error introduced by 9.0.1262 and found in #13704. closes: #13726 Signed-off-by: Ken Takata <kentkt@csc.jp> Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-12-05patch 9.0.2153: no support to build on OpenVMSv9.0.2153Zoltan Arpadffy
Problem: no support to build on OpenVMS Solution: Add OpenVMS X86_64 platform port closes: #13623 Co-authored-by: errael <errael@raelity.com> Co-authored-by: K.Takata <kentkt@csc.jp> Signed-off-by: Zoltan Arpadffy <zoltan.arpadffy@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-12-05patch 9.0.2150: Using int for errbuflen in option funcsv9.0.2150Mike Williams
Problem: Using int for errbuflen in option funcs Solution: Use size_t for errbuflen in string option functions Use size_t for errbuflen in string option functions This started as size_t to int warning on Windows in do_set_option_string(). Other option setting functions are using size_t for errbuflen so I changed the type in the argument list and then chased further compiler warnings into the string option functions in optionstr.c changing ints to size_t as I went. I also changed the type of os_errbuflen in optset_T to size_t and updated related argument lists in optionstr.c, as well as updating set_string_option() to also use size_t for errbuflen for consistency with other string option setting functions. closes: #13628 Signed-off-by: Mike Williams <mikew@globalgraphics.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-12-01patch 9.0.2142: [security]: stack-buffer-overflow in option callback functionsv9.0.2142Christian Brabandt
Problem: [security]: stack-buffer-overflow in option callback functions Solution: pass size of errbuf down the call stack, use snprintf() instead of sprintf() We pass the error buffer down to the option callback functions, but in some parts of the code, we simply use sprintf(buf) to write into the error buffer, which can overflow. So let's pass down the length of the error buffer and use sprintf(buf, size) instead. Reported by @henices, thanks! Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-10-17patch 9.0.2037: A few remaining cmdline completion issues with C-E/Yv9.0.2037Yee Cheng Chin
Problem: A few remaining cmdline completion issues with C-E/Y Solution: Fix cmdline completion fuzzy/Ctrl-E/Ctrl-Y/options when not used at the end Fix cmdline completion fuzzy/Ctrl-E/Ctrl-Y/options when not used at the end A few places in the cmdline completion code only works properly when the user hits Tab (or 'wildchar') at the end of the cmdline, even though it's supposed to work even in the middle of the line. For fuzzy search, `:e ++ff`, and `:set hl=`, fix completion code to make sure to use `xp_pattern_len` instead of assuming the entire `xp_pattern` is the search pattern (since it contains texts after the cursor). Fix Ctrl-E / Ctrl-Y to not jump to the end when canceling/accepting a wildmenu completion. Also, make them work even when not using `set wildoptions+=pum` as there is no drawback to doing so. (Related issue where this was brought up: #13331) closes: #13362 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2023-10-14patch 9.0.2025: no cmdline completion for ++opt argsv9.0.2025Yee Cheng Chin
Problem: no cmdline completion for ++opt args Solution: Add cmdline completion for :e ++opt=arg and :terminal [++options] closes: #13319 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2023-10-05patch 9.0.1993: warning about unused function definitionv9.0.1993Christian Brabandt
Problem: warning about unused function definition Solution: add ifdefs Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-10-05patch 9.0.1991: no cmdline completion for setting the fontv9.0.1991Yee Cheng Chin
Problem: no cmdline completion for setting the font Solution: enable it on Win32 and GTK builds Add guifont cmdline completion (for Windows and GTK) For Windows, auto-complete will only suggest monospace fonts as that's the only types allowed. Will also suggest font options after the colon, including suggesting the current font size for convenience, and misc charset and quality options like `cANSI` and `qCLEARTYPE`. For GTK, auto-complete will suggest only monospace fonts for `guifont` but will include all fonts for `guifontwide`. The completion code doesn't currently suggest the current font size, as the GTK guifont format does not have a clear delimiter (':' for other platforms). closes: #13264 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2023-10-02patch 9.0.1976: style: space before tab in optionstr.cv9.0.1976Christian Brabandt
Problem: style: space before tab in optionstr.c Solution: remove the space Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-10-02patch 9.0.1973: Clean up cmdline option completion codev9.0.1973Yee Cheng Chin
Problem: Clean up cmdline option completion code Solution: Fix various minor problems - Fix manual array size calculations to just use `ARRAY_LENGTH()`. - Fix unintentional typo in comments due to copy-paste error. - Fix assert_equal() usages to pass the expected value to first parameter instead of 2nd one to avoid confusion. - Fix signed vs unsigned warnings - Correct misplaced comments about set_op_T and set_prefix_T and fix a typo in another comment closes: #13249 closes: #13237 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2023-10-01patch 9.0.1968: cmdline completion should consider key optionv9.0.1968Yee Cheng Chin
Problem: cmdline completion should consider key option Solution: Disable cmdline completion for key option, slightly refactor how P_NO_CMD_EXPAND is handled Harden crypto 'key' option: turn off cmdline completion, disable set-= "set-=" can be used maliciously with a crypto key, as it allows an attacker (who either has access to the computer or a plugin author) to guess a substring by observing the modified state. Simply turn off set+=/-=/^= for this option as there is no good reason for them to be used. Update docs to make that clear as well. Also, don't allow cmdline completion for 'key' as it just shows ***** which is not useful and confusing to the user what it means (if the user accidentally hits enter they will have replaced their key with "*****" instead). Move logic to better location, don't use above 32-bit for flags Move P_NO_CMD_EXPAND to use the unused 0x20 instead of going above 32-bits, as currently the flags parameter is only 32-bits on some systems. Left a comment to warn that future additions will need to change how the flags work either by making it 64-bit or split into two member vars. Also, move the logic for detecting P_NO_CMD_EXPAND earlier so it's not up to each handler to decide, and you won't see the temporary "..." that Vim shows while waiting for completion handler to complete. closes: #13224 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2023-09-30patch 9.0.1960: Make CI checks more strictv9.0.1960Yee Cheng Chin
Problem: Make CI checks more strict Solution: Add -Wstrict-prototypes -Wmissing-prototypes to CI, fix uncovered problems Add -Wstrict-prototypes -Wmissing-prototypes warnings check to CI Add two new warnings to CI, silence some Perl related build-warnings: - `strict-prototypes` helps prevent declaring a function with an empty argument list, e.g. `int func()`. In C++, that's equivalent to `int func(void)`, but in C, that means a function that can take any number of arguments which is rarely what we want. - `missing-prototypes` makes sure we use `static` for file-only internal functions. Non-static functions should have been declared on a prototype file. - Add `no-compound-token-split-by-macro` to the perl cflags, since it throws out a bunch of perl-related warnings that make the CI log unnecessary verbose and hard to read. This seems to happen only with clang 12 and above. When applying those changes, it already uncovered a few warnings, so fix up the code as well (fix prototypes, make the code static, remove shadowed var declaration) GTK header needs to have #pragma warning suppressiong because GTK2 headers will warn on `-Wstrict-prototypes`, and it's included by gui.h and so we can't just turn off the warning in a couple files. closes: #13223 closes: #13226 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
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-29patch 9.0.1957: termcap options should change when setting keyprotocolv9.0.1957Gregory Anders
Problem: termcap options should change on keyprotocol setting Solution: Apply termcap entries when 'keyprotocol' changes When the 'keyprotocol' option was set after startup (including in a user's .vimrc) the termcap entries associated with the matching protocol were not applied. Thus, setting the option has no affect. When 'keyprotocol' is changed it should also update the termcap entries. closes: #13211 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Gregory Anders <greg@gpanders.com>
2023-09-21patch 9.0.1924: LSP server message still wrongly handled (after 9.0.1922)v9.0.1924Yegappan Lakshmanan
Problem: LSP server message still wrongly handled (after 9.0.1922) Solution: Handle 'method' messages properly, don't discard them, add tests. closes: #13141 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-09-20patch 9.0.1921: not possible to use the jumplist like a stackv9.0.1921Yegappan Lakshmanan
Problem: not possible to use the jumplist like a stack Solution: Add the 'jumpoptions' setting to make the jumplist a stack. Add an option for using jumplist like tag stack related: #7738 closes: #13134 ported from NeoVim: - https://neovim.io/doc/user/motion.html#jumplist-stack - neovim/neovim@39094b3 - neovim/neovim#11530 - https://vi.stackexchange.com/questions/18344/how-to-change-jumplist-behavior Based on the feedback in the previous PR, it looks like many people like this option. Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com> Co-authored-by: butwerenotthereyet <58348703+butwerenotthereyet@users.noreply.github.com>
2023-08-11patch 9.0.1687: mapset() not properly handling script IDv9.0.1687zeertzjq
Problem: mapset() not properly handling script ID Solution: replace_termcodes() may accept a script ID closes: #12699 closes: #12697 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2023-06-27patch 9.0.1669: Crash syncing swapfile in new buffer when using sodium cryptv9.0.1669Christian Brabandt
Problem: Crash syncing swapfile in new buffer when using sodium crypt. (James McCoy) Solution: Add checks for sodium encryption. (Christian Brabandt, closes #12591, closes #12585)
2023-05-31patch 9.0.1594: some internal error messages are translatedv9.0.1594RestorerZ
Problem: Some internal error messages are translated. Solution: Consistently do not translate internal error messages. (closes #12459)
2023-05-11patch 9.0.1540: reverse() on string doesn't work in compiled functionv9.0.1540Yegappan Lakshmanan
Problem: reverse() on string doesn't work in compiled function. Solution: Accept string in argument type check. (Yegappan Lakshmanan, closes #12377)
2023-04-23patch 9.0.1481: decrypting with libsodium may fail if the library changesv9.0.1481Christian Brabandt
Problem: Decrypting with libsodium may fail if the library changes. Solution: Add parameters used to the encrypted file header. (Christian Brabandt, closes #12279)
2023-03-12patch 9.0.1403: unused variables and functionsv9.0.1403Dominique Pelle
Problem: Unused variables and functions. Solution: Delete items and adjust #ifdefs. (Dominique Pellé, closes #12145)
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-04patch 9.0.1379: functions for handling options are not orderedv9.0.1379Yegappan Lakshmanan
Problem: Functions for handling options are not ordered. Solution: Put functions in alphabetical order. (Yegappan Lakshmanan, closes #12101)
2023-03-03patch 9.0.1374: function for setting options not used consistentlyv9.0.1374Yegappan Lakshmanan
Problem: Function for setting options not used consistently. Solution: Use a function for 'encoding' and terminal options. (Yegappan Lakshmanan, closes #12099)
2023-03-02patch 9.0.1369: still some "else if" constructs for setting optionsv9.0.1369Yegappan Lakshmanan
Problem: Still some "else if" constructs for setting options. Solution: Add a few more functions for handling options. (Yegappan Lakshmanan, closes #12090)
2023-03-01patch 9.0.1366: functions for setting options are in random orderv9.0.1366Yegappan Lakshmanan
Problem: Functions for setting options are in random order. Solution: Sort functions alphabetically. (Yegappan Lakshmanan, closes #12082)
2023-02-27patch 9.0.1359: too many "else if" statements in handling optionsv9.0.1359Yegappan Lakshmanan
Problem: Too many "else if" statements in handling options. Solution: Add more functions for handling option changes. (Yegappan Lakshmanan, closes #12060)
2023-02-25patch 9.0.1353: too many "else if" statements to handle option valuesv9.0.1353Yegappan Lakshmanan
Problem: Too many "else if" statements to handle option values. Solution: Add more functions to handle option value changes. (Yegappan Lakshmanan, closes #12058)
2023-02-23patch 9.0.1345: too many "else if" statements for handling optionsv9.0.1345Yegappan Lakshmanan
Problem: Too many "else if" statements for handling options. Solution: Add more functions to handle options. (Yegappan Lakshmanan, closes #12051)
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-02-15patch 9.0.1313: some settings use the current codepage instead of 'encoding'v9.0.1313K.Takata
Problem: Some settings use the current codepage instead of 'encoding'. Solution: Adjust how options are initialized. (Ken Takata, closes #11992)
2023-02-13patch 9.0.1307: setting 'formatoptions' with :let doesn't check for errorsv9.0.1307Yegappan Lakshmanan
Problem: Setting 'formatoptions' with :let doesn't check for errors. Solution: Pass "errbuf" to set_string_option(). (Yegappan Lakshmanan, closes #11974, closes #11972)
2023-02-11patch 9.0.1300: 'statusline' only supports one "%=" itemv9.0.1300Yegappan Lakshmanan
Problem: 'statusline' only supports one "%=" item. Solution: Add support for multiple "%=" items. (TJ DeVries, Yegappan Lakshmanan, closes #11970, closes #11965)
2023-02-02patch 9.0.1275: the code for setting options is too complicatedv9.0.1275Yegappan Lakshmanan
Problem: The code for setting options is too complicated. Solution: Refactor the do_set() function. (Yegappan Lakshmanan, Lewis Russell, closes #11932)
2023-01-31patch 9.0.1267: the did_set_string_option function is too longv9.0.1267Yegappan Lakshmanan
Problem: The did_set_string_option function is too long. Solution: Further cleanup of handling string options. (Yegappan Lakshmanan, Lewis Russell, closes #11920)
2023-01-30patch 9.0.1264: Motif: compiler warning for unused argumentv9.0.1264Bram Moolenaar
Problem: Motif: compiler warning for unused argument. Solution: Add "UNUSED".
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-28patch 9.0.1255: changing 'virtualedit' does not have immediate effectv9.0.1255Bram Moolenaar
Problem: Changing 'virtualedit' does not have immediate effect. Solution: Correct how is checked for a changed value. (closes #11878)
2023-01-25patch 9.0.1243: :setglobal cannot use script-local function for "expr" optionv9.0.1243zeertzjq
Problem: :setglobal cannot use script-local function for "expr" option. Solution: Use the pointer to the option value properly. (closes #11883)
2023-01-16patch 9.0.1208: code is indented more than necessaryv9.0.1208Yegappan Lakshmanan
Problem: Code is indented more than necessary. Solution: Use an early return where it makes sense. (Yegappan Lakshmanan, closes #11819)