diff options
| author | Maxime Coste <mawww@kakoune.org> | 2020-10-12 12:14:01 +1100 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2020-10-12 12:41:21 +1100 |
| commit | 246a32797a17e7cdebcde64ac98c09501d1da10d (patch) | |
| tree | 070a743669449d9b35605abc707dee727bb65d56 /test | |
| parent | 600be827b378444ed548492328a041a0b5154a70 (diff) | |
Fix region regexes incorrectly matching ^$ at end of line
Because no flags were set for regex matching, the regex engine was
assuming that the subject string past-the-end matched a end-of-line.
As the subject string already ended with a \n character, the regex
engine processing of the "past-the-end" position would match '^$'
as ^ matched past the existing \n and $ matched the assumed
end-of-line.
Fixes #3799
Diffstat (limited to 'test')
4 files changed, 9 insertions, 0 deletions
diff --git a/test/regression/3799-incorrect-region-match/cmd b/test/regression/3799-incorrect-region-match/cmd new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/test/regression/3799-incorrect-region-match/cmd @@ -0,0 +1 @@ + diff --git a/test/regression/3799-incorrect-region-match/in b/test/regression/3799-incorrect-region-match/in new file mode 100644 index 00000000..0956e089 --- /dev/null +++ b/test/regression/3799-incorrect-region-match/in @@ -0,0 +1,4 @@ +print << ""; +part of heredoc + +not part of heredoc diff --git a/test/regression/3799-incorrect-region-match/rc b/test/regression/3799-incorrect-region-match/rc new file mode 100644 index 00000000..3e1998b7 --- /dev/null +++ b/test/regression/3799-incorrect-region-match/rc @@ -0,0 +1,2 @@ +add-highlighter global/regions regions +add-highlighter global/regions/heredoc region -match-capture <<\h*"(\w*)" ^(\w*)$ fill red diff --git a/test/regression/3799-incorrect-region-match/script b/test/regression/3799-incorrect-region-match/script new file mode 100644 index 00000000..ec4075b4 --- /dev/null +++ b/test/regression/3799-incorrect-region-match/script @@ -0,0 +1,2 @@ +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": "p" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "rint " }, { "face": { "fg": "red", "bg": "default", "attributes": [] }, "contents": "<< \"\";\u000a" }], [{ "face": { "fg": "red", "bg": "default", "attributes": [] }, "contents": "part of heredoc\u000a" }], [{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "\u000a" }], [{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "not part of heredoc\u000a" }]], { "fg": "default", "bg": "default", "attributes": [] }, { "fg": "blue", "bg": "default", "attributes": [] }] }' |
