Skip to content

Commit af06b85

Browse files
committed
Raise broadcast cycle limit to 5 to fix Esc-exit panic
Exiting the bookmarks or search view with Esc produces a 5-link broadcast chain (Key -> ResetView -> RefreshDirectory -> RefreshedDirectory -> SelectionChanged), but BROADCASTS_COUNT was capped at 4, causing a panic. Raise the cap to 5 and document the ResetView-exit chain as the longest legitimate chain.
1 parent 9e9602c commit af06b85

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

src/app.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,22 @@ use crate::{
2727
};
2828

2929
/// Maximum number of broadcast cycles per input command. Each cycle resolves
30-
/// one link in an intent → result chain; the longest legitimate chain is 4:
30+
/// one link in an intent → result chain; the longest legitimate chain is 5,
31+
/// which occurs when `Esc` exits the bookmarks or search view:
3132
///
32-
/// 1. `Key` — terminal input
33-
/// 2. `GoToParentDirectory` / `Open` — navigation intent derived from the key
34-
/// 3. `NavigatedDirectory` — result emitted by `FileSystem`
35-
/// 4. `SelectionChanged` — emitted by `TableView` for the new listing
33+
/// 1. `Key` — terminal input
34+
/// 2. `ResetView` — derived from the key
35+
/// 3. `RefreshDirectory` — `TableView` clears bookmarks/search and asks for a reload
36+
/// 4. `RefreshedDirectory` — result emitted by `FileSystem`
37+
/// 5. `SelectionChanged` — emitted by `TableView` for the new listing
38+
///
39+
/// Direct navigation (`Key → GoToParentDirectory/Open → NavigatedDirectory →
40+
/// SelectionChanged`) is one link shorter because the intent maps straight to
41+
/// `NavigatedDirectory` without a `RefreshDirectory` hop.
3642
///
3743
/// Also acts as a guard against a handler stuck deriving commands forever.
3844
/// See `broadcast_command` for what happens when it is exceeded.
39-
const BROADCASTS_COUNT: u8 = 4;
45+
const BROADCASTS_COUNT: u8 = 5;
4046

4147
pub struct App {
4248
clipboard: Clipboard,

0 commit comments

Comments
 (0)