eval: diff_hlID() and hlID() return same id

This commit is contained in:
Jan Edmund Lazo 2019-03-30 02:27:37 -04:00
parent 1782550bfe
commit f772117b55
2 changed files with 5 additions and 1 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

@ -683,13 +683,17 @@ func Test_diff_hlID()
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"), "")