diff --git a/CHANGELOG.md b/CHANGELOG.md index 67781b98e..a4d826891 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,7 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Switching schemas on an Oracle connection no longer hangs on an infinite loading spinner. Oracle now switches by schema like BigQuery, the sidebar lists every schema with its tables loading on expand, Oracle queries respect the query timeout setting and reconnect automatically after a timeout, and a schema load that fails shows an error with a Retry button instead of spinning forever. Works with an already-installed Oracle plugin; updating the plugin adds the query timeout enforcement. (#1807) - Resizing a data grid column no longer triggers a sort. Dragging a column edge only resizes it; clicking the header still sorts. (#1815) - Hidden columns stay hidden. The columns you choose to show are remembered per table across sessions, and resizing a column no longer brings the hidden ones back. Column widths and order are remembered per table too, now kept separately for each connection, database, and schema so two tables with the same name no longer overwrite each other's layout. A Reset Columns button in the Columns popover puts widths, order, and visibility back to defaults. Existing saved column layouts (widths, order, and which columns are hidden) reset once as part of this change. (#1815) -- Query and filter errors now appear in a scrollable banner you can read, select, and copy, with a Fix with AI button, instead of a small dialog that cut the message off. (#1815) +- Query and filter errors now appear in a banner you can read, select, and copy, with a Fix with AI button, instead of a small dialog that cut the message off. The banner sizes to the message, staying a single line for short errors and scrolling only when the message is long. (#1815) - The filter autocomplete no longer pops up on empty input, and pressing Escape to close it no longer also closes the filter bar. (#1815) - The editor autocomplete popup no longer draws over the status bar, the Columns and Add buttons, or the editor's sides as it grows. Clicking anywhere on the popup that isn't a suggestion now dismisses it, instead of doing nothing and leaving the editor mouse dead. (#1815, #1831) diff --git a/TablePro/Views/Results/InlineErrorBanner.swift b/TablePro/Views/Results/InlineErrorBanner.swift index a07a8e87e..85fc9062b 100644 --- a/TablePro/Views/Results/InlineErrorBanner.swift +++ b/TablePro/Views/Results/InlineErrorBanner.swift @@ -13,6 +13,11 @@ struct InlineErrorBanner: View { var onFixWithAI: (() -> Void)? var onDismiss: (() -> Void)? + private let maxMessageHeight: CGFloat = 96 + @State private var messageHeight: CGFloat = 0 + + private var messageFits: Bool { messageHeight <= maxMessageHeight } + var body: some View { HStack(alignment: .top, spacing: 8) { Image(systemName: "exclamationmark.triangle.fill") @@ -22,8 +27,15 @@ struct InlineErrorBanner: View { .font(.subheadline) .textSelection(.enabled) .frame(maxWidth: .infinity, alignment: .leading) + .onGeometryChange(for: CGFloat.self) { proxy in + proxy.size.height + } action: { height in + messageHeight = height + } } - .frame(maxHeight: 96) + .frame(height: min(messageHeight, maxMessageHeight)) + .scrollDisabled(messageFits) + .scrollBounceBehavior(.basedOnSize) if let onFixWithAI { Button(String(localized: "Fix with AI")) { onFixWithAI() } .controlSize(.small) @@ -55,9 +67,17 @@ struct InlineErrorBanner: View { } #Preview { - InlineErrorBanner( - message: "ERROR 1064 (42000): You have an error in your SQL syntax", - onDismiss: {} - ) + VStack(spacing: 0) { + InlineErrorBanner(message: "near \"Album\": syntax error", onDismiss: {}) + Divider() + InlineErrorBanner( + message: String( + repeating: "ERROR 1064 (42000): You have an error in your SQL syntax near this token. ", + count: 8 + ), + onFixWithAI: {}, + onDismiss: {} + ) + } .frame(width: 600) }