summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2020-01-05 18:21:20 +1100
committerMaxime Coste <mawww@kakoune.org>2020-01-05 18:58:32 +1100
commitb37638dda4531efd5953ec12a0331bcb0876ada3 (patch)
treed2f3359d8152000da18bfcf9218c6f341a7668e5 /test
parent80ffc4d34f2d6a5ae762abc63315699486dafcbe (diff)
Split RegexHighlighters matches per requested buffer ranges
When a region calls the regex highlighter, it is incorrect to share the regex cache as it means we can get matches that span multiple regions. Fixes #3041
Diffstat (limited to 'test')
-rw-r--r--test/regression/3041-invalid-regex-highlight-accross-regions/cmd0
-rw-r--r--test/regression/3041-invalid-regex-highlight-accross-regions/in6
-rw-r--r--test/regression/3041-invalid-regex-highlight-accross-regions/rc5
-rw-r--r--test/regression/3041-invalid-regex-highlight-accross-regions/script7
4 files changed, 18 insertions, 0 deletions
diff --git a/test/regression/3041-invalid-regex-highlight-accross-regions/cmd b/test/regression/3041-invalid-regex-highlight-accross-regions/cmd
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/regression/3041-invalid-regex-highlight-accross-regions/cmd
diff --git a/test/regression/3041-invalid-regex-highlight-accross-regions/in b/test/regression/3041-invalid-regex-highlight-accross-regions/in
new file mode 100644
index 00000000..fbcb3f05
--- /dev/null
+++ b/test/regression/3041-invalid-regex-highlight-accross-regions/in
@@ -0,0 +1,6 @@
+- _foo
+- bar_
+- _baz_
+
+_foo
+bar_
diff --git a/test/regression/3041-invalid-regex-highlight-accross-regions/rc b/test/regression/3041-invalid-regex-highlight-accross-regions/rc
new file mode 100644
index 00000000..888e7f6f
--- /dev/null
+++ b/test/regression/3041-invalid-regex-highlight-accross-regions/rc
@@ -0,0 +1,5 @@
+add-highlighter shared/test regions
+add-highlighter shared/test/base default-region regions
+add-highlighter shared/test/base/base default-region regex _[^_]+_ 0:+b
+add-highlighter shared/test/item region '^- \K' $ ref test/base
+add-highlighter window/ ref test
diff --git a/test/regression/3041-invalid-regex-highlight-accross-regions/script b/test/regression/3041-invalid-regex-highlight-accross-regions/script
new file mode 100644
index 00000000..9a2016c8
--- /dev/null
+++ b/test/regression/3041-invalid-regex-highlight-accross-regions/script
@@ -0,0 +1,7 @@
+ui_out '{ "jsonrpc": "2.0", "method": "set_ui_options", "params": [{}] }'
+ui_out '{ "jsonrpc": "2.0", "method": "draw", "params": [[[{ "face": { "fg": "black", "bg": "white", "attributes": [] }, "contents": "-" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": " _foo\u000a" }], [{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "- bar_\u000a" }], [{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "- " }, { "face": { "fg": "default", "bg": "default", "attributes": ["bold"] }, "contents": "_baz_" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "\u000a" }], [{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "\u000a" }], [{ "face": { "fg": "default", "bg": "default", "attributes": ["bold"] }, "contents": "_foo\u000a" }], [{ "face": { "fg": "default", "bg": "default", "attributes": ["bold"] }, "contents": "bar_" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "\u000a" }]], { "fg": "default", "bg": "default", "attributes": [] }, { "fg": "blue", "bg": "default", "attributes": [] }] }'
+ui_out '{ "jsonrpc": "2.0", "method": "menu_hide", "params": [] }'
+ui_out '{ "jsonrpc": "2.0", "method": "info_hide", "params": [] }'
+ui_out '{ "jsonrpc": "2.0", "method": "draw_status", "params": [[], [{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "out 1:1 " }, { "face": { "fg": "black", "bg": "yellow", "attributes": [] }, "contents": "" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": " " }, { "face": { "fg": "blue", "bg": "default", "attributes": [] }, "contents": "1 sel" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": " - client0@[kak-tests]" }], { "fg": "cyan", "bg": "default", "attributes": [] }] }'
+ui_out '{ "jsonrpc": "2.0", "method": "set_cursor", "params": ["buffer", { "line": 0, "column": 0 }] }'
+ui_out '{ "jsonrpc": "2.0", "method": "refresh", "params": [true] }'