@@ -29,6 +29,7 @@ struct EditorJumpBarView: View {
2929 @State private var containerWidth : CGFloat = 0
3030 @State private var isTruncated : Bool = false
3131 @State private var crumbWidth : CGFloat ?
32+ @State private var firstCrumbWidth : CGFloat ?
3233
3334 init (
3435 file: CEWorkspaceFile ? ,
@@ -72,7 +73,7 @@ struct EditorJumpBarView: View {
7273 fileItem: fileItem,
7374 tappedOpenFile: tappedOpenFile,
7475 isLastItem: fileItems. last == fileItem,
75- isTruncated: $crumbWidth
76+ isTruncated: fileItems . first == fileItem ? $firstCrumbWidth : $crumbWidth
7677 )
7778 }
7879
@@ -149,16 +150,34 @@ struct EditorJumpBarView: View {
149150 let snapThreshold : CGFloat = 30
150151 let maxWidth : CGFloat = textWidth / CGFloat( fileItems. count)
151152 let exponent : CGFloat = 5.0
153+ var betweenWidth : CGFloat = 0.0
152154
153155 if textWidth >= containerWidth {
154156 let scale = max ( 0 , min ( 1 , containerWidth / textWidth) )
155- var width = floor ( ( minWidth + ( maxWidth - minWidth) * pow( scale, exponent) ) )
156- if width < snapThreshold {
157- width = minWidth
157+ betweenWidth = floor ( ( minWidth + ( maxWidth - minWidth) * pow( scale, exponent) ) )
158+ if betweenWidth < snapThreshold {
159+ betweenWidth = minWidth
158160 }
159- crumbWidth = width
161+ crumbWidth = betweenWidth
160162 } else {
161163 crumbWidth = nil
162164 }
165+
166+ if betweenWidth > snapThreshold {
167+ firstCrumbWidth = nil
168+ } else {
169+ let otherCrumbs = CGFloat ( max ( fileItems. count - 1 , 1 ) )
170+ let usedWidth = otherCrumbs * snapThreshold
171+
172+ // Multiplier to reserve extra space for other crumbs in the jump bar.
173+ // Increasing this value causes the first crumb to truncate sooner.
174+ let crumbSpacingMultiplier : CGFloat = 1.5
175+ let availableForFirst = containerWidth - usedWidth * crumbSpacingMultiplier
176+ if availableForFirst < snapThreshold {
177+ firstCrumbWidth = minWidth
178+ } else {
179+ firstCrumbWidth = availableForFirst
180+ }
181+ }
163182 }
164183}
0 commit comments