git.iko.soy/parseable-macos
on master help sign in
Fix 2 bugs: LiveTail same-column include filters silently empty, stale SQL error position applied to edited text
e792c42iko
ParseableViewer/ViewModels/LiveTailViewModel.swift+9
@@ -164,6 +164,15 @@ final class LiveTailViewModel {
164 // include↔exclude stacks both and the AND'd filters match zero rows, so the
164 // include↔exclude stacks both and the AND'd filters match zero rows, so the
165 // tail silently empties.
165 // tail silently empties.
166 columnFilters.removeAll { $0.column == column && $0.value == value }
166 columnFilters.removeAll { $0.column == column && $0.value == value }
167+ if !exclude {
168+ // Include filters are AND-combined in rebuildFilteredEntries, but a column
169+ // can only equal one value, so two includes on the same column with
170+ // different values (e.g. level = info then level = error) can never both
171+ // match and the tail would silently empty. A new include therefore
172+ // replaces any prior include on that column. (Excludes legitimately stack:
173+ // col ≠ a AND col ≠ b is meaningful, so they are left untouched here.)
174+ columnFilters.removeAll { $0.column == column && !$0.exclude }
175+ }
167 columnFilters.append(ColumnFilter(column: column, value: value, exclude: exclude))
176 columnFilters.append(ColumnFilter(column: column, value: value, exclude: exclude))
168 rebuildFilteredEntries()
177 rebuildFilteredEntries()
169 }
178 }
ParseableViewer/ViewModels/QueryViewModel.swift+10−2
@@ -487,9 +487,17 @@ final class QueryViewModel {
487 errorMessage = ParseableError.userFriendlyMessage(for: error)
487 errorMessage = ParseableError.userFriendlyMessage(for: error)
488 if let serverError = error as? ParseableError,
488 if let serverError = error as? ParseableError,
489 case .serverError(_, let msg) = serverError,
489 case .serverError(_, let msg) = serverError,
490− let pos = SQLErrorPosition.parse(from: msg) {
490+ let pos = SQLErrorPosition.parse(from: msg),
491+ sqlQuery == sql {
492+ // The server's line/column is relative to the *submitted* SQL.
493+ // Only map it back into the editor when the editor still holds
494+ // that same text — if the user edited the query while it was in
495+ // flight, the position no longer corresponds to what's displayed
496+ // and would underline an unrelated span. (`sqlQuery`'s didSet
497+ // already cleared errorRange on that edit, so leaving it nil here
498+ // keeps the editor unmarked.)
491 errorRange = SQLTokenizer.errorHighlightRange(
499 errorRange = SQLTokenizer.errorHighlightRange(
492− line: pos.line, column: pos.column, in: sqlQuery
500+ line: pos.line, column: pos.column, in: sql
493 )
501 )
494 }
502 }
495 results = []
503 results = []