agent_ui: Simplify thread scrolling with keyboard (#53547)

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 scroll the thread.

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

Demo:


[Demo](https://github.com/user-attachments/assets/ff540c8c-a223-417b-b16a-b0d08599b1ae)



Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [ ] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable


Release Notes:

- N/A

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,