mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 11:15:14 -07:00
vim-patch:8.2.2969: subtracting from number option fails when result is zero
Problem: Subtracting from number option fails when result is zero. (Ingo
Karkat)
Solution: Reset the string value when using the numeric value.
(closes vim/vim#8351)
a42e6e0082
Cherry-pick Test_compound_assignment_operators() changes from patch 8.2.1593
This commit is contained in:
parent
963ea726da
commit
d8df9afad6
@ -663,6 +663,7 @@ static char *ex_let_one(char *arg, typval_T *const tv, const bool copy, const bo
|
||||
case '%':
|
||||
n = num_modulus(numval, n); break;
|
||||
}
|
||||
s = NULL;
|
||||
} else if (opt_type == gov_string && stringval != NULL && s != NULL) {
|
||||
// string
|
||||
char *const oldstringval = stringval;
|
||||
|
@ -1661,16 +1661,25 @@ func Test_compound_assignment_operators()
|
||||
call assert_equal(6, &scrolljump)
|
||||
let &scrolljump %= 5
|
||||
call assert_equal(1, &scrolljump)
|
||||
call assert_fails('let &scrolljump .= "j"', 'E734')
|
||||
call assert_fails('let &scrolljump .= "j"', 'E734:')
|
||||
set scrolljump&vim
|
||||
|
||||
let &foldlevelstart = 2
|
||||
let &foldlevelstart -= 1
|
||||
call assert_equal(1, &foldlevelstart)
|
||||
let &foldlevelstart -= 1
|
||||
call assert_equal(0, &foldlevelstart)
|
||||
let &foldlevelstart = 2
|
||||
let &foldlevelstart -= 2
|
||||
call assert_equal(0, &foldlevelstart)
|
||||
|
||||
" Test for register
|
||||
let @/ = 1
|
||||
call assert_fails('let @/ += 1', 'E734')
|
||||
call assert_fails('let @/ -= 1', 'E734')
|
||||
call assert_fails('let @/ *= 1', 'E734')
|
||||
call assert_fails('let @/ /= 1', 'E734')
|
||||
call assert_fails('let @/ %= 1', 'E734')
|
||||
call assert_fails('let @/ += 1', 'E734:')
|
||||
call assert_fails('let @/ -= 1', 'E734:')
|
||||
call assert_fails('let @/ *= 1', 'E734:')
|
||||
call assert_fails('let @/ /= 1', 'E734:')
|
||||
call assert_fails('let @/ %= 1', 'E734:')
|
||||
let @/ .= 's'
|
||||
call assert_equal('1s', @/)
|
||||
let @/ = ''
|
||||
|
Loading…
Reference in New Issue
Block a user