Skip to content

Commit fc31609

Browse files
committed
Change foldout size priorities
Since the foldouts were reordered to worktrees -> branches -> pull/push, the width constraints should also follow that order. Otherwise, the resize behavior is unintuitive, see: #81 (comment)
1 parent 30313ec commit fc31609

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

app/src/lib/stores/app-store.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3185,12 +3185,20 @@ export class AppStore extends TypedBaseStore<IAppState> {
31853185
)
31863186
this.stashedFilesWidth = constrain(this.stashedFilesWidth, 100, filesMax)
31873187

3188-
// Allocate branch first (highest priority), then worktree, then
3188+
// Allocate worktree first (highest priority), then branch, then
31893189
// push-pull. Each subsequent allocation uses the clamped value of the
31903190
// previous to prevent the total from exceeding the available space.
3191+
const worktreeDropdownMax =
3192+
available - defaultBranchDropdownWidth - defaultPushPullButtonWidth
3193+
this.worktreeDropdownWidth = constrain(
3194+
this.worktreeDropdownWidth,
3195+
Math.min(available / numButtons - 10, 170),
3196+
worktreeDropdownMax
3197+
)
3198+
31913199
const branchDropdownMax =
31923200
available -
3193-
(showWorktreeDropdown ? defaultWorktreeDropdownWidth : 0) -
3201+
(showWorktreeDropdown ? clamp(this.worktreeDropdownWidth) : 0) -
31943202
defaultPushPullButtonWidth
31953203
const minimumBranchDropdownWidth =
31963204
defaultBranchDropdownWidth > available / numButtons
@@ -3202,14 +3210,6 @@ export class AppStore extends TypedBaseStore<IAppState> {
32023210
branchDropdownMax
32033211
)
32043212

3205-
const worktreeDropdownMax =
3206-
available - clamp(this.branchDropdownWidth) - defaultPushPullButtonWidth
3207-
this.worktreeDropdownWidth = constrain(
3208-
this.worktreeDropdownWidth,
3209-
Math.min(available / numButtons - 10, 170),
3210-
worktreeDropdownMax
3211-
)
3212-
32133213
const pushPullButtonMaxWidth =
32143214
available -
32153215
clamp(this.branchDropdownWidth) -

0 commit comments

Comments
 (0)