agent_ui: Simplify thread scrolling with keyboard

Oleksiy Syvokon created

This change allows using simple navigation keys
(PageDown/PageUp/Ctrl-Home/Ctrl-End) when the message editor is focused,
but only if the cursor is at the beginning/end of the message, where
pressing these keys would normally result in no-op.

One important corollary is that when the cursor is in an empty message,
navigation keys work for scrolling the thread.

We already have this behaviour for Up/Down keys and this change
just expands it for other keys.

Change summary

assets/keymaps/default-linux.json   | 18 ++++++++++++++++++
assets/keymaps/default-macos.json   | 18 ++++++++++++++++++
assets/keymaps/default-windows.json | 18 ++++++++++++++++++
3 files changed, 54 insertions(+)

Detailed changes

assets/keymaps/default-linux.json 🔗

@@ -338,6 +338,24 @@
       "ctrl-alt-.": "agent::ToggleFastMode",
     },
   },
+  {
+    "context": "AcpThread > Editor && start_of_input",
+    "use_key_equivalents": true,
+    "bindings": {
+      "pageup": "agent::ScrollOutputPageUp",
+      "ctrl-pageup": "agent::ScrollOutputPageUp",
+      "ctrl-home": "agent::ScrollOutputToTop",
+    },
+  },
+  {
+    "context": "AcpThread > Editor && end_of_input",
+    "use_key_equivalents": true,
+    "bindings": {
+      "pagedown": "agent::ScrollOutputPageDown",
+      "ctrl-pagedown": "agent::ScrollOutputPageDown",
+      "ctrl-end": "agent::ScrollOutputToBottom",
+    },
+  },
   {
     "context": "AcpThread > Editor && mode == full",
     "use_key_equivalents": true,

assets/keymaps/default-macos.json 🔗

@@ -379,6 +379,24 @@
       "cmd-alt-.": "agent::ToggleFastMode",
     },
   },
+  {
+    "context": "AcpThread > Editor && start_of_input",
+    "use_key_equivalents": true,
+    "bindings": {
+      "pageup": "agent::ScrollOutputPageUp",
+      "ctrl-pageup": "agent::ScrollOutputPageUp",
+      "ctrl-home": "agent::ScrollOutputToTop",
+    },
+  },
+  {
+    "context": "AcpThread > Editor && end_of_input",
+    "use_key_equivalents": true,
+    "bindings": {
+      "pagedown": "agent::ScrollOutputPageDown",
+      "ctrl-pagedown": "agent::ScrollOutputPageDown",
+      "ctrl-end": "agent::ScrollOutputToBottom",
+    },
+  },
   {
     "context": "AcpThread > Editor && mode == full",
     "use_key_equivalents": true,

assets/keymaps/default-windows.json 🔗

@@ -339,6 +339,24 @@
       "ctrl-alt-.": "agent::ToggleFastMode",
     },
   },
+  {
+    "context": "AcpThread > Editor && start_of_input",
+    "use_key_equivalents": true,
+    "bindings": {
+      "pageup": "agent::ScrollOutputPageUp",
+      "ctrl-pageup": "agent::ScrollOutputPageUp",
+      "ctrl-home": "agent::ScrollOutputToTop",
+    },
+  },
+  {
+    "context": "AcpThread > Editor && end_of_input",
+    "use_key_equivalents": true,
+    "bindings": {
+      "pagedown": "agent::ScrollOutputPageDown",
+      "ctrl-pagedown": "agent::ScrollOutputPageDown",
+      "ctrl-end": "agent::ScrollOutputToBottom",
+    },
+  },
   {
     "context": "AcpThread > Editor && mode == full",
     "use_key_equivalents": true,