Skip to content

A self-improving RLM agent for coding workflows and long-running autonomous tasks.

Rust

fix(coding-agent): keep Down Arrow in unfinished prompts (#1226)

Sebastian Müller795a21de6370
diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md
index 4ed805b0d7..b8e4bb0171 100644
--- a/packages/coding-agent/CHANGELOG.md
+++ b/packages/coding-agent/CHANGELOG.md
@@ -2,6 +2,7 @@
## [Unreleased]
+- Fixed Down Arrow focusing the Agents View entry before moving a nonempty prompt cursor to the end ([ENG-5147](https://linear.app/primeintellect/issue/ENG-5147/keep-down-arrow-in-the-prompt-until-the-cursor-reaches-the-end)).
- Added `app.messages.expand` (`ctrl+p`) to collapse or expand agent-to-agent messages separately from `ctrl+o` tool output.
- Added a `ctrl+t` expand hint to collapsed thinking blocks, matching the tool output hint.
- Changed expand/collapse hints to a consistent bracketed `(Ctrl+O to expand)` style across tool, message, summary, and error rows.
diff --git a/packages/coding-agent/src/modes/interactive/components/custom-editor.ts b/packages/coding-agent/src/modes/interactive/components/custom-editor.ts
index ddcc9d5dcb..9e36e95ca8 100644
--- a/packages/coding-agent/src/modes/interactive/components/custom-editor.ts
+++ b/packages/coding-agent/src/modes/interactive/components/custom-editor.ts
@@ -218,7 +218,7 @@ export class CustomEditor extends Editor {
this.keybindings.matches(data, "tui.editor.cursorDown") &&
!this.isShowingAutocomplete() &&
!this.isHistoryNavigationActive() &&
- this.isCursorOnLastVisualLine() &&
+ this.isCursorAtEnd() &&
this.onMoveBelowPrompt?.()
) {
return;
@@ -228,6 +228,12 @@ export class CustomEditor extends Editor {
super.handleInput(data);
}
+ private isCursorAtEnd(): boolean {
+ const lines = this.getLines();
+ const cursor = this.getCursor();
+ return cursor.line === lines.length - 1 && cursor.col === (lines[cursor.line]?.length ?? 0);
+ }
+
private splitRepeatedKeybinding(data: string, keybinding: AppKeybinding): string[] | undefined {
const inputs: string[] = [];
let offset = 0;
diff --git a/packages/tui/src/components/editor.ts b/packages/tui/src/components/editor.ts
index b066f007c8..9de16488c3 100644
--- a/packages/tui/src/components/editor.ts
+++ b/packages/tui/src/components/editor.ts
@@ -470,10 +470,6 @@ export class Editor implements Component, Focusable {
return this.historyIndex > -1;
}
- protected isCursorOnLastVisualLine(): boolean {
- return this.isOnLastVisualLine();
- }
-
private navigateHistory(direction: 1 | -1): void {
this.lastAction = null;
if (this.history.length === 0) return;