Skip to content

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

Rust

pa-tui: → opens the selected row in the bash panel (#3795)

Sebastian Müller6852cb0cdbc1
diff --git a/.changes/right-arrow-opens-list-rows.md b/.changes/right-arrow-opens-list-rows.md
new file mode 100644
index 0000000000..7c7ec1b6f8
--- /dev/null
+++ b/.changes/right-arrow-opens-list-rows.md
@@ -0,0 +1 @@
+- → now opens the selected shell in the bash panel, like Enter (← already closes it), and the footer says so.
diff --git a/crates/pa-tui/src/bash_view.rs b/crates/pa-tui/src/bash_view.rs
index f271337ac2..0e5a9d7a66 100644
--- a/crates/pa-tui/src/bash_view.rs
+++ b/crates/pa-tui/src/bash_view.rs
@@ -437,7 +437,9 @@ impl BashView {
};
return self.move_selection(delta);
}
- if kb.matches(key, "tui.select.confirm") {
+ if kb.matches(key, "tui.select.confirm")
+ || (self.mode == Mode::List && kb.matches(key, "app.modal.open"))
+ {
return self.confirm_selection();
}
BashViewAction::None
@@ -763,26 +765,27 @@ impl BashView {
self.detail_region_rows.set(rendered);
lines
}
- /// The list's bottom hint: an override that empties the back binding drops
- /// its key (the hint never advertises a key the handler does not take).
+ /// The list's bottom hint: an override that empties the open or back
+ /// binding drops its key (the hint never advertises a key the handler
+ /// does not take).
fn list_hint(kb: &KeybindingsManager) -> String {
let key = |binding: &str, fallback: &str| {
kb.first_key(binding)
.map_or_else(|| fallback.to_string(), |key| format_key_text(&key))
};
- let close = match kb.first_key("app.modal.back") {
- Some(back) => format!(
- "{}/{}",
- format_key_text(&back),
- key("tui.select.cancel", "Esc")
- ),
+ let bound = |binding: &str| kb.first_key(binding).map(|key| format_key_text(&key));
+ let open = match bound("app.modal.open") {
+ Some(open) => format!("{}/{open}", key("tui.select.confirm", "Enter")),
+ None => key("tui.select.confirm", "Enter"),
+ };
+ let close = match bound("app.modal.back") {
+ Some(back) => format!("{back}/{}", key("tui.select.cancel", "Esc")),
None => key("tui.select.cancel", "Esc"),
};
format!(
- "{}/{} move \u{b7} {} open \u{b7} {close} close",
+ "{}/{} move \u{b7} {open} open \u{b7} {close} close",
key("tui.select.up", "\u{2191}"),
key("tui.select.down", "\u{2193}"),
- key("tui.select.confirm", "Enter"),
)
}
diff --git a/crates/pa-tui/src/bash_view/tests.rs b/crates/pa-tui/src/bash_view/tests.rs
index 8bff9cd037..686dadfc24 100644
--- a/crates/pa-tui/src/bash_view/tests.rs
+++ b/crates/pa-tui/src/bash_view/tests.rs
@@ -107,10 +107,8 @@ fn the_list_renders_columned_rows_and_one_hint() {
1,
"the close hint appears once: {text:?}"
);
- assert!(text
- .iter()
- .any(|row| row
- .contains("\u{2191}/\u{2193} move \u{b7} Enter open \u{b7} \u{2190}/Esc close")));
+ assert!(text.iter().any(|row| row
+ .contains("\u{2191}/\u{2193} move \u{b7} Enter/\u{2192} open \u{b7} \u{2190}/Esc close")));
for line in &frame {
assert!(crate::width::spans_width(line) <= 70);
}
@@ -120,6 +118,7 @@ fn the_list_renders_columned_rows_and_one_hint() {
fn the_list_hint_drops_unbound_keys() {
let mut cfg = crate::keybindings::KeybindingsConfig::new();
cfg.insert("app.modal.back".to_string(), Vec::new());
+ cfg.insert("app.modal.open".to_string(), Vec::new());
let kb = KeybindingsManager::with_user_bindings(cfg);
let view = BashView::new(activities(), 24);
let frame = view.render(&theme(), 70, &kb);
@@ -127,7 +126,7 @@ fn the_list_hint_drops_unbound_keys() {
assert!(
text.iter()
.any(|row| row.contains("\u{2191}/\u{2193} move \u{b7} Enter open \u{b7} Esc close")),
- "the emptied back binding drops the arrow: {text:?}"
+ "the emptied open and back bindings drop their arrows: {text:?}"
);
}
@@ -322,6 +321,24 @@ fn enter_opens_the_detail_and_the_cancel_action() {
let _ = first_generation;
}
+#[test]
+fn right_opens_the_selected_row_like_enter() {
+ let mut view = BashView::new(activities(), 24);
+ let action = view.handle_key("right", &kb());
+ let BashViewAction::OpenDetail { id, .. } = &action else {
+ panic!("right opens the selected row: {action:?}");
+ };
+ assert_eq!(id, "a");
+ // In the detail Right is not Enter: the running row is not killed.
+ assert_eq!(view.handle_key("right", &kb()), BashViewAction::None);
+ assert_eq!(
+ view.mode,
+ Mode::Detail {
+ id: "a".to_string()
+ }
+ );
+}
+
/// No labeled-pair blocks, no section labels, no duplicated title.
#[test]
fn the_detail_is_one_metadata_row_the_command_and_the_output() {
diff --git a/crates/pa-tui/src/heartbeats_picker.rs b/crates/pa-tui/src/heartbeats_picker.rs
index 314b3be5ba..fc8dc9c75b 100644
--- a/crates/pa-tui/src/heartbeats_picker.rs
+++ b/crates/pa-tui/src/heartbeats_picker.rs
@@ -258,7 +258,7 @@ impl HeartbeatsPicker {
self.move_selection(delta);
return HeartbeatsPickerAction::None;
}
- if self.mode == Mode::List && kb.matches(key, "app.heartbeats.openSelected") {
+ if self.mode == Mode::List && kb.matches(key, "app.modal.open") {
self.open_detail();
return HeartbeatsPickerAction::None;
}
@@ -561,7 +561,7 @@ impl HeartbeatsPicker {
.map_or_else(|| fallback.to_string(), |key| format_key_text(&key))
};
let bound = |binding: &str| kb.first_key(binding).map(|key| format_key_text(&key));
- let open = match bound("app.heartbeats.openSelected") {
+ let open = match bound("app.modal.open") {
Some(detail) => format!("{}/{}", key("tui.select.confirm", "Enter"), detail),
None => key("tui.select.confirm", "Enter"),
};
diff --git a/crates/pa-tui/src/heartbeats_picker/tests.rs b/crates/pa-tui/src/heartbeats_picker/tests.rs
index d516b174dc..07e5482e41 100644
--- a/crates/pa-tui/src/heartbeats_picker/tests.rs
+++ b/crates/pa-tui/src/heartbeats_picker/tests.rs
@@ -157,7 +157,7 @@ fn the_list_hint_drops_unbound_keys() {
"the emptied back binding drops the arrow: {text:?}"
);
let mut cfg = crate::keybindings::KeybindingsConfig::new();
- cfg.insert("app.heartbeats.openSelected".to_string(), Vec::new());
+ cfg.insert("app.modal.open".to_string(), Vec::new());
let kb = KeybindingsManager::with_user_bindings(cfg);
let picker = HeartbeatsPicker::new(entries(), None, None, 24);
let frame = picker.render(&theme(), 70, &kb);
diff --git a/crates/pa-tui/src/keybindings/definitions.rs b/crates/pa-tui/src/keybindings/definitions.rs
index 8430be3656..a4e7ffc6c7 100644
--- a/crates/pa-tui/src/keybindings/definitions.rs
+++ b/crates/pa-tui/src/keybindings/definitions.rs
@@ -318,10 +318,6 @@ pub const APP_KEYBINDINGS: &[(&str, KeybindingDefinition)] = &[
def!(&["ctrl+o"], "Cycle conversation detail", scope "editor"),
),
("app.subagents.focus", def!(&["alt+a"], "Focus activity")),
- (
- "app.heartbeats.openSelected",
- def!(&["right"], "Open selected heartbeat"),
- ),
(
"app.editor.external",
def!(&["ctrl+g"], "Open external editor"),
@@ -374,6 +370,7 @@ pub const APP_KEYBINDINGS: &[(&str, KeybindingDefinition)] = &[
"app.modal.back",
def!(&["left"], "Go back / close the current dialog"),
),
+ ("app.modal.open", def!(&["right"], "Open the selected row")),
(
"app.agents.reply",
def!(&["space"], "Reply to selected agent"),