diff --git a/docs/configuration.md b/docs/configuration.md index 15025a1..d99ea06 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -160,7 +160,7 @@ Any other segment name is a custom named value, such as `:build_status`. Set ini Move `:battery` to any anchor group or remove it from both bars to stop battery collection. A nonempty `config.labels[:battery]` or plugin value explicitly overrides the native text and pauses collection; clearing that value restores native readings. Other custom live values use [`editor.label(name, text)` or asynchronous plugin updates](plugins.md#named-label-updates). Configuration runs once at startup; there are no render callbacks. -`:shell` shows the pending `:!COMMAND` abbreviation and animated spinner, and hides when idle. It defaults to the right of `:battery`; move it to any anchor group or omit it without affecting command execution. A nonempty label named `shell` overrides the builtin display; clearing it restores the running indicator. +`:shell` shows the pending `:!COMMAND` abbreviation and animated spinner only after the command has run for 200 ms, avoiding flashes for short commands. Completion output appears immediately, without waiting for that delay. The segment hides when idle. It defaults to the right of `:battery`; move it to any anchor group or omit it without affecting command execution. A nonempty label named `shell` overrides the builtin display; clearing it restores the running indicator. ### Command and search popup anchors diff --git a/src/session.rs b/src/session.rs index 81038ba..b41b097 100644 --- a/src/session.rs +++ b/src/session.rs @@ -1782,9 +1782,12 @@ impl EditorSession { self.editor.show_command_output(command, result); return true; } + let elapsed = now.saturating_duration_since(*started); + if elapsed < Duration::from_millis(200) { + return false; + } const FRAMES: [char; 4] = ['|', '/', '-', '\\']; - let frame = - FRAMES[((now.saturating_duration_since(*started).as_millis() / 100) % 4) as usize]; + let frame = FRAMES[((elapsed.as_millis() / 100) % 4) as usize]; if self.editor.shell_label().ends_with(frame) { return false; } diff --git a/tests/unit/session.rs b/tests/unit/session.rs index d041486..404500b 100644 --- a/tests/unit/session.rs +++ b/tests/unit/session.rs @@ -20,8 +20,10 @@ fn shell_commands_leave_editing_live_and_present_both_streams_and_exit_status() session.handle(Input::Enter); let fixed = Instant::now(); session.shell.as_mut().unwrap().2 = fixed; - assert!(session.poll_shell_at(fixed + Duration::from_millis(100))); - assert_eq!(session.editor.shell_label(), "whi... /"); + assert!(!session.poll_shell_at(fixed + Duration::from_millis(199))); + assert_eq!(session.editor.shell_label(), ""); + assert!(session.poll_shell_at(fixed + Duration::from_millis(200))); + assert_eq!(session.editor.shell_label(), "whi... -"); session.execute("!printf should-not-run > unexpected"); assert_eq!( session.editor.message(),