summaryrefslogtreecommitdiffstats
path: root/src/testdir
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-12-02 20:46:26 +0000
committerBram Moolenaar <Bram@vim.org>2022-12-02 20:46:26 +0000
commit89469d157aea01513bde826b4519dd6b5fbceae4 (patch)
tree50c505cfc7722e05f227d04f0ce8f4241b7b0448 /src/testdir
parent500c4442834363e02541da564f0b87b82d5783cd (diff)
patch 9.0.0993: display errors when adding or removing text property typev9.0.0993
Problem: Display errors when adding or removing text property type. Solution: Perform a full redraw. Only use text properties for which the type is defined. (closes #11655)
Diffstat (limited to 'src/testdir')
-rw-r--r--src/testdir/dumps/Test_prop_delete_updates_1.dump10
-rw-r--r--src/testdir/dumps/Test_prop_delete_updates_2.dump10
-rw-r--r--src/testdir/dumps/Test_prop_delete_updates_3.dump10
-rw-r--r--src/testdir/test_textprop.vim40
-rw-r--r--src/testdir/test_vim9_builtin.vim4
5 files changed, 71 insertions, 3 deletions
diff --git a/src/testdir/dumps/Test_prop_delete_updates_1.dump b/src/testdir/dumps/Test_prop_delete_updates_1.dump
new file mode 100644
index 0000000000..400824f586
--- /dev/null
+++ b/src/testdir/dumps/Test_prop_delete_updates_1.dump
@@ -0,0 +1,10 @@
+|s+0&#ffffff0|o|m|e| |t|e|x|t| @50
+@3|T+0&#ffd7ff255|h|e| |q|u|i|c|k| |b|r|o|w|n| |f|o|x| |j|u|m|p|s| |o|v|e|r| |t|h|e| |l|a|z|y| |d|o|g| +0&#ffffff0@13
+@5|T+0&#ffd7ff255|h|e| |q|u|i|c|k| |b|r|o|w|n| |f|o|x| |j|u|m|p|s| |o|v|e|r| |t|h|e| |l|a|z|y| |d|o|g| +0&#ffffff0@11
+|m|o|r|e| |t|e|x|t| @50
+>t|h|e| |e|n|d| @52
+|~+0#4040ff13&| @58
+|~| @58
+|~| @58
+|~| @58
+| +0#0000000&@41|3|,|1| @10|A|l@1|
diff --git a/src/testdir/dumps/Test_prop_delete_updates_2.dump b/src/testdir/dumps/Test_prop_delete_updates_2.dump
new file mode 100644
index 0000000000..e7074f529b
--- /dev/null
+++ b/src/testdir/dumps/Test_prop_delete_updates_2.dump
@@ -0,0 +1,10 @@
+|s+0&#ffffff0|o|m|e| |t|e|x|t| @50
+|m|o|r|e| |t|e|x|t| @50
+>t|h|e| |e|n|d| @52
+|~+0#4040ff13&| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+| +0#0000000&@41|3|,|1| @10|A|l@1|
diff --git a/src/testdir/dumps/Test_prop_delete_updates_3.dump b/src/testdir/dumps/Test_prop_delete_updates_3.dump
new file mode 100644
index 0000000000..651ed4b4c4
--- /dev/null
+++ b/src/testdir/dumps/Test_prop_delete_updates_3.dump
@@ -0,0 +1,10 @@
+|s+0&#ffffff0|o|m|e| |t|e|x|t| @50
+>m|o|r|e| |t|e|x|t| @50
+|t|h|e| |e|n|d| @52
+|~+0#4040ff13&| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+| +0#0000000&@41|2|,|1| @10|A|l@1|
diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim
index a84709142b..1d4370331a 100644
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -1700,7 +1700,7 @@ func Test_prop_func_invalid_args()
call assert_fails("call prop_type_delete([])", 'E730:')
call assert_fails("call prop_type_delete('xyz', [])", 'E715:')
call assert_fails("call prop_type_get([])", 'E730:')
- call assert_fails("call prop_type_get('', [])", 'E474:')
+ call assert_fails("call prop_type_get('', [])", 'E475:')
call assert_fails("call prop_type_list([])", 'E715:')
call assert_fails("call prop_type_add('yyy', 'not_a_dict')", 'E715:')
call assert_fails("call prop_add(1, 5, {'type':'missing_type', 'length':1})", 'E971:')
@@ -3627,5 +3627,43 @@ def Test_textprop_in_quickfix_window()
bwipe!
enddef
+func Test_text_prop_delete_updates()
+ CheckRunVimInTerminal
+
+ let lines =<< trim END
+ vim9script
+
+ setline(1, ['some text', 'more text', 'the end'])
+ prop_type_add('test', {highlight: 'DiffChange'})
+ prop_add(1, 0, {
+ type: 'test',
+ text: 'The quick brown fox jumps over the lazy dog',
+ text_align: 'below',
+ text_padding_left: 3,
+ })
+ prop_add(1, 0, {
+ type: 'test',
+ text: 'The quick brown fox jumps over the lazy dog',
+ text_align: 'below',
+ text_padding_left: 5,
+ })
+
+ normal! G
+ END
+ call writefile(lines, 'XtextPropDelete', 'D')
+ let buf = RunVimInTerminal('-S XtextPropDelete', #{rows: 10, cols: 60})
+ call VerifyScreenDump(buf, 'Test_prop_delete_updates_1', {})
+
+ " Check that after deleting the text prop type the text properties using
+ " this type no longer show and are not counted for cursor positioning.
+ call term_sendkeys(buf, ":call prop_type_delete('test')\<CR>")
+ call VerifyScreenDump(buf, 'Test_prop_delete_updates_2', {})
+
+ call term_sendkeys(buf, "ggj")
+ call VerifyScreenDump(buf, 'Test_prop_delete_updates_3', {})
+
+ call StopVimInTerminal(buf)
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/testdir/test_vim9_builtin.vim b/src/testdir/test_vim9_builtin.vim
index 005f89ca13..d85d064df0 100644
--- a/src/testdir/test_vim9_builtin.vim
+++ b/src/testdir/test_vim9_builtin.vim
@@ -3158,13 +3158,13 @@ enddef
def Test_prop_type_add()
v9.CheckDefAndScriptFailure(['prop_type_add({"a": 10}, "b")'], ['E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1174: String required for argument 1'])
v9.CheckDefAndScriptFailure(['prop_type_add("a", "b")'], ['E1013: Argument 2: type mismatch, expected dict<any> but got string', 'E1206: Dictionary required for argument 2'])
- assert_fails("prop_type_add('', {highlight: 'Search'})", 'E474:')
+ assert_fails("prop_type_add('', {highlight: 'Search'})", 'E475:')
enddef
def Test_prop_type_change()
v9.CheckDefAndScriptFailure(['prop_type_change({"a": 10}, "b")'], ['E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1174: String required for argument 1'])
v9.CheckDefAndScriptFailure(['prop_type_change("a", "b")'], ['E1013: Argument 2: type mismatch, expected dict<any> but got string', 'E1206: Dictionary required for argument 2'])
- assert_fails("prop_type_change('', {highlight: 'Search'})", 'E474:')
+ assert_fails("prop_type_change('', {highlight: 'Search'})", 'E475:')
enddef
def Test_prop_type_delete()