The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
hn: a copied selection says "Copied" over its pane for a moment
bubu-dududbc9a9f48eb0
diff --git a/tui/src/app.rs b/tui/src/app.rsindex 87dd8daa8..09f5a1a4a 100644--- a/tui/src/app.rs+++ b/tui/src/app.rs@@ -494,6 +494,8 @@ pub struct App {pub first_session: u32,pub modal: Option<Modal>,pub toast: Option<(String, Color, Instant)>,+ /// A selection just went to the clipboard: the pane, and when (a moment's "Copied" over it).+ pub copied: Option<(u64, Instant)>,/// How long hn's own notice stays (a harness waiting on you: longer than display-time's/// 750 ms, which is for tmux's messages); none for any other message.pub toast_hold: Option<u64>,@@ -911,6 +913,7 @@ impl App {first_session: 0,modal: None,toast: None,+ copied: None,display_ms: 750,toast_hold: None,toast_exact: None,diff --git a/tui/src/copy/glue.rs b/tui/src/copy/glue.rsindex e509d9bad..f0fd239d5 100644--- a/tui/src/copy/glue.rs+++ b/tui/src/copy/glue.rs@@ -248,6 +248,10 @@ pub fn run(copy: &mut Copy, ps: &mut PaneSearch, c: &Ctx, args: Vec<String>, moufn apply(app: &mut App, pane: u64, out: Out, m: Option<&crate::mouse::Event>) {let clipboard = app.options.get("set-clipboard", "", None).as_deref() != Some("off");let limit = app.buffer_limit();+ // Copied to the clipboard: said a moment over the pane, so a selection let go is known taken.+ if clipboard && matches!(out, Out::Copy { .. } | Out::Pipe { copy: Some(_), .. } | Out::Append(_)) {+ app.copied = Some((pane, std::time::Instant::now()));+ }match out {Out::Copy { prefix, text } => {if clipboard { crate::clipboard::store_as("", &text) }diff --git a/tui/src/ui.rs b/tui/src/ui.rsindex 3b80c7a13..2c3bdc1cf 100644--- a/tui/src/ui.rs+++ b/tui/src/ui.rs@@ -39,6 +39,7 @@ pub fn next_repaint(app: &App, frame_started: Instant) -> Option<Instant> {if let Some((_, _, at)) = app.toast.as_ref().filter(|_| app.toast_ms() != u64::MAX) {deadline(*at, app.toast_ms());}+ if let Some((_, at)) = app.copied { deadline(at, COPIED_MS) }let hints = !(app.options.tmux_look() && app.options.get("@hn-hint-time", "", None).is_none());if app.prefix && hints {if let Some(at) = app.prefix_at { deadline(at, app.keymap.hint_ms); }@@ -297,6 +298,7 @@ pub fn draw(frame: &mut Frame, app: &mut App) {let speaking = matches!(&app.modal, Some(Modal::Prompt(p)) if !p.dialog()) || matches!(app.modal, Some(Modal::Confirm { .. })) || app.toast.as_ref().map(|(_, _, at)| at.elapsed() < Duration::from_millis(app.toast_ms())).unwrap_or(false);if !hidden || speaking { if let Some(pos) = status_line(buf, app, status) { cursor = Some(pos) } }crate::os_welcome::draw_dock(buf, app);+ copied(buf, app);// A menu is tmux's overlay: over the status line too, where it is kept on the screen.if let Some(Modal::Menu(m)) = &app.modal { menu(buf, app, m) }if let Some(Modal::NewHarness(form)) = &mut app.modal { cursor = crate::new_harness::draw(buf, body, form); }@@ -749,6 +751,23 @@ fn empty_window(buf: &mut Buffer, app: &mut App, area: Rect) -> Option<Position>else { crate::new_harness::draw_welcome(buf, app, area) }}+/// How long "Copied" stays over the pane a selection was copied from.+const COPIED_MS: u64 = 1200;++/// "✓ Copied" in the bottom right of the pane a selection just went to the clipboard from, for a+/// moment (not under @hn-look tmux: tmux says nothing).+fn copied(buf: &mut Buffer, app: &mut App) {+ let Some((pane, at)) = app.copied else { return };+ if at.elapsed() >= Duration::from_millis(COPIED_MS) { app.copied = None; return }+ if app.options.tmux_look() || app.modal.is_some() { return }+ let Some(rect) = app.rects.iter().find(|(id, _)| *id == pane).map(|(_, r)| app.content_of(app.tab(), *r)) else { return };+ let label = " ✓ Copied ";+ let width = label.width() as u16;+ if rect.width < width + 2 || rect.height < 2 { return }+ let (x, y) = (rect.right() - width - 1, rect.bottom() - 2);+ buf.set_string(x, y, label, Style::default().fg(Color::Black).bg(theme::accent()).add_modifier(Modifier::BOLD));+}+/// A command's window while its terminal starts: a quiet line, nothing to choose.fn opening_window(buf: &mut Buffer, area: Rect, what: &str) {let line = Line::styled(if what.is_empty() { "Opening…".to_string() } else { format!("Opening {what}…") }, fg(theme::MUTED));@@ -3312,6 +3331,23 @@ mod theme_render_tests {assert!(!screen(&mut app).contains("Opening Updates…"));}+ /// A selection let go goes to the clipboard and says so over its pane for a moment.+ #[test]+ fn a_copied_selection_says_copied_over_its_pane_for_a_moment() {+ let mut app = app();+ app.panes.insert(1, Pane::new(1, "local", "shell", 100, 30));+ app.tab_mut().root = Some(crate::layout::Node::new(1, 150, 41));+ app.tab_mut().focus = Some(1);+ app.fit_panes();+ assert!(!screen(&mut app).contains("Copied"));+ app.copied = Some((1, Instant::now()));+ assert!(screen(&mut app).contains("✓ Copied"));+ assert!(next_repaint(&app, Instant::now()).is_some(), "a frame comes to take it away");+ app.copied = Some((1, Instant::now() - Duration::from_millis(COPIED_MS + 1)));+ assert!(!screen(&mut app).contains("Copied"));+ assert!(app.copied.is_none());+ }+/// `theme` opens the settings panel over the window (not fzf's full-screen list), and a key/// into a section shows that section's options — which a fleet refresh leaves open.#[test]