summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2024-03-22 21:44:37 +1100
committerMaxime Coste <mawww@kakoune.org>2024-03-22 21:44:37 +1100
commitd5f7cbad87331583717493ca701010f72c2d4f74 (patch)
tree17251b2fa868f96e8150b2b0e0db2887d7e36f89 /test
parenta1e6799aa9a4b2509a6a3af7c4bf4889bb826e2e (diff)
Do not generate more lines to display than window size
The wrap highlighter was pulling all lines until the cursor, regardless of whether the cursor was going to be made visible, this could lead to a display buffer containing much more lines than the actual viewport which eventually could lead to menu being anchored out of view that was leading to past-the-end buffer accesses. Fix the wrap higlighter not to pull lines up to the cursor when it is not tasked with making the cursor visible, and always trim the eventual extra lines after highlighting. Fixes #5118
Diffstat (limited to 'test')
-rw-r--r--test/regression/5118-crash-on-scroll-with-insert-completion-and-wrap/cmd1
-rw-r--r--test/regression/5118-crash-on-scroll-with-insert-completion-and-wrap/in29
-rw-r--r--test/regression/5118-crash-on-scroll-with-insert-completion-and-wrap/rc1
-rw-r--r--test/regression/5118-crash-on-scroll-with-insert-completion-and-wrap/script6
4 files changed, 37 insertions, 0 deletions
diff --git a/test/regression/5118-crash-on-scroll-with-insert-completion-and-wrap/cmd b/test/regression/5118-crash-on-scroll-with-insert-completion-and-wrap/cmd
new file mode 100644
index 00000000..8b137891
--- /dev/null
+++ b/test/regression/5118-crash-on-scroll-with-insert-completion-and-wrap/cmd
@@ -0,0 +1 @@
+
diff --git a/test/regression/5118-crash-on-scroll-with-insert-completion-and-wrap/in b/test/regression/5118-crash-on-scroll-with-insert-completion-and-wrap/in
new file mode 100644
index 00000000..898d6e83
--- /dev/null
+++ b/test/regression/5118-crash-on-scroll-with-insert-completion-and-wrap/in
@@ -0,0 +1,29 @@
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+%(29)
diff --git a/test/regression/5118-crash-on-scroll-with-insert-completion-and-wrap/rc b/test/regression/5118-crash-on-scroll-with-insert-completion-and-wrap/rc
new file mode 100644
index 00000000..2cd258c4
--- /dev/null
+++ b/test/regression/5118-crash-on-scroll-with-insert-completion-and-wrap/rc
@@ -0,0 +1 @@
+add-highlighter window/ wrap
diff --git a/test/regression/5118-crash-on-scroll-with-insert-completion-and-wrap/script b/test/regression/5118-crash-on-scroll-with-insert-completion-and-wrap/script
new file mode 100644
index 00000000..ef4a1d65
--- /dev/null
+++ b/test/regression/5118-crash-on-scroll-with-insert-completion-and-wrap/script
@@ -0,0 +1,6 @@
+ui_out -ignore 6
+ui_in '{ "jsonrpc": "2.0", "method": "keys", "params": [ "a<space>2<c-x><c-w>" ] }'
+ui_out -until-grep menu_show >/dev/null
+ui_out -ignore 5
+ui_in '{ "jsonrpc": "2.0", "method": "scroll", "params": [ -5 ] }'
+ui_out '{ "jsonrpc": "2.0", "method": "draw", "params": [[[{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "1\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "2\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "3\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "4\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "5\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "6\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "7\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "8\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "9\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "10\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "11\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "12\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "13\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "14\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "15\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "16\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "17\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "18\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "19\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "20\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "21\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "22\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "23\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "24\u000a" }]], { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, { "fg": "blue", "bg": "default", "underline": "default", "attributes": [] }] }'