mirror of
https://github.com/neovim/neovim.git
synced 2025-10-03 00:18:33 +00:00
vim-patch:7.4.741 #4121
Problem: When using += with ":set" a trailing comma is not recognized.
(Issue 365)
Solution: Don't add a second comma. Add a test. (partly by Christian
Brabandt)
a7b7b1cef9
This commit is contained in:

committed by
Justin M. Keyes

parent
99067b7e56
commit
59ef994f8f
@@ -1673,6 +1673,11 @@ do_set (
|
|||||||
&& *newval != NUL);
|
&& *newval != NUL);
|
||||||
if (adding) {
|
if (adding) {
|
||||||
i = (int)STRLEN(origval);
|
i = (int)STRLEN(origval);
|
||||||
|
// Strip a trailing comma, would get 2.
|
||||||
|
if (comma && i > 1 && origval[i - 1] == ','
|
||||||
|
&& origval[i - 2] != '\\') {
|
||||||
|
--i;
|
||||||
|
}
|
||||||
memmove(newval + i + comma, newval,
|
memmove(newval + i + comma, newval,
|
||||||
STRLEN(newval) + 1);
|
STRLEN(newval) + 1);
|
||||||
memmove(newval, origval, (size_t)i);
|
memmove(newval, origval, (size_t)i);
|
||||||
|
@@ -421,7 +421,7 @@ static int included_patches[] = {
|
|||||||
// 744 NA
|
// 744 NA
|
||||||
// 743,
|
// 743,
|
||||||
// 742,
|
// 742,
|
||||||
// 741,
|
741,
|
||||||
// 740,
|
// 740,
|
||||||
739,
|
739,
|
||||||
// 738 NA
|
// 738 NA
|
||||||
|
15
test/functional/legacy/set_spec.lua
Normal file
15
test/functional/legacy/set_spec.lua
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
-- Tests for :set
|
||||||
|
|
||||||
|
local helpers = require('test.functional.helpers')
|
||||||
|
local clear, execute, eval, eq =
|
||||||
|
helpers.clear, helpers.execute, helpers.eval, helpers.eq
|
||||||
|
|
||||||
|
describe(':set', function()
|
||||||
|
before_each(clear)
|
||||||
|
|
||||||
|
it('recognizes a trailing comma with +=', function()
|
||||||
|
execute('set wildignore=*.png,')
|
||||||
|
execute('set wildignore+=*.jpg')
|
||||||
|
eq('*.png,*.jpg', eval('&wildignore'))
|
||||||
|
end)
|
||||||
|
end)
|
Reference in New Issue
Block a user