Merge #9812 from janlazo/vim-8.0.1153

This commit is contained in:
Justin M. Keyes 2019-03-31 16:32:23 +02:00 committed by GitHub
commit 157034bd6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 2 deletions

View File

@ -8008,7 +8008,7 @@ static void f_diff_hlID(typval_T *argvars, typval_T *rettv, FunPtr fptr)
hlID = HLF_CHD; // Changed line.
}
}
rettv->vval.v_number = hlID == (hlf_T)0 ? 0 : (int)hlID;
rettv->vval.v_number = hlID == (hlf_T)0 ? 0 : (int)(hlID + 1);
}
/*

View File

@ -527,7 +527,7 @@ func Test_setting_cursor()
new Xtest2
put =range(1,100)
wq
tabe Xtest2
$
diffsp Xtest1
@ -672,6 +672,35 @@ func Test_diff_filler()
%bwipe!
endfunc
func Test_diff_hlID()
new
call setline(1, [1, 2, 3])
diffthis
vnew
call setline(1, ['1x', 2, 'x', 3])
diffthis
redraw
call assert_equal(synIDattr(diff_hlID(-1, 1), "name"), "")
call assert_equal(diff_hlID(1, 1), hlID("DiffChange"))
call assert_equal(synIDattr(diff_hlID(1, 1), "name"), "DiffChange")
call assert_equal(diff_hlID(1, 2), hlID("DiffText"))
call assert_equal(synIDattr(diff_hlID(1, 2), "name"), "DiffText")
call assert_equal(synIDattr(diff_hlID(2, 1), "name"), "")
call assert_equal(diff_hlID(3, 1), hlID("DiffAdd"))
call assert_equal(synIDattr(diff_hlID(3, 1), "name"), "DiffAdd")
call assert_equal(synIDattr(diff_hlID(4, 1), "name"), "")
wincmd w
call assert_equal(diff_hlID(1, 1), hlID("DiffChange"))
call assert_equal(synIDattr(diff_hlID(1, 1), "name"), "DiffChange")
call assert_equal(synIDattr(diff_hlID(2, 1), "name"), "")
call assert_equal(synIDattr(diff_hlID(3, 1), "name"), "")
%bwipe!
endfunc
func Test_diff_lastline()
enew!
only!