Skip to content

Commit 3319441

Browse files
committed
Make max height of modification window taller
1 parent 29cabba commit 3319441

4 files changed

Lines changed: 53 additions & 28 deletions

File tree

Core/Sources/SuggestionWidget/SharedPanelView.swift

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -29,35 +29,36 @@ struct SharedPanelView: View {
2929
}
3030

3131
var body: some View {
32-
WithPerceptionTracking {
33-
VStack(spacing: 0) {
34-
if !store.alignTopToAnchor {
35-
Spacer()
36-
.frame(minHeight: 0, maxHeight: .infinity)
37-
.allowsHitTesting(false)
38-
}
39-
40-
DynamicContent(store: store)
32+
GeometryReader { geometry in
33+
WithPerceptionTracking {
34+
VStack(spacing: 0) {
35+
if !store.alignTopToAnchor {
36+
Spacer()
37+
.frame(minHeight: 0, maxHeight: .infinity)
38+
.allowsHitTesting(false)
39+
}
4140

42-
.frame(maxWidth: .infinity, maxHeight: Style.panelHeight)
43-
.fixedSize(horizontal: false, vertical: true)
44-
.allowsHitTesting(store.isPanelDisplayed)
45-
.frame(maxWidth: .infinity)
41+
DynamicContent(store: store)
42+
.frame(maxWidth: .infinity, maxHeight: geometry.size.height)
43+
.fixedSize(horizontal: false, vertical: true)
44+
.allowsHitTesting(store.isPanelDisplayed)
45+
.layoutPriority(1)
4646

47-
if store.alignTopToAnchor {
48-
Spacer()
49-
.frame(minHeight: 0, maxHeight: .infinity)
50-
.allowsHitTesting(false)
47+
if store.alignTopToAnchor {
48+
Spacer()
49+
.frame(minHeight: 0, maxHeight: .infinity)
50+
.allowsHitTesting(false)
51+
}
5152
}
53+
.preferredColorScheme(store.colorScheme)
54+
.opacity(store.opacity)
55+
.animation(
56+
featureFlag: \.animationBCrashSuggestion,
57+
.easeInOut(duration: 0.2),
58+
value: store.isPanelDisplayed
59+
)
60+
.frame(maxWidth: Style.panelWidth, maxHeight: .infinity)
5261
}
53-
.preferredColorScheme(store.colorScheme)
54-
.opacity(store.opacity)
55-
.animation(
56-
featureFlag: \.animationBCrashSuggestion,
57-
.easeInOut(duration: 0.2),
58-
value: store.isPanelDisplayed
59-
)
60-
.frame(maxWidth: Style.panelWidth, maxHeight: Style.panelHeight)
6162
}
6263
}
6364

Core/Sources/SuggestionWidget/SuggestionPanelContent/PromptToCodePanelView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ extension PromptToCodePanelView {
620620
font: codeFont.value.nsFont,
621621
droppingLeadingSpaces: hideCommonPrecedingSpaces,
622622
proposedForegroundColor: codeForegroundColor,
623-
ignoreWholeLineChange: false
623+
ignoreWholeLineChangeInDiff: false
624624
)
625625
.frame(maxWidth: .infinity)
626626

Core/Sources/SuggestionWidget/WidgetPositionStrategy.swift

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ public struct WidgetLocation: Equatable {
99

1010
var widgetFrame: CGRect
1111
var tabFrame: CGRect
12+
var sharedPanelLocation: PanelLocation
1213
var defaultPanelLocation: PanelLocation
1314
var suggestionPanelLocation: PanelLocation?
1415
}
@@ -70,7 +71,7 @@ enum UpdateLocationStrategy {
7071
.value(for: \.preferWidgetToStayInsideEditorWhenWidthGreaterThan),
7172
editorFrameExpendedSize: CGSize = .zero
7273
) -> WidgetLocation {
73-
return HorizontalMovable().framesForWindows(
74+
var frames = HorizontalMovable().framesForWindows(
7475
y: mainScreen.frame.height - editorFrame.maxY + Style.widgetPadding,
7576
alignPanelTopToAnchor: false,
7677
editorFrame: editorFrame,
@@ -80,6 +81,16 @@ enum UpdateLocationStrategy {
8081
hideCircularWidget: hideCircularWidget,
8182
editorFrameExpendedSize: editorFrameExpendedSize
8283
)
84+
85+
frames.sharedPanelLocation.frame.size.height = max(
86+
frames.defaultPanelLocation.frame.height,
87+
editorFrame.height - Style.widgetHeight
88+
)
89+
frames.defaultPanelLocation.frame.size.height = max(
90+
frames.defaultPanelLocation.frame.height,
91+
(editorFrame.height - Style.widgetHeight) / 2
92+
)
93+
return frames
8394
}
8495
}
8596

@@ -155,6 +166,10 @@ enum UpdateLocationStrategy {
155166
return .init(
156167
widgetFrame: widgetFrameOnTheRightSide,
157168
tabFrame: tabFrame,
169+
sharedPanelLocation: .init(
170+
frame: panelFrame,
171+
alignPanelTop: alignPanelTopToAnchor
172+
),
158173
defaultPanelLocation: .init(
159174
frame: panelFrame,
160175
alignPanelTop: alignPanelTopToAnchor
@@ -214,6 +229,10 @@ enum UpdateLocationStrategy {
214229
return .init(
215230
widgetFrame: widgetFrameOnTheLeftSide,
216231
tabFrame: tabFrame,
232+
sharedPanelLocation: .init(
233+
frame: panelFrame,
234+
alignPanelTop: alignPanelTopToAnchor
235+
),
217236
defaultPanelLocation: .init(
218237
frame: panelFrame,
219238
alignPanelTop: alignPanelTopToAnchor
@@ -241,6 +260,10 @@ enum UpdateLocationStrategy {
241260
return .init(
242261
widgetFrame: widgetFrameOnTheRightSide,
243262
tabFrame: tabFrame,
263+
sharedPanelLocation: .init(
264+
frame: panelFrame,
265+
alignPanelTop: alignPanelTopToAnchor
266+
),
244267
defaultPanelLocation: .init(
245268
frame: panelFrame,
246269
alignPanelTop: alignPanelTopToAnchor

Core/Sources/SuggestionWidget/WidgetWindowsController.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ extension WidgetWindowsController {
335335
return WidgetLocation(
336336
widgetFrame: .zero,
337337
tabFrame: .zero,
338+
sharedPanelLocation: .init(frame: .zero, alignPanelTop: false),
338339
defaultPanelLocation: .init(frame: .zero, alignPanelTop: false)
339340
)
340341
}
@@ -479,7 +480,7 @@ extension WidgetWindowsController {
479480
animate: animated
480481
)
481482
windows.sharedPanelWindow.setFrame(
482-
widgetLocation.defaultPanelLocation.frame,
483+
widgetLocation.sharedPanelLocation.frame,
483484
display: false,
484485
animate: animated
485486
)

0 commit comments

Comments
 (0)