summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-09-04 21:57:18 +0200
committerBram Moolenaar <Bram@vim.org>2019-09-04 21:57:18 +0200
commita5a7882ea4a21944924b778208e1d54734891033 (patch)
tree4a65d762e9c89943a98f0934f21202c47897f42d /src
parent26262f87770d3a1a68b09a70152d75c2e2ae186f (diff)
patch 8.1.1986: more functions can be used as methodsv8.1.1986
Problem: More functions can be used as methods. Solution: Make textprop functions usable as a method.
Diffstat (limited to 'src')
-rw-r--r--src/evalfunc.c18
-rw-r--r--src/testdir/test_textprop.vim20
-rw-r--r--src/version.c2
3 files changed, 22 insertions, 18 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c
index e14aa0452e..13326e32b9 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -663,15 +663,15 @@ static funcentry_T global_functions[] =
{"prompt_setprompt", 2, 2, FEARG_1, f_prompt_setprompt},
#endif
#ifdef FEAT_TEXT_PROP
- {"prop_add", 3, 3, 0, f_prop_add},
- {"prop_clear", 1, 3, 0, f_prop_clear},
- {"prop_list", 1, 2, 0, f_prop_list},
- {"prop_remove", 1, 3, 0, f_prop_remove},
- {"prop_type_add", 2, 2, 0, f_prop_type_add},
- {"prop_type_change", 2, 2, 0, f_prop_type_change},
- {"prop_type_delete", 1, 2, 0, f_prop_type_delete},
- {"prop_type_get", 1, 2, 0, f_prop_type_get},
- {"prop_type_list", 0, 1, 0, f_prop_type_list},
+ {"prop_add", 3, 3, FEARG_1, f_prop_add},
+ {"prop_clear", 1, 3, FEARG_1, f_prop_clear},
+ {"prop_list", 1, 2, FEARG_1, f_prop_list},
+ {"prop_remove", 1, 3, FEARG_1, f_prop_remove},
+ {"prop_type_add", 2, 2, FEARG_1, f_prop_type_add},
+ {"prop_type_change", 2, 2, FEARG_1, f_prop_type_change},
+ {"prop_type_delete", 1, 2, FEARG_1, f_prop_type_delete},
+ {"prop_type_get", 1, 2, FEARG_1, f_prop_type_get},
+ {"prop_type_list", 0, 1, FEARG_1, f_prop_type_list},
#endif
{"pum_getpos", 0, 0, 0, f_pum_getpos},
{"pumvisible", 0, 0, 0, f_pumvisible},
diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim
index 3d3cce8158..aede59b2d6 100644
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -25,7 +25,7 @@ func Test_proptype_global()
call prop_type_add('one', {})
call assert_equal(1, len(prop_type_list()))
- let proptype = prop_type_get('one')
+ let proptype = 'one'->prop_type_get()
call assert_false(has_key(proptype, 'highlight'))
call assert_equal(0, proptype['priority'])
call assert_equal(0, proptype['start_incl'])
@@ -53,7 +53,7 @@ func Test_proptype_buf()
call assert_equal(1, proptype['end_incl'])
call prop_type_delete('comment', {'bufnr': bufnr})
- call assert_equal(0, len(prop_type_list({'bufnr': bufnr})))
+ call assert_equal(0, len({'bufnr': bufnr}->prop_type_list()))
call prop_type_add('one', {'bufnr': bufnr})
let proptype = prop_type_get('one', {'bufnr': bufnr})
@@ -89,7 +89,7 @@ endfunc
func SetupPropsInFirstLine()
call setline(1, 'one two three')
call prop_add(1, 1, {'length': 3, 'id': 11, 'type': 'one'})
- call prop_add(1, 5, {'length': 3, 'id': 12, 'type': 'two'})
+ eval 1->prop_add(5, {'length': 3, 'id': 12, 'type': 'two'})
call prop_add(1, 9, {'length': 5, 'id': 13, 'type': 'three'})
call prop_add(1, 1, {'length': 13, 'id': 14, 'type': 'whole'})
endfunc
@@ -139,7 +139,7 @@ func Test_prop_remove()
call assert_equal(props, prop_list(1))
" remove by id
- call assert_equal(1, prop_remove({'id': 12}, 1))
+ call assert_equal(1, {'id': 12}->prop_remove(1))
unlet props[2]
call assert_equal(props, prop_list(1))
@@ -344,8 +344,8 @@ func Test_prop_clear()
call SetupPropsInFirstLine()
call assert_equal(Get_expected_props(), prop_list(1))
- call prop_clear(1)
- call assert_equal([], prop_list(1))
+ eval 1->prop_clear()
+ call assert_equal([], 1->prop_list())
call DeletePropTypes()
bwipe!
@@ -489,7 +489,7 @@ func Setup_three_line_prop()
endfunc
func Test_prop_multiline()
- call prop_type_add('comment', {'highlight': 'Directory'})
+ eval 'comment'->prop_type_add({'highlight': 'Directory'})
new
call setline(1, ['xxxxxxx', 'yyyyyyyyy', 'zzzzzzzz'])
@@ -672,11 +672,13 @@ func Test_textprop_screenshot_various()
\ "hi BackgroundProp ctermbg=lightgrey",
\ "hi UnderlineProp cterm=underline",
\ "call prop_type_add('number', {'highlight': 'NumberProp'})",
- \ "call prop_type_add('long', {'highlight': 'LongProp'})",
+ \ "call prop_type_add('long', {'highlight': 'NumberProp'})",
+ \ "call prop_type_change('long', {'highlight': 'LongProp'})",
\ "call prop_type_add('start', {'highlight': 'NumberProp', 'start_incl': 1})",
\ "call prop_type_add('end', {'highlight': 'NumberProp', 'end_incl': 1})",
\ "call prop_type_add('both', {'highlight': 'NumberProp', 'start_incl': 1, 'end_incl': 1})",
- \ "call prop_type_add('background', {'highlight': 'BackgroundProp', 'combine': 1})",
+ \ "call prop_type_add('background', {'highlight': 'NumberProp', 'combine': 1})",
+ \ "eval 'background'->prop_type_change({'highlight': 'BackgroundProp'})",
\ "call prop_type_add('error', {'highlight': 'UnderlineProp', 'combine': 1})",
\ "call prop_add(1, 4, {'end_lnum': 3, 'end_col': 3, 'type': 'long'})",
\ "call prop_add(2, 9, {'length': 3, 'type': 'number'})",
diff --git a/src/version.c b/src/version.c
index b3942694cf..d61b59c47c 100644
--- a/src/version.c
+++ b/src/version.c
@@ -758,6 +758,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1986,
+/**/
1985,
/**/
1984,