patch 9.2.1188: prop_type_get() does not return the "override" item
Problem: prop_type_get() does not return the "override" item, although
it is documented to return the fields given to prop_type_add().
Solution: Add the "override" item (Hirohito Higashi).
closes: #21497
Assisted-by: Claude
Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
1 parent
21e109b324
commit
c10f972446
3 files changed
+12
-4
No files matched your search
@@ -8,7 +8,7 @@ source util/screendump.vim
|
||||
import './util/vim9.vim' as v9
|
||||
|
||||
func Test_proptype_global()
|
||||
call prop_type_add('comment', {'highlight': 'Directory', 'priority': 123, 'start_incl': 1, 'end_incl': 1})
|
||||
call prop_type_add('comment', {'highlight': 'Directory', 'priority': 123, 'start_incl': 1, 'end_incl': 1, 'override': 1})
|
||||
let proptypes = prop_type_list()
|
||||
call assert_equal(1, len(proptypes))
|
||||
call assert_equal('comment', proptypes[0])
|
||||
@@ -18,6 +18,7 @@ func Test_proptype_global()
|
||||
call assert_equal(123, proptype['priority'])
|
||||
call assert_equal(1, proptype['start_incl'])
|
||||
call assert_equal(1, proptype['end_incl'])
|
||||
call assert_equal(1, proptype['override'])
|
||||
|
||||
call prop_type_delete('comment')
|
||||
call assert_equal(0, len(prop_type_list()))
|
||||
@@ -29,6 +30,7 @@ func Test_proptype_global()
|
||||
call assert_equal(0, proptype['priority'])
|
||||
call assert_equal(0, proptype['start_incl'])
|
||||
call assert_equal(0, proptype['end_incl'])
|
||||
call assert_equal(0, proptype['override'])
|
||||
|
||||
call prop_type_add('two', {})
|
||||
call assert_equal(2, len(prop_type_list()))
|
||||
@@ -40,7 +42,7 @@ endfunc
|
||||
|
||||
func Test_proptype_buf()
|
||||
let bufnr = bufnr('')
|
||||
call prop_type_add('comment', #{bufnr: bufnr, highlight: 'Directory', priority: 123, start_incl: 1, end_incl: 1})
|
||||
call prop_type_add('comment', #{bufnr: bufnr, highlight: 'Directory', priority: 123, start_incl: 1, end_incl: 1, override: 1})
|
||||
let proptypes = prop_type_list({'bufnr': bufnr})
|
||||
call assert_equal(1, len(proptypes))
|
||||
call assert_equal('comment', proptypes[0])
|
||||
@@ -50,6 +52,7 @@ func Test_proptype_buf()
|
||||
call assert_equal(123, proptype['priority'])
|
||||
call assert_equal(1, proptype['start_incl'])
|
||||
call assert_equal(1, proptype['end_incl'])
|
||||
call assert_equal(1, proptype['override'])
|
||||
|
||||
call prop_type_delete('comment', {'bufnr': bufnr})
|
||||
call assert_equal(0, len({'bufnr': bufnr}->prop_type_list()))
|
||||
@@ -60,6 +63,7 @@ func Test_proptype_buf()
|
||||
call assert_equal(0, proptype['priority'])
|
||||
call assert_equal(0, proptype['start_incl'])
|
||||
call assert_equal(0, proptype['end_incl'])
|
||||
call assert_equal(0, proptype['override'])
|
||||
|
||||
call prop_type_add('two', {'bufnr': bufnr})
|
||||
call assert_equal(2, len(prop_type_list({'bufnr': bufnr})))
|
||||
@@ -2200,11 +2204,11 @@ def Test_prop_bufnr_zero()
|
||||
], list)
|
||||
|
||||
assert_equal(
|
||||
{highlight: 'ErrorMsg', end_incl: 0, start_incl: 0, priority: 0, combine: 1},
|
||||
{highlight: 'ErrorMsg', end_incl: 0, start_incl: 0, priority: 0, combine: 1, override: 0},
|
||||
prop_type_get('bufnr-global', {bufnr: list[0].type_bufnr}))
|
||||
|
||||
assert_equal(
|
||||
{highlight: 'StatusLine', end_incl: 0, start_incl: 0, priority: 0, bufnr: bufnr, combine: 1},
|
||||
{highlight: 'StatusLine', end_incl: 0, start_incl: 0, priority: 0, bufnr: bufnr, combine: 1, override: 0},
|
||||
prop_type_get('bufnr-buffer', {bufnr: list[1].type_bufnr}))
|
||||
finally
|
||||
bwipe!
|
||||
|
||||
@@ -2781,6 +2781,8 @@ f_prop_type_get(typval_T *argvars, typval_T *rettv)
|
||||
dict_add_number(d, "priority", prop->pt_priority);
|
||||
dict_add_number(d, "combine",
|
||||
(prop->pt_flags & PT_FLAG_COMBINE) ? 1 : 0);
|
||||
dict_add_number(d, "override",
|
||||
(prop->pt_flags & PT_FLAG_OVERRIDE) ? 1 : 0);
|
||||
dict_add_number(d, "start_incl",
|
||||
(prop->pt_flags & PT_FLAG_INS_START_INCL) ? 1 : 0);
|
||||
dict_add_number(d, "end_incl",
|
||||
|
||||
@@ -743,6 +743,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1188,
|
||||
/**/
|
||||
1187,
|
||||
/**/
|
||||
|
||||
Reference in new issue
Block a user