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:
2026-06-16 14:39:53 +02:00
parent ef1c05c13b
commit b3bb7c4a59
3 changed files with 222 additions and 45 deletions
+12 -1
View File
@@ -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)
}