Commit 62e3c7dafd
62e3c7dafd265558ed379cccd7ca5877f42fafec
parent: 3ae217cf9d
Verified · cmc
cmc <hello@cleberg.net> · 2026-11-26 18:20 UTC
Fix compiler warnings in the app, widget and watch targets
Changed files (12)
Sources/OrgApp/DocumentSession.swift
+2 −2 · view
| @@ -887,7 +887,7 @@ public final class DocumentSession { |
| 887 | 887 | /// path; the subtree leaves its file only once it has. Returns a message for the echo area. |
| 888 | 888 | @discardableResult |
| 889 | 889 | public func refile(to target: RefileTarget, from: (path: String, offset: Int)? = nil, keep: Bool = false, now: Date = Date()) -> String? { |
| 890 | | guard var (path, context) = source(from, now: now) else { return from == nil ? nil : "Can't read the entry's file." } |
| 890 | guard case (let path, var context)? = source(from, now: now) else { return from == nil ? nil : "Can't read the entry's file." } |
| 891 | 891 | do { |
| 892 | 892 | switch prepareMove(path, context: context, to: target.path) { |
| 893 | 893 | case .refused(let message): return message |
| @@ -1099,7 +1099,7 @@ public final class DocumentSession { |
| 1099 | 1099 | /// Returns a message. |
| 1100 | 1100 | @discardableResult |
| 1101 | 1101 | public func archive(from: (path: String, offset: Int)? = nil, now: Date = Date()) -> String? { |
| 1102 | | guard var (path, context) = source(from, now: now) else { return from == nil ? nil : "Can't read the entry's file." } |
| 1102 | guard case (let path, var context)? = source(from, now: now) else { return from == nil ? nil : "Can't read the entry's file." } |
| 1103 | 1103 | let destination: Archive.Destination |
| 1104 | 1104 | switch Archive.destination(context, sourcePath: path) { |
| 1105 | 1105 | case .success(let value): destination = value |
Sources/Orgstar/BufferTabs.swift
+1 · view
| @@ -1,5 +1,6 @@ |
| 1 | 1 | import AppKit |
| 2 | 2 | import OrgApp |
| 3 | import OrgPresentation |
| 3 | 4 | import SwiftUI |
| 4 | 5 | |
| 5 | 6 | /// A divider that resizes the pane before it by dragging. An `HSplitView` inside the window's |
Sources/Orgstar/ContentView.swift
+3 −3 · view
| @@ -368,14 +368,14 @@ struct ContentView: View { |
| 368 | 368 | #endif |
| 369 | 369 | // `org-clock-out-when-done`, and the notification when the Effort runs out. |
| 370 | 370 | clock.notifications = SystemReminderCenter.isAvailable ? SystemReminderCenter() : nil |
| 371 | | session.textChanged = { [weak session, weak clock, weak commands] path in |
| 371 | session.textChanged = { [weak session = self.session, weak clock = self.clock, weak commands = self.commands] path in |
| 372 | 372 | guard let session, let clock, let message = clock.textChanged(path, session) else { return } |
| 373 | 373 | commands?.show(message) |
| 374 | 374 | } |
| 375 | 375 | clock.remindAtEffort(session) |
| 376 | 376 | commands.knownTags = { [index = workspace.index] in (try? index.tags()) ?? [] } |
| 377 | 377 | commands.completionIndex = workspace.index |
| 378 | | commands.handoff.place = { [weak session, weak workspace] in workspace.flatMap { session?.handoffPlace(roots: $0.rootPaths) } } |
| 378 | commands.handoff.place = { [weak session = self.session, weak workspace = self.workspace] in workspace.flatMap { session?.handoffPlace(roots: $0.rootPaths) } } |
| 379 | 379 | commands.continueHandoff = continueHandoff |
| 380 | 380 | commands.mainWindowOpen = true |
| 381 | 381 | commands.whatsNew = WhatsNew.pending(firstLaunch: noFolders && !welcomeShown) |
| @@ -987,7 +987,7 @@ struct ContentView: View { |
| 987 | 987 | } |
| 988 | 988 | guard method == .cp || method == .mv else { return } |
| 989 | 989 | #endif |
| 990 | | attachActions.attach(panel.urls, method: method) |
| 990 | self.attachActions.attach(panel.urls, method: method) |
| 991 | 991 | }) |
| 992 | 992 | } |
| 993 | 993 | |
Sources/Orgstar/LintPane.swift
+1 · view
| @@ -1,5 +1,6 @@ |
| 1 | 1 | import OrgApp |
| 2 | 2 | import OrgCore |
| 3 | import OrgPresentation |
| 3 | 4 | import SwiftUI |
| 4 | 5 | |
| 5 | 6 | /// Lint File's panel under the editor: the problems in the open file, by line. Choosing a row |
Sources/Orgstar/ReplaceInFilesSheet.swift
+1 · view
| @@ -1,5 +1,6 @@ |
| 1 | 1 | import OrgApp |
| 2 | 2 | import OrgCore |
| 3 | import OrgPresentation |
| 3 | 4 | import SwiftUI |
| 4 | 5 | |
| 5 | 6 | /// Edit ▸ Find ▸ Replace in Files…, Org ▸ TODO and Tags ▸ Rename Tag… and Rename TODO Keyword…: |
Sources/Orgstar/Sidebar.swift
+1 · view
| @@ -1,5 +1,6 @@ |
| 1 | 1 | import OrgApp |
| 2 | 2 | import OrgCore |
| 3 | import OrgPresentation |
| 3 | 4 | import OrgWorkspace |
| 4 | 5 | import SwiftUI |
| 5 | 6 | import UniformTypeIdentifiers |
Sources/Orgstar/ThemePickerSection.swift
+1 −1 · view
| @@ -35,7 +35,7 @@ struct ThemePickerSection: View { |
| 35 | 35 | ForEach(ThemeSpec.palettes(appearance), id: \.id) { palette in |
| 36 | 36 | Label { |
| 37 | 37 | // Below 4.5:1 for body text or coloured roles in places. |
| 38 | | palette.lowContrast ? Text(palette.displayName) + Text(verbatim: " – ") + Text("Low contrast") : Text(palette.displayName) |
| 38 | palette.lowContrast ? Text("\(Text(palette.displayName))\(Text(verbatim: " – "))\(Text("Low contrast"))") : Text(palette.displayName) |
| 39 | 39 | } icon: { Image(nsImage: Self.swatch(palette)) }.tag(palette.id) |
| 40 | 40 | } |
| 41 | 41 | if ThemeSpec.palette(selection.wrappedValue, appearance) == nil { |
Sources/OrgstarMobile/MobileFragments.swift
+1 −1 · view
| @@ -153,7 +153,7 @@ final class EditorFind: NSObject, @preconcurrency UITextSearching, UIFindInterac |
| 153 | 153 | |
| 154 | 154 | /// Where `query` is in `text`, as the find bar's options ask: case, and matching a word's |
| 155 | 155 | /// start or a whole word. |
| 156 | | nonisolated static func matches(of query: String, in text: NSString, options: UITextSearchOptions) -> [Range<Int>] { |
| 156 | static func matches(of query: String, in text: NSString, options: UITextSearchOptions) -> [Range<Int>] { |
| 157 | 157 | func isWord(_ index: Int) -> Bool { |
| 158 | 158 | guard index >= 0, index < text.length, let scalar = Unicode.Scalar(text.character(at: index)) else { return false } |
| 159 | 159 | return CharacterSet.alphanumerics.contains(scalar) |
Sources/OrgstarMobile/ReaderScreen.swift
+10 −4 · view
| @@ -621,12 +621,18 @@ final class ReaderFind: NSObject, @preconcurrency UITextSearching, UIFindInterac |
| 621 | 621 | return a < b ? .orderedAscending : a > b ? .orderedDescending : .orderedSame |
| 622 | 622 | } |
| 623 | 623 | |
| 624 | | /// May be called off the main thread; reads only `text`, an immutable string. |
| 625 | 624 | nonisolated func performTextSearch(queryString: String, options: UITextSearchOptions, resultAggregator: UITextSearchAggregator<AnyHashable?>) { |
| 626 | | for found in EditorFind.matches(of: queryString, in: text, options: options) { |
| 627 | | resultAggregator.foundRange(TextRange(found), searchString: queryString, document: nil) |
| 625 | // The aggregator takes results from any thread; the ranges are made on the main thread. |
| 626 | nonisolated(unsafe) let aggregator = resultAggregator |
| 627 | let search = { |
| 628 | MainActor.assumeIsolated { |
| 629 | for found in EditorFind.matches(of: queryString, in: self.text, options: options) { |
| 630 | aggregator.foundRange(TextRange(found), searchString: queryString, document: nil) |
| 631 | } |
| 632 | } |
| 633 | aggregator.finishedSearching() |
| 628 | 634 | } |
| 629 | | resultAggregator.finishedSearching() |
| 635 | if Thread.isMainThread { search() } else { DispatchQueue.main.sync(execute: search) } |
| 630 | 636 | } |
| 631 | 637 | |
| 632 | 638 | func decorate(foundTextRange: UITextRange, document: AnyHashable??, usingStyle style: UITextSearchFoundTextStyle) { |
Sources/OrgstarWatchWidgets/WatchWidgets.swift
+2 −2 · view
| @@ -72,7 +72,7 @@ struct NextEntryView: View { |
| 72 | 72 | .accessibilityLabel(Text("\(open) open today")) |
| 73 | 73 | case .accessoryCorner: |
| 74 | 74 | Text("\(open)").font(.title3.weight(.semibold)).widgetLabel { Text(next?.title ?? String(localized: "Agenda clear")) } |
| 75 | | .accessibilityLabel(Text("\(open) open today") + Text(verbatim: next.map { ", \($0.title)" } ?? "")) |
| 75 | .accessibilityLabel(Text("\(Text("\(open) open today"))\(Text(verbatim: next.map { ", \($0.title)" } ?? ""))")) |
| 76 | 76 | default: |
| 77 | 77 | VStack(alignment: .leading, spacing: 0) { |
| 78 | 78 | Text(next?.gutter ?? String(localized: "Agenda")).font(.headline).widgetAccentable().lineLimit(1) |
| @@ -114,7 +114,7 @@ struct ClockView: View { |
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | .accessibilityElement(children: .ignore) |
| 117 | | .accessibilityLabel(clock.map { Text("Clocked in") + Text(verbatim: ", \($0.heading), ") + Text($0.startedAt, style: .timer) } ?? Text("Not clocked in")) |
| 117 | .accessibilityLabel(clock.map { Text("\(Text("Clocked in"))\(Text(verbatim: ", \($0.heading), "))\(Text($0.startedAt, style: .timer))") } ?? Text("Not clocked in")) |
| 118 | 118 | default: |
| 119 | 119 | VStack(alignment: .leading, spacing: 0) { |
| 120 | 120 | if let clock { |
Sources/OrgstarWidgets/HabitsWidget.swift
+1 −1 · view
| @@ -140,7 +140,7 @@ struct HabitCells: View { |
| 140 | 140 | } |
| 141 | 141 | } |
| 142 | 142 | .accessibilityElement(children: .ignore) |
| 143 | | .accessibilityLabel(Text("Done \(cells.filter { $0.glyph == "*" }.count) of \(cells.count) days") + Text(verbatim: ", ") + todayState) |
| 143 | .accessibilityLabel(Text("\(Text("Done \(cells.filter { $0.glyph == "*" }.count) of \(cells.count) days"))\(Text(verbatim: ", "))\(todayState)")) |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | /// Today's state in words. |
Sources/OrgstarWidgets/TodayWidget.swift
+1 −1 · view
| @@ -165,7 +165,7 @@ struct WideRow: View { |
| 165 | 165 | if let priority = row.priority { parts.append(Text("Priority \(priority)")) } |
| 166 | 166 | parts.append(Text(verbatim: row.title)) |
| 167 | 167 | if !row.category.isEmpty { parts.append(Text(verbatim: row.category)) } |
| 168 | | return parts.dropFirst().reduce(parts[0]) { $0 + Text(verbatim: ", ") + $1 } |
| 168 | return parts.dropFirst().reduce(parts[0]) { Text("\($0)\(Text(verbatim: ", "))\($1)") } |
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | 171 | |