Fix Enter key semantics and add expandable model descriptions
- Replace TextEditor with NativeTextEditor (NSViewRepresentable) so plain Enter sends the message and Shift/Cmd+Enter inserts a newline. The old TextEditor passed bare Return directly to NSTextView before SwiftUI's onKeyPress could intercept it, accidentally making Cmd+Enter send instead. - Add More…/Less toggle in ModelInfoView for descriptions longer than 250 characters, with smooth expand/collapse animation. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -30,6 +30,7 @@ struct ModelInfoView: View {
|
||||
|
||||
@Environment(\.dismiss) var dismiss
|
||||
@Bindable private var settings = SettingsService.shared
|
||||
@State private var isDescriptionExpanded = false
|
||||
|
||||
var body: some View {
|
||||
VStack(spacing: 0) {
|
||||
@@ -78,8 +79,18 @@ struct ModelInfoView: View {
|
||||
Text(desc)
|
||||
.font(.body)
|
||||
.foregroundColor(.primary)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.lineLimit(isDescriptionExpanded ? nil : 4)
|
||||
.textSelection(.enabled)
|
||||
if desc.count > 250 {
|
||||
Button(isDescriptionExpanded ? "Less" : "More…") {
|
||||
withAnimation(.easeInOut(duration: 0.2)) {
|
||||
isDescriptionExpanded.toggle()
|
||||
}
|
||||
}
|
||||
.font(.callout)
|
||||
.foregroundStyle(.blue)
|
||||
.buttonStyle(.plain)
|
||||
}
|
||||
}
|
||||
.padding(.leading, 4)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user