vim-patch:7.4.915

Problem:    When removing from 'path' and then adding, a comma may go missing.
            (Malcolm Rowe)
Solution:   Fix the check for P_ONECOMMA. (closes #471)

174674743d
This commit is contained in:
watiko
2016-02-09 14:10:55 +09:00
parent c90c47072f
commit 69e5427be1
3 changed files with 21 additions and 6 deletions

View File

@@ -1676,7 +1676,8 @@ do_set (
if (adding) { if (adding) {
i = (int)STRLEN(origval); i = (int)STRLEN(origval);
// Strip a trailing comma, would get 2. // Strip a trailing comma, would get 2.
if (comma && (flags & P_ONECOMMA) && i > 1 if (comma && i > 1
&& (flags & P_ONECOMMA) == P_ONECOMMA
&& origval[i - 1] == ',' && origval[i - 1] == ','
&& origval[i - 2] != '\\') { && origval[i - 2] != '\\') {
i--; i--;

View File

@@ -373,7 +373,7 @@ static int included_patches[] = {
// 918 NA // 918 NA
// 917 NA // 917 NA
916, 916,
// 915, 915,
// 914, // 914,
// 913 NA // 913 NA
// 912, // 912,

View File

@@ -1,13 +1,27 @@
-- Test if ":options" throws any exception. The options window seems to mess
-- other tests, so restart nvim in the teardown hook
local helpers = require('test.functional.helpers') local helpers = require('test.functional.helpers')
local command, clear = helpers.command, helpers.clear local command, clear = helpers.command, helpers.clear
local source, expect = helpers.source, helpers.expect
describe('options', function() describe('options', function()
setup(clear) setup(clear)
it('is working', function() it('should not throw any exception', function()
command('options') command('options')
end) end)
end) end)
describe('set', function()
setup(clear)
it("should keep two comma when 'path' is changed", function()
source([[
set path=foo,,bar
set path-=bar
set path+=bar
$put =&path]])
expect([[
foo,,bar]])
end)
end)