aboutsummaryrefslogtreecommitdiff
path: root/src/app/state.rs
diff options
context:
space:
mode:
authorCan Celik <ogulcancelik@gmail.com>2026-07-26 02:45:44 +0300
committerGitHub <noreply@github.com>2026-07-26 02:45:44 +0300
commit8843bbb0c4dc4e6b52ca5d0a6592ce80be56a19c (patch)
tree9387a75a8ae34fd864de83355412331c4f22a2b9 /src/app/state.rs
parent547aba8e0ab310623f1986d3026658f708d432bd (diff)
fix: improve sidebar worktree hierarchy and reordering (#1873)
* fix: clarify sidebar worktree hierarchy refs #1694 * feat: reorder worktree groups as a unit refs #1694
Diffstat (limited to 'src/app/state.rs')
-rw-r--r--src/app/state.rs19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/app/state.rs b/src/app/state.rs
index 6069b8a6..17b3ae4c 100644
--- a/src/app/state.rs
+++ b/src/app/state.rs
@@ -1141,10 +1141,16 @@ pub struct SettingsState {
pub original_theme: Option<String>,
}
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+pub(crate) enum WorkspaceDropTarget {
+ Before(usize),
+ End,
+}
+
pub(crate) enum DragTarget {
WorkspaceReorder {
source_ws_idx: usize,
- insert_idx: Option<usize>,
+ drop_target: Option<WorkspaceDropTarget>,
},
TabReorder {
ws_idx: usize,
@@ -2211,16 +2217,11 @@ impl AppState {
match &drag.target {
DragTarget::WorkspaceReorder {
source_ws_idx,
- insert_idx,
+ drop_target,
} => {
assert_workspace_index(*source_ws_idx, "workspace drag source");
- if let Some(insert_idx) = insert_idx {
- assert!(
- *insert_idx <= self.workspaces.len(),
- "workspace drag insert index {} out of bounds for {} workspaces",
- insert_idx,
- self.workspaces.len()
- );
+ if let Some(WorkspaceDropTarget::Before(ws_idx)) = drop_target {
+ assert_workspace_index(*ws_idx, "workspace drag target");
}
}
DragTarget::TabReorder {