Skip to content

Commit 9dd3c0a

Browse files
committed
fix cyclic navigation in interactive mode
Down arrow now moves from last worktree to first GlobalAction, and Up arrow moves from first GlobalAction to last worktree. This makes navigation fully cyclic through all left-panel items. Bump version to 0.7.1
1 parent 3d041ff commit 9dd3c0a

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rsworktree"
3-
version = "0.7.0"
3+
version = "0.7.1"
44
edition = "2024"
55
description = "CLI helper for managing Git worktrees under a dedicated .rsworktree directory"
66
license = "MIT"

src/commands/interactive/command.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -946,6 +946,10 @@ where
946946
Focus::GlobalActions => {
947947
if self.global_action_selected > 0 {
948948
self.move_global_action(-1);
949+
} else if !self.worktrees.is_empty() {
950+
self.focus = Focus::Worktrees;
951+
self.selected = Some(self.worktrees.len().saturating_sub(1));
952+
self.sync_selection(state);
949953
}
950954
}
951955
}
@@ -961,8 +965,16 @@ where
961965
}
962966
return;
963967
}
968+
let last_index = self.worktrees.len().saturating_sub(1);
969+
if matches!(self.selected, Some(idx) if idx >= last_index)
970+
&& !super::GLOBAL_ACTIONS.is_empty()
971+
{
972+
self.focus = Focus::GlobalActions;
973+
self.global_action_selected = 0;
974+
return;
975+
}
964976
let next = match self.selected {
965-
Some(idx) => (idx + 1) % self.worktrees.len(),
977+
Some(idx) => idx + 1,
966978
None => 0,
967979
};
968980
self.selected = Some(next);

0 commit comments

Comments
 (0)