iOS highlighting, shrunk columns, reader display, selection colour; fixes; manual; Xcode project !178

merged merged by cmc on 2026-10-09 04:06 UTC · krz/orgstar:ios-gaps into main

36 files changed, +1732 −172

Layout: unified · split

.gitignore +1
@@ -3,3 +3,4 @@
3*.xcodeproj/xcuserdata/ 3*.xcodeproj/xcuserdata/
4DerivedData/ 4DerivedData/
5.DS_Store 5.DS_Store
6*.xcodeproj/project.xcworkspace/xcuserdata/
Package.swift +1 −1
@@ -84,7 +84,7 @@ let package = Package(
84 .target(name: "OrgApp", dependencies: ["OrgWorkspace", "OrgDocument", "OrgPresentation"]), 84 .target(name: "OrgApp", dependencies: ["OrgWorkspace", "OrgDocument", "OrgPresentation"]),
85 .executableTarget(name: "Orgstar", dependencies: ["OrgApp", "OrgEditorAppKit", "OrgHighlight"]), 85 .executableTarget(name: "Orgstar", dependencies: ["OrgApp", "OrgEditorAppKit", "OrgHighlight"]),
86 // The iOS app, bundled by scripts/build-ios-app.sh. 86 // The iOS app, bundled by scripts/build-ios-app.sh.
87 .executableTarget(name: "OrgstarMobile", dependencies: ["OrgApp"]), 87 .executableTarget(name: "OrgstarMobile", dependencies: ["OrgApp", "OrgHighlight"]),
88 // App extensions, bundled into Orgstar.app by scripts/build-app.sh. 88 // App extensions, bundled into Orgstar.app by scripts/build-app.sh.
89 .executableTarget(name: "OrgstarQuickLook", dependencies: ["OrgCore"], linkerSettings: extensionEntry), 89 .executableTarget(name: "OrgstarQuickLook", dependencies: ["OrgCore"], linkerSettings: extensionEntry),
90 .executableTarget(name: "OrgstarSpotlight", dependencies: ["OrgCore"], linkerSettings: extensionEntry), 90 .executableTarget(name: "OrgstarSpotlight", dependencies: ["OrgCore"], linkerSettings: extensionEntry),
README.md +4 −1
@@ -34,7 +34,10 @@ header names, as `org-babel-tangle` does.
34bookmarklets written for org-protocol work unchanged. Shortcuts has a 34bookmarklets written for org-protocol work unchanged. Shortcuts has a
35"Capture to Orgstar" action that files text with a capture template. 35"Capture to Orgstar" action that files text with a capture template.
36 36
37The iOS app (iOS 26) builds for the Simulator: 37The iOS app (iOS 26) is the "Orgstar iOS" scheme in `ios/Orgstar.xcodeproj`, with the
38share and Quick Look extensions. It builds from the package's sources and signs
39automatically with the team set in the project; choose a device or Simulator and Run.
40For the Simulator without Xcode:
38 41
39```sh 42```sh
40scripts/build-ios-app.sh # builds .build/ios-app/Orgstar.app 43scripts/build-ios-app.sh # builds .build/ios-app/Orgstar.app
Sources/OrgCore/Compute/Babel.swift +1 −1
@@ -1022,7 +1022,7 @@ public enum Babel {
1022 static func propertyLayers(language: String, heading: Int?, model: DocumentModel) -> [[(String, String)]] { 1022 static func propertyLayers(language: String, heading: Int?, model: DocumentModel) -> [[(String, String)]] {
1023 var levels = [model.fileProperties] 1023 var levels = [model.fileProperties]
1024 if let heading { 1024 if let heading {
1025 levels += (model.ancestors(of: heading).reversed() + [heading]).map { model.headings[$0].properties } 1025 levels += (model.ancestors(of: heading) + [heading]).map { model.headings[$0].properties }
1026 } 1026 }
1027 return ["header-args", "header-args:\(language)"].compactMap { key in 1027 return ["header-args", "header-args:\(language)"].compactMap { key in
1028 var value: String? 1028 var value: String?
Sources/OrgEditorAppKit/OrgEditor.swift +13 −67
@@ -180,7 +180,7 @@ public final class OrgEditor: NSObject {
180 indented = startup.indented 180 indented = startup.indented
181 hideStars = startup.hideStars 181 hideStars = startup.hideStars
182 if startup.folds != FoldState() { setFolds(startup.folds, wrappers: startup.wrappers) } 182 if startup.folds != FoldState() { setFolds(startup.folds, wrappers: startup.wrappers) }
183 shrinkAtStartup() 183 shrunk = ShrunkColumns.startup(document.tree)
184 if startup.inlineImages { showsImages = true } 184 if startup.inlineImages { showsImages = true }
185 if startup.alignTables { _ = perform(AlignAllTables()) } 185 if startup.alignTables { _ = perform(AlignAllTables()) }
186 if !indented || !hideStars { restyleOutsideEditing(0..<utf16Length) } 186 if !indented || !hideStars { restyleOutsideEditing(0..<utf16Length) }
@@ -812,18 +812,13 @@ public final class OrgEditor: NSObject {
812 812
813 // MARK: - Shrunk table columns 813 // MARK: - Shrunk table columns
814 814
815 /// Narrowed table columns (`org-table-shrink`): by table start, each column's segments. 815 /// Narrowed table columns (`org-table-shrink`).
816 /// Recomputed as the text changes; typing into one widens its column again, as editing 816 private var shrunk = ShrunkColumns()
817 /// org's overlays deletes them. Commands' edits keep columns narrow, as `org-table-align`
818 /// shrinks them again.
819 private var shrunk: [Int: [Int: [TableShrink.Segment]]] = [:]
820 private var commandEditing = false 817 private var commandEditing = false
821 818
822 /// Narrows `columns` of `table` and widens its others. 819 /// Narrows `columns` of `table` and widens its others.
823 private func setShrunk(_ columns: [Int], in table: Range<Int>) { 820 private func setShrunk(_ columns: [Int], in table: Range<Int>) {
824 let text = textView.string 821 shrunk.set(columns, in: table, text: textView.string)
825 let segments = Dictionary(uniqueKeysWithValues: columns.map { ($0, TableShrink.segments(table, column: $0, in: text)) })
826 shrunk[table.lowerBound] = segments.isEmpty ? nil : segments
827 restyleOutsideEditing(table) 822 restyleOutsideEditing(table)
828 textLayoutManager.invalidateLayout(for: textLayoutManager.documentRange) 823 textLayoutManager.invalidateLayout(for: textLayoutManager.documentRange)
829 textView.needsDisplay = true 824 textView.needsDisplay = true
@@ -832,73 +827,22 @@ public final class OrgEditor: NSObject {
832 /// C-c TAB in a table: `org-table-toggle-column-width`; `shrink` for `org-table-shrink`, 827 /// C-c TAB in a table: `org-table-toggle-column-width`; `shrink` for `org-table-shrink`,
833 /// `expand` for `org-table-expand`. 828 /// `expand` for `org-table-expand`.
834 private func tableColumnWidth(_ id: String) { 829 private func tableColumnWidth(_ id: String) {
835 let caret = textView.selectedRange().location 830 switch shrunk.change(for: id, at: textView.selectedRange().location, in: textView.string) {
836 let text = textView.string 831 case .notInTable: onMessage?("Not in a table")
837 guard let table = TableShrink.table(at: caret, in: text) else { 832 case .set(let columns, let table): setShrunk(columns, in: table)
838 onMessage?("Not in a table") 833 case .ask(let table, let current, let max):
839 return
840 }
841 let current = shrunk[table.lowerBound].map { Array($0.keys) } ?? []
842 switch id {
843 case "org.table.shrink": setShrunk(TableShrink.cookieColumns(table, in: text), in: table)
844 case "org.table.expand": setShrunk([], in: table)
845 default:
846 if let column = TableShrink.column(at: caret, in: text) {
847 setShrunk(Array(Set(current).symmetricDifference([column])), in: table)
848 return
849 }
850 let line = (text as NSString).lineRange(for: NSRange(location: caret, length: 0))
851 onPrompt?(Prompt(key: "columns", message: "Column ranges (e.g. 2-4 6-):")) { [weak self] answer in 834 onPrompt?(Prompt(key: "columns", message: "Column ranges (e.g. 2-4 6-):")) { [weak self] answer in
852 guard let self, let answer else { return } 835 guard let self, let answer else { return }
853 self.setShrunk(Array(Set(current).symmetricDifference(TableShrink.columns(answer, max: line.length / 2))), in: table) 836 self.setShrunk(ShrunkColumns.toggled(current, TableShrink.columns(answer, max: max)), in: table)
854 } 837 }
855 } 838 }
856 } 839 }
857 840
858 /// `#+STARTUP: shrink`: every table's columns with width cookies start narrow.
859 private func shrinkAtStartup() {
860 guard Presentation.startupOptions(document.tree).contains(where: { $0.lowercased() == "shrink" }) else { return }
861 let text = textView.string
862 var offset = 0
863 let ns = text as NSString
864 while offset < ns.length {
865 let line = ns.lineRange(for: NSRange(location: offset, length: 0))
866 defer { offset = max(NSMaxRange(line), offset + 1) }
867 guard ns.substring(with: line).range(of: "^[ \\t]*\\|", options: .regularExpression) != nil,
868 let table = TableShrink.table(at: line.location, in: text) else { continue }
869 let columns = TableShrink.cookieColumns(table, in: text)
870 if !columns.isEmpty { shrunk[table.lowerBound] = Dictionary(uniqueKeysWithValues: columns.map { ($0, TableShrink.segments(table, column: $0, in: text)) }) }
871 offset = table.upperBound
872 }
873 }
874
875 /// Moves shrunk columns through `edit`; returns the tables to restyle.
876 private func mapShrunk(through edit: TextEdit) -> [Range<Int>] {
877 guard !shrunk.isEmpty else { return [] }
878 let text = textView.string
879 let delta = edit.replacement.utf16.count - edit.range.count
880 var mapped: [Int: [Int: [TableShrink.Segment]]] = [:]
881 var tables: [Range<Int>] = []
882 for (start, columns) in shrunk {
883 let kept = columns.filter { _, segments in
884 commandEditing || !segments.contains { $0.range.lowerBound <= edit.range.upperBound && edit.range.lowerBound <= $0.range.upperBound }
885 }.keys
886 let touched = columns.values.joined().contains { $0.range.lowerBound <= edit.range.upperBound && edit.range.lowerBound <= $0.range.upperBound }
887 let newStart = start < edit.range.lowerBound ? start : start >= edit.range.upperBound ? start + delta : edit.range.lowerBound
888 guard let table = TableShrink.table(at: min(newStart, max(0, text.utf16.count - 1)), in: text) else { continue }
889 if touched || kept.count != columns.count { tables.append(table) }
890 guard !kept.isEmpty else { continue }
891 mapped[table.lowerBound] = Dictionary(uniqueKeysWithValues: kept.map { ($0, TableShrink.segments(table, column: $0, in: text)) })
892 }
893 shrunk = mapped
894 return tables
895 }
896
897 /// Hides each shrunk segment's text and draws its display where the text was. 841 /// Hides each shrunk segment's text and draws its display where the text was.
898 private func applyShrunk(_ range: Range<Int>, in storage: NSTextStorage) { 842 private func applyShrunk(_ range: Range<Int>, in storage: NSTextStorage) {
899 guard !shrunk.isEmpty else { return } 843 guard !shrunk.isEmpty else { return }
900 let cell = ("0" as NSString).size(withAttributes: [.font: theme.font]).width 844 let cell = ("0" as NSString).size(withAttributes: [.font: theme.font]).width
901 for segment in shrunk.values.flatMap({ $0.values.joined() }) where segment.range.overlaps(range) && segment.range.upperBound <= storage.length { 845 for segment in shrunk.segments where segment.range.overlaps(range) && segment.range.upperBound <= storage.length {
902 let r = segment.range 846 let r = segment.range
903 let shown = segment.display.count 847 let shown = segment.display.count
904 let kept = min(shown, r.count) 848 let kept = min(shown, r.count)
@@ -1233,7 +1177,7 @@ public final class OrgEditor: NSObject {
1233 highlights = [] 1177 highlights = []
1234 updateHidden() 1178 updateHidden()
1235 restyle(min(oldMapped.lowerBound, newAffected.lowerBound)..<min(max(oldMapped.upperBound, newAffected.upperBound), newText.length), in: storage) 1179 restyle(min(oldMapped.lowerBound, newAffected.lowerBound)..<min(max(oldMapped.upperBound, newAffected.upperBound), newText.length), in: storage)
1236 for table in mapShrunk(through: edit) { restyle(table.lowerBound..<min(table.upperBound, newText.length), in: storage) } 1180 for table in shrunk.map(through: edit, in: storage.string, command: commandEditing) { restyle(table.lowerBound..<min(table.upperBound, newText.length), in: storage) }
1237 for range in oldHighlights where range.upperBound <= newText.length { 1181 for range in oldHighlights where range.upperBound <= newText.length {
1238 let lines = newText.lineRange(for: NSRange(range)) 1182 let lines = newText.lineRange(for: NSRange(range))
1239 restyle(lines.location..<NSMaxRange(lines), in: storage) 1183 restyle(lines.location..<NSMaxRange(lines), in: storage)
@@ -1352,6 +1296,8 @@ extension OrgEditor: DocumentBuffer {
1352 var state = view 1296 var state = view
1353 state.selection = [selected.location..<NSMaxRange(selected)] 1297 state.selection = [selected.location..<NSMaxRange(selected)]
1354 let mapped = state.mapped(through: edits) 1298 let mapped = state.mapped(through: edits)
1299 // Shrunk columns were measured on the old text.
1300 shrunk = ShrunkColumns()
1355 load(document.text) 1301 load(document.text)
1356 setFolds(FoldState(folds: mapped.folds, bodyFolds: mapped.bodyFolds, wrapperFolds: mapped.wrapperFolds)) 1302 setFolds(FoldState(folds: mapped.folds, bodyFolds: mapped.bodyFolds, wrapperFolds: mapped.wrapperFolds))
1357 let selection = mapped.selection[0] 1303 let selection = mapped.selection[0]
Sources/OrgEditorAppKit/Theme.swift +1 −15
@@ -118,21 +118,7 @@ struct Theme {
118 case .block: 118 case .block:
119 break 119 break
120 case .syntax(let category): 120 case .syntax(let category):
121 if let key = Self.slot(category) { fg(key) } 121 if let key = category.themeKey { fg(key) }
122 }
123 }
124
125 static func slot(_ category: SyntaxCategory) -> String? {
126 switch category {
127 case .keyword: "syntax-keyword"
128 case .string: "syntax-string"
129 case .comment: "syntax-comment"
130 case .function: "syntax-function"
131 case .type: "syntax-type"
132 case .number, .constant, .escape: "syntax-number"
133 case .property, .attribute, .tag: "syntax-property"
134 case .label: "syntax-label"
135 case .variable, .operator, .punctuation: nil
136 } 122 }
137 } 123 }
138 124
Sources/OrgPresentation/Presentation.swift +18 −1
@@ -51,7 +51,24 @@ public enum SyntaxCategory: String, Hashable, Sendable, CaseIterable {
51 } 51 }
52} 52}
53 53
54/// Highlights source code; the platform supplies one (tree-sitter on macOS; iOS supplies none). 54extension SyntaxCategory {
55 /// The theme color for this kind of token; nil for those drawn in the text color.
56 public var themeKey: String? {
57 switch self {
58 case .keyword: "syntax-keyword"
59 case .string: "syntax-string"
60 case .comment: "syntax-comment"
61 case .function: "syntax-function"
62 case .type: "syntax-type"
63 case .number, .constant, .escape: "syntax-number"
64 case .property, .attribute, .tag: "syntax-property"
65 case .label: "syntax-label"
66 case .variable, .operator, .punctuation: nil
67 }
68 }
69}
70
71/// Highlights source code; the apps supply tree-sitter's (OrgHighlight).
55public protocol CodeHighlighter: Sendable { 72public protocol CodeHighlighter: Sendable {
56 /// Categories for ranges of `code`, in UTF-16 offsets; later runs win over earlier ones. 73 /// Categories for ranges of `code`, in UTF-16 offsets; later runs win over earlier ones.
57 /// Empty for languages it doesn't know. 74 /// Empty for languages it doesn't know.
Sources/OrgPresentation/ReadingText.swift +51 −6
@@ -12,12 +12,30 @@ public enum ReadingText {
12 public var link: OrgLink? 12 public var link: OrgLink?
13 /// Where the text starts in the file. 13 /// Where the text starts in the file.
14 public var offset: Int 14 public var offset: Int
15 /// A pretty sub/superscript's body: true raised, false lowered.
16 public var superscript: Bool?
17 }
18
19 /// How the text shows, as the editor's display settings make it.
20 public struct Display: Sendable {
21 /// Link brackets and targets, and emphasis markers, shown; no pretty entities.
22 public var showMarkup = false
23 /// `org-hide-emphasis-markers`, `org-pretty-entities` and its braces.
24 public var options = EditingOptions.org
25 /// Colors code in src blocks.
26 public var highlighter: (any CodeHighlighter)?
27
28 public init(showMarkup: Bool = false, options: EditingOptions = .org, highlighter: (any CodeHighlighter)? = nil) {
29 self.showMarkup = showMarkup
30 self.options = options
31 self.highlighter = highlighter
32 }
15 } 33 }
16 34
17 /// `folded` are drawers' and blocks' hidden ranges (`Wrapper.hidden`). 35 /// `folded` are drawers' and blocks' hidden ranges (`Wrapper.hidden`).
18 public static func segments(_ tree: OrgTree, in range: Range<Int>, folded: [Range<Int>] = []) -> [Segment] { 36 public static func segments(_ tree: OrgTree, in range: Range<Int>, folded: [Range<Int>] = [], display: Display = Display()) -> [Segment] {
19 let text = tree.text as NSString 37 let text = tree.text as NSString
20 let runs = Presentation.styles(tree, in: range) 38 let runs = Presentation.styles(tree, in: range, highlighter: display.highlighter)
21 // A fold hides from the end of the opening line through the closing line, so the 39 // A fold hides from the end of the opening line through the closing line, so the
22 // marker sits on the opening line. 40 // marker sits on the opening line.
23 let folds = folded.compactMap { r -> Range<Int>? in 41 let folds = folded.compactMap { r -> Range<Int>? in
@@ -25,16 +43,40 @@ public enum ReadingText {
25 let end = r.upperBound > r.lowerBound && r.upperBound <= text.length && text.character(at: r.upperBound - 1) == 10 ? r.upperBound - 1 : r.upperBound 43 let end = r.upperBound > r.lowerBound && r.upperBound <= text.length && text.character(at: r.upperBound - 1) == 10 ? r.upperBound - 1 : r.upperBound
26 return (r.lowerBound - 1)..<min(end, range.upperBound) 44 return (r.lowerBound - 1)..<min(end, range.upperBound)
27 } 45 }
28 let hidden = runs.filter { $0.role == .linkMarkup }.map(\.range) + folds 46 var hidden = runs.filter { !display.showMarkup && Presentation.hidesWithMarkup($0.role, options: display.options) }.map(\.range) + folds
47 // `org-pretty-entities`: an entity's last character shows its character, the rest hidden.
48 var replaced: [Int: String] = [:]
49 var scripts: [(range: Range<Int>, superscript: Bool)] = []
50 if !display.showMarkup, display.options.prettyEntities {
51 let blocks = Presentation.shadedBlocks(tree)
52 let pretty = Presentation.prettyRuns(
53 text, in: range, revealedLine: nil, inBlock: { offset in blocks.contains { $0.contains(offset) } },
54 scriptExclusions: runs.filter { Presentation.excludesScripts($0.role) }.map(\.range),
55 subSuperscriptsNeedBraces: display.options.subSuperscriptsNeedBraces
56 )
57 for (lineStart, run) in pretty {
58 switch run {
59 case .entity(let r, let shown):
60 let last = lineStart + r.upperBound - 1
61 hidden.append((lineStart + r.lowerBound)..<last)
62 replaced[last] = shown
63 case .script(let markers, let body, let superscript):
64 hidden += markers.map { (lineStart + $0.lowerBound)..<(lineStart + $0.upperBound) }
65 scripts.append(((lineStart + body.lowerBound)..<(lineStart + body.upperBound), superscript))
66 }
67 }
68 }
29 var bounds: Set<Int> = [range.lowerBound, range.upperBound] 69 var bounds: Set<Int> = [range.lowerBound, range.upperBound]
30 for r in runs.map(\.range) + hidden { 70 let replacedRanges = replaced.keys.map { $0..<($0 + 1) }
71 for r in runs.map(\.range) + hidden + replacedRanges + scripts.map(\.range) {
31 bounds.insert(max(range.lowerBound, min(range.upperBound, r.lowerBound))) 72 bounds.insert(max(range.lowerBound, min(range.upperBound, r.lowerBound)))
32 bounds.insert(max(range.lowerBound, min(range.upperBound, r.upperBound))) 73 bounds.insert(max(range.lowerBound, min(range.upperBound, r.upperBound)))
33 } 74 }
34 let points = bounds.sorted() 75 let points = bounds.sorted()
35 var segments: [Segment] = [] 76 var segments: [Segment] = []
36 func append(_ segment: Segment) { 77 func append(_ segment: Segment) {
37 if var last = segments.last, last.roles == segment.roles, last.link == segment.link, last.offset + (last.text as NSString).length == segment.offset { 78 if var last = segments.last, last.roles == segment.roles, last.link == segment.link, last.superscript == segment.superscript,
79 last.offset + (last.text as NSString).length == segment.offset {
38 last.text += segment.text 80 last.text += segment.text
39 segments[segments.count - 1] = last 81 segments[segments.count - 1] = last
40 } else { 82 } else {
@@ -48,7 +90,10 @@ public enum ReadingText {
48 if hidden.contains(where: { $0.lowerBound <= a && b <= $0.upperBound }) { continue } 90 if hidden.contains(where: { $0.lowerBound <= a && b <= $0.upperBound }) { continue }
49 let roles = Set(runs.filter { $0.range.lowerBound <= a && b <= $0.range.upperBound }.map(\.role)) 91 let roles = Set(runs.filter { $0.range.lowerBound <= a && b <= $0.range.upperBound }.map(\.role))
50 let link = roles.contains(.link) ? Links.link(at: a, text: tree.text, tree: tree)?.link : nil 92 let link = roles.contains(.link) ? Links.link(at: a, text: tree.text, tree: tree)?.link : nil
51 append(Segment(text: text.substring(with: NSRange(location: a, length: b - a)), roles: roles, link: link, offset: a)) 93 let superscript = scripts.first { $0.range.lowerBound <= a && b <= $0.range.upperBound }?.superscript
94 let shown = replaced[a] ?? text.substring(with: NSRange(location: a, length: b - a))
95 let segment = Segment(text: shown, roles: roles, link: link, offset: a, superscript: superscript)
96 if replaced[a] != nil { segments.append(segment) } else { append(segment) }
52 } 97 }
53 return segments 98 return segments
54 } 99 }
Sources/OrgPresentation/ShrunkColumns.swift added +101
@@ -0,0 +1,101 @@
1import Foundation
2import OrgCore
3
4/// Narrowed table columns (`org-table-shrink`), as the Mac and iOS editors keep them: by table
5/// start, each column's segments. Recomputed as the text changes; typing into one widens its
6/// column again, as editing org's overlays deletes them, while commands' edits keep columns
7/// narrow, as `org-table-align` shrinks them again.
8public struct ShrunkColumns: Sendable, Equatable {
9 public private(set) var tables: [Int: [Int: [TableShrink.Segment]]] = [:]
10
11 public init() {}
12
13 public var isEmpty: Bool { tables.isEmpty }
14
15 /// Every shrunk field's segments.
16 public var segments: [TableShrink.Segment] { tables.values.flatMap { $0.values.joined() } }
17
18 /// The shrunk columns of the table starting at `table`.
19 public func columns(in table: Range<Int>) -> [Int] {
20 tables[table.lowerBound].map { Array($0.keys).sorted() } ?? []
21 }
22
23 /// Narrows `columns` of `table` and widens its others.
24 public mutating func set(_ columns: [Int], in table: Range<Int>, text: String) {
25 let segments = Dictionary(uniqueKeysWithValues: columns.map { ($0, TableShrink.segments(table, column: $0, in: text)) })
26 tables[table.lowerBound] = segments.isEmpty ? nil : segments
27 }
28
29 /// `#+STARTUP: shrink`: every table's columns with width cookies start narrow.
30 public static func startup(_ tree: OrgTree) -> ShrunkColumns {
31 var result = ShrunkColumns()
32 guard Presentation.startupOptions(tree).contains(where: { $0.lowercased() == "shrink" }) else { return result }
33 let text = tree.text
34 let ns = text as NSString
35 var offset = 0
36 while offset < ns.length {
37 let line = ns.lineRange(for: NSRange(location: offset, length: 0))
38 defer { offset = max(NSMaxRange(line), offset + 1) }
39 guard ns.substring(with: line).range(of: "^[ \\t]*\\|", options: .regularExpression) != nil,
40 let table = TableShrink.table(at: line.location, in: text) else { continue }
41 let columns = TableShrink.cookieColumns(table, in: text)
42 if !columns.isEmpty { result.set(columns, in: table, text: text) }
43 offset = table.upperBound
44 }
45 return result
46 }
47
48 /// Moves the columns through `edit`, `text` being the text after it; columns the edit
49 /// touched widen unless `command` made it. Returns the tables to restyle.
50 public mutating func map(through edit: TextEdit, in text: String, command: Bool) -> [Range<Int>] {
51 guard !tables.isEmpty else { return [] }
52 let delta = edit.replacement.utf16.count - edit.range.count
53 func touches(_ segment: TableShrink.Segment) -> Bool {
54 segment.range.lowerBound <= edit.range.upperBound && edit.range.lowerBound <= segment.range.upperBound
55 }
56 var mapped: [Int: [Int: [TableShrink.Segment]]] = [:]
57 var restyle: [Range<Int>] = []
58 for (start, columns) in tables {
59 let kept = columns.filter { _, segments in command || !segments.contains(where: touches) }.keys
60 let touched = columns.values.joined().contains(where: touches)
61 let newStart = start < edit.range.lowerBound ? start : start >= edit.range.upperBound ? start + delta : edit.range.lowerBound
62 guard let table = TableShrink.table(at: min(newStart, max(0, text.utf16.count - 1)), in: text) else { continue }
63 if touched || kept.count != columns.count { restyle.append(table) }
64 guard !kept.isEmpty else { continue }
65 mapped[table.lowerBound] = Dictionary(uniqueKeysWithValues: kept.map { ($0, TableShrink.segments(table, column: $0, in: text)) })
66 }
67 tables = mapped
68 return restyle
69 }
70
71 /// What a column width command does at `caret`.
72 public enum Change: Equatable, Sendable {
73 case notInTable
74 /// Shrink these columns of the table, expanding the others.
75 case set([Int], table: Range<Int>)
76 /// Ask for column ranges, then toggle them (`toggled`).
77 case ask(table: Range<Int>, current: [Int], max: Int)
78 }
79
80 /// `org-table-toggle-column-width` (`org.table.toggle-column-width`), `org-table-shrink`
81 /// (`org.table.shrink`) and `org-table-expand` (`org.table.expand`) at `caret`.
82 public func change(for id: String, at caret: Int, in text: String) -> Change {
83 guard let table = TableShrink.table(at: caret, in: text) else { return .notInTable }
84 let current = columns(in: table)
85 switch id {
86 case "org.table.shrink": return .set(TableShrink.cookieColumns(table, in: text), table: table)
87 case "org.table.expand": return .set([], table: table)
88 default:
89 if let column = TableShrink.column(at: caret, in: text) {
90 return .set(Self.toggled(current, [column]), table: table)
91 }
92 let line = (text as NSString).lineRange(for: NSRange(location: caret, length: 0))
93 return .ask(table: table, current: current, max: line.length / 2)
94 }
95 }
96
97 /// `current` with `columns` toggled.
98 public static func toggled(_ current: [Int], _ columns: [Int]) -> [Int] {
99 Set(current).symmetricDifference(columns).sorted()
100 }
101}
Sources/OrgstarMobile/EditorScreen.swift +2
@@ -414,6 +414,8 @@ struct CommandPalette: View {
414 ("app.clock.default", "Mark as Default Clock Task"), ("app.clock.resolve", "Resolve Open Clocks…"), 414 ("app.clock.default", "Mark as Default Clock Task"), ("app.clock.resolve", "Resolve Open Clocks…"),
415 ("app.toggle-markup", "Show or Hide Markup"), 415 ("app.toggle-markup", "Show or Hide Markup"),
416 ("org.toggle-inline-images", "Show or Hide Inline Images"), ("editor.toggle-truncate-lines", "Truncate or Wrap Long Lines"), 416 ("org.toggle-inline-images", "Show or Hide Inline Images"), ("editor.toggle-truncate-lines", "Truncate or Wrap Long Lines"),
417 ("org.table.toggle-column-width", "Shrink or Expand Table Column"), ("org.table.shrink", "Shrink Table Columns with Widths"),
418 ("org.table.expand", "Expand Table Columns"),
417 ] 419 ]
418 420
419 var body: some View { 421 var body: some View {
Sources/OrgstarMobile/MobileEditor.swift +161 −7
@@ -1,6 +1,7 @@
1#if os(iOS) 1#if os(iOS)
2import OrgCore 2import OrgCore
3import OrgDocument 3import OrgDocument
4import OrgHighlight
4import OrgPresentation 5import OrgPresentation
5import UIKit 6import UIKit
6 7
@@ -21,9 +22,13 @@ final class LockedRanges: @unchecked Sendable {
21final class FragmentStyle: @unchecked Sendable { 22final class FragmentStyle: @unchecked Sendable {
22 private let lock = NSLock() 23 private let lock = NSLock()
23 private var band: (color: UIColor, width: CGFloat) = (.clear, 0) 24 private var band: (color: UIColor, width: CGFloat) = (.clear, 0)
25 private var selected: (range: Range<Int>, color: UIColor)?
24 26
25 func set(blockBackground color: UIColor, width: CGFloat) { lock.withLock { band = (color, width) } } 27 func set(blockBackground color: UIColor, width: CGFloat) { lock.withLock { band = (color, width) } }
26 var blockBand: (color: UIColor, width: CGFloat) { lock.withLock { band } } 28 var blockBand: (color: UIColor, width: CGFloat) { lock.withLock { band } }
29 /// The selection, which a block's fragment draws over its band, as the Mac's fragments do.
30 func set(selection range: Range<Int>?, color: UIColor) { lock.withLock { selected = range.map { ($0, color) } } }
31 var selection: (range: Range<Int>, color: UIColor)? { lock.withLock { selected } }
27} 32}
28 33
29/// A text view that offers hardware-keyboard presses to the editor's keymap first. 34/// A text view that offers hardware-keyboard presses to the editor's keymap first.
@@ -96,6 +101,8 @@ final class KeyedTextView: UITextView {
96/// fold as TAB cycles them. 101/// fold as TAB cycles them.
97@MainActor 102@MainActor
98final class MobileEditor: NSObject, DocumentBuffer { 103final class MobileEditor: NSObject, DocumentBuffer {
104 /// One highlighter for every editor and the reader: it caches compiled grammars and results.
105 static let highlighter = TreeSitterHighlighter()
99 private(set) var document: DocumentState 106 private(set) var document: DocumentState
100 let textView: UITextView 107 let textView: UITextView
101 var options: EditingOptions = .org { 108 var options: EditingOptions = .org {
@@ -152,6 +159,7 @@ final class MobileEditor: NSObject, DocumentBuffer {
152 /// Blocks drawn on a band. 159 /// Blocks drawn on a band.
153 let shaded = LockedRanges() 160 let shaded = LockedRanges()
154 let fragmentStyle = FragmentStyle() 161 let fragmentStyle = FragmentStyle()
162 private var selectionColor: UIColor = .clear
155 /// `org-indent-mode` and `org-hide-leading-stars`, from the settings and `#+STARTUP`. 163 /// `org-indent-mode` and `org-hide-leading-stars`, from the settings and `#+STARTUP`.
156 private var indented = true 164 private var indented = true
157 private var hideStars = false 165 private var hideStars = false
@@ -168,6 +176,10 @@ final class MobileEditor: NSObject, DocumentBuffer {
168 private static let imageCache = NSCache<NSString, UIImage>() 176 private static let imageCache = NSCache<NSString, UIImage>()
169 private var loading = false 177 private var loading = false
170 private var restyleScheduled: Range<Int>? 178 private var restyleScheduled: Range<Int>?
179 /// Narrowed table columns (`org-table-shrink`).
180 private var shrunk = ShrunkColumns()
181 /// A command's edits being applied, which keep shrunk columns narrow.
182 private var commandEditing = false
171 183
172 init( 184 init(
173 document: DocumentState, editable: Bool, options: EditingOptions = .org, theme spec: ThemeSpec = .default, 185 document: DocumentState, editable: Bool, options: EditingOptions = .org, theme spec: ThemeSpec = .default,
@@ -201,6 +213,7 @@ final class MobileEditor: NSObject, DocumentBuffer {
201 indented = startup.indented 213 indented = startup.indented
202 hideStars = startup.hideStars 214 hideStars = startup.hideStars
203 showsImages = startup.inlineImages 215 showsImages = startup.inlineImages
216 shrunk = ShrunkColumns.startup(document.tree)
204 applyThemeToView() 217 applyThemeToView()
205 load(document.text) 218 load(document.text)
206 setFolds(startup.folds) 219 setFolds(startup.folds)
@@ -223,6 +236,7 @@ final class MobileEditor: NSObject, DocumentBuffer {
223 let result = try change(&document) 236 let result = try change(&document)
224 if document.text != before { 237 if document.text != before {
225 // A save that merged a change from disk, or a revert: the view shows the new text. 238 // A save that merged a change from disk, or a revert: the view shows the new text.
239 shrunk = ShrunkColumns()
226 load(document.text) 240 load(document.text)
227 let length = (document.text as NSString).length 241 let length = (document.text as NSString).length
228 textView.selectedRange = NSRange(location: min(selected.location, length), length: 0) 242 textView.selectedRange = NSRange(location: min(selected.location, length), length: 0)
@@ -246,7 +260,9 @@ final class MobileEditor: NSObject, DocumentBuffer {
246 onMessage?("This file is read-only.") 260 onMessage?("This file is read-only.")
247 return .failed("read-only") 261 return .failed("read-only")
248 } 262 }
263 commandEditing = true
249 applyEdits(result.edits) 264 applyEdits(result.edits)
265 commandEditing = false
250 if let selected = result.selection?.first { 266 if let selected = result.selection?.first {
251 unfold(around: selected.lowerBound) 267 unfold(around: selected.lowerBound)
252 textView.selectedRange = NSRange(location: selected.lowerBound, length: selected.count) 268 textView.selectedRange = NSRange(location: selected.lowerBound, length: selected.count)
@@ -316,6 +332,7 @@ final class MobileEditor: NSObject, DocumentBuffer {
316 onMessage?(truncatesLines ? "Truncate long lines enabled" : "Truncate long lines disabled") 332 onMessage?(truncatesLines ? "Truncate long lines enabled" : "Truncate long lines disabled")
317 case "edit.undo": textView.undoManager?.undo() 333 case "edit.undo": textView.undoManager?.undo()
318 case "edit.redo": textView.undoManager?.redo() 334 case "edit.redo": textView.undoManager?.redo()
335 case "org.table.toggle-column-width", "org.table.shrink", "org.table.expand": tableColumnWidth(id)
319 case _ where id.hasPrefix("app."): 336 case _ where id.hasPrefix("app."):
320 if let onAppCommand { onAppCommand(id) } else { onMessage?("Not available on iOS yet") } 337 if let onAppCommand { onAppCommand(id) } else { onMessage?("Not available on iOS yet") }
321 default: 338 default:
@@ -336,6 +353,8 @@ final class MobileEditor: NSObject, DocumentBuffer {
336 case "app.clock.in", "app.clock.out", "app.clock.cancel", "app.clock.goto", "app.clock.in-recent", "app.clock.in-last", 353 case "app.clock.in", "app.clock.out", "app.clock.cancel", "app.clock.goto", "app.clock.in-recent", "app.clock.in-last",
337 "app.clock.goto-recent", "app.clock.default", "app.clock.resolve", "app.toggle-markup": return onAppCommand != nil 354 "app.clock.goto-recent", "app.clock.default", "app.clock.resolve", "app.toggle-markup": return onAppCommand != nil
338 case "org.link.open": return OpenLinkAtPoint().applies(in: context) 355 case "org.link.open": return OpenLinkAtPoint().applies(in: context)
356 case "org.table.toggle-column-width", "org.table.shrink", "org.table.expand":
357 return TableShrink.table(at: context.caret, in: context.text) != nil
339 default: return false 358 default: return false
340 } 359 }
341 } 360 }
@@ -453,13 +472,16 @@ final class MobileEditor: NSObject, DocumentBuffer {
453 guard !loading else { return } 472 guard !loading else { return }
454 let old = range.location..<(range.location + range.length - delta) 473 let old = range.location..<(range.location + range.length - delta)
455 let replacement = (textView.textStorage.string as NSString).substring(with: range) 474 let replacement = (textView.textStorage.string as NSString).substring(with: range)
475 let edit = TextEdit(range: old, replacement: replacement)
456 do { 476 do {
457 try document.apply([TextEdit(range: old, replacement: replacement)], baseRevision: document.revision) 477 try document.apply([edit], baseRevision: document.revision)
458 } catch { 478 } catch {
459 // Out of step: the view's text wins. 479 // Out of step: the view's text wins.
480 shrunk = ShrunkColumns()
460 load(textView.textStorage.string) 481 load(textView.textStorage.string)
461 return 482 return
462 } 483 }
484 for table in shrunk.map(through: edit, in: textView.textStorage.string, command: commandEditing) { scheduleRestyle(table) }
463 fold = FoldState( 485 fold = FoldState(
464 folds: Self.map(fold.folds, old, delta), bodyFolds: Self.map(fold.bodyFolds, old, delta), 486 folds: Self.map(fold.folds, old, delta), bodyFolds: Self.map(fold.bodyFolds, old, delta),
465 wrapperFolds: Self.map(fold.wrapperFolds, old, delta) 487 wrapperFolds: Self.map(fold.wrapperFolds, old, delta)
@@ -493,6 +515,37 @@ final class MobileEditor: NSObject, DocumentBuffer {
493 textView.tintColor = theme.color("cursor") 515 textView.tintColor = theme.color("cursor")
494 textView.typingAttributes = theme.base 516 textView.typingAttributes = theme.base
495 fragmentStyle.set(blockBackground: theme.color("block-background") ?? .clear, width: textView.bounds.width) 517 fragmentStyle.set(blockBackground: theme.color("block-background") ?? .clear, width: textView.bounds.width)
518 themeSelection()
519 }
520
521 /// The selection in the theme's selection color: the text view's selection display
522 /// interaction draws it with our highlight view; the cursor and handles keep the tint.
523 private func themeSelection() {
524 guard let interaction = textView.interactions.lazy.compactMap({ $0 as? UITextSelectionDisplayInteraction }).first else { return }
525 let view = interaction.highlightView as? SelectionHighlightView ?? SelectionHighlightView()
526 view.color = theme.color("selection") ?? UIColor.tintColor.withAlphaComponent(0.25)
527 if interaction.highlightView !== view { interaction.highlightView = view }
528 selectionColor = view.color
529 }
530
531 /// The highlight view draws under the text, so a block's band would cover it: blocks the
532 /// selection enters or leaves are laid out again to draw it over their band.
533 private func redrawSelectedBlocks() {
534 let selected = textView.selectedRange
535 let range = selected.length > 0 ? selected.location..<NSMaxRange(selected) : nil
536 let old = fragmentStyle.selection?.range
537 fragmentStyle.set(selection: range, color: selectionColor)
538 guard let manager = textView.textLayoutManager, let content = manager.textContentManager else { return }
539 let touched = [old, range].compactMap { $0 }
540 for block in shaded.all where touched.contains(where: { $0.overlaps(block) }) {
541 guard let start = content.location(content.documentRange.location, offsetBy: block.lowerBound),
542 let end = content.location(start, offsetBy: block.count),
543 let textRange = NSTextRange(location: start, end: end) else { continue }
544 // Fragments are kept across layout passes, so they are asked to draw again too.
545 manager.invalidateRenderingAttributes(for: textRange)
546 manager.invalidateLayout(for: textRange)
547 }
548 textView.setNeedsDisplay()
496 } 549 }
497 550
498 /// The band behind blocks spans the view's width, or the widest line's when truncated; 551 /// The band behind blocks spans the view's width, or the widest line's when truncated;
@@ -505,7 +558,10 @@ final class MobileEditor: NSObject, DocumentBuffer {
505 fragmentStyle.set(blockBackground: band.color, width: width) 558 fragmentStyle.set(blockBackground: band.color, width: width)
506 imageWidth = textView.bounds.width 559 imageWidth = textView.bounds.width
507 if showsImages, resized { restyle(0..<textView.textStorage.length) } 560 if showsImages, resized { restyle(0..<textView.textStorage.length) }
508 if let manager = textView.textLayoutManager { manager.invalidateLayout(for: manager.documentRange) } 561 if let manager = textView.textLayoutManager {
562 manager.invalidateRenderingAttributes(for: manager.documentRange)
563 manager.invalidateLayout(for: manager.documentRange)
564 }
509 } 565 }
510 566
511 /// Styles the whole file again. 567 /// Styles the whole file again.
@@ -555,7 +611,7 @@ final class MobileEditor: NSObject, DocumentBuffer {
555 } 611 }
556 let revealed = caretLine 612 let revealed = caretLine
557 var scriptExclusions: [Range<Int>] = [] 613 var scriptExclusions: [Range<Int>] = []
558 for run in Presentation.styles(document.tree, in: whole) { 614 for run in Presentation.styles(document.tree, in: whole, highlighter: Self.highlighter) {
559 let clipped = NSIntersectionRange(NSRange(run.range), lines) 615 let clipped = NSIntersectionRange(NSRange(run.range), lines)
560 guard clipped.length > 0 else { continue } 616 guard clipped.length > 0 else { continue }
561 if Presentation.skipsLeadingStars(run.role, indented: indented, hideStars: hideStars) { continue } 617 if Presentation.skipsLeadingStars(run.role, indented: indented, hideStars: hideStars) { continue }
@@ -567,6 +623,7 @@ final class MobileEditor: NSObject, DocumentBuffer {
567 if Presentation.excludesScripts(run.role) { scriptExclusions.append(run.range) } 623 if Presentation.excludesScripts(run.role) { scriptExclusions.append(run.range) }
568 } 624 }
569 if !showMarkup, options.prettyEntities { prettify(whole, in: storage, revealed: revealed, scriptExclusions: scriptExclusions) } 625 if !showMarkup, options.prettyEntities { prettify(whole, in: storage, revealed: revealed, scriptExclusions: scriptExclusions) }
626 applyShrunk(whole, in: storage)
570 applyImages(whole, in: storage, revealed: revealed) 627 applyImages(whole, in: storage, revealed: revealed)
571 storage.endEditing() 628 storage.endEditing()
572 } 629 }
@@ -620,6 +677,47 @@ final class MobileEditor: NSObject, DocumentBuffer {
620 } 677 }
621 } 678 }
622 679
680 // MARK: - Shrunk table columns
681
682 /// C-c TAB in a table: `org-table-toggle-column-width`; `shrink` for `org-table-shrink`,
683 /// `expand` for `org-table-expand`.
684 private func tableColumnWidth(_ id: String) {
685 switch shrunk.change(for: id, at: textView.selectedRange.location, in: textView.textStorage.string) {
686 case .notInTable: onMessage?("Not in a table")
687 case .set(let columns, let table): setShrunk(columns, in: table)
688 case .ask(let table, let current, let max):
689 onPrompt?(Prompt(key: "columns", message: "Column ranges (e.g. 2-4 6-):")) { [weak self] answer in
690 guard let self, let answer else { return }
691 self.setShrunk(ShrunkColumns.toggled(current, TableShrink.columns(answer, max: max)), in: table)
692 }
693 }
694 }
695
696 /// Narrows `columns` of `table` and widens its others.
697 private func setShrunk(_ columns: [Int], in table: Range<Int>) {
698 shrunk.set(columns, in: table, text: textView.textStorage.string)
699 restyleAll()
700 }
701
702 /// Hides each shrunk segment's text and draws its display where the text was, as pretty
703 /// entities draw theirs.
704 private func applyShrunk(_ range: Range<Int>, in storage: NSTextStorage) {
705 guard !shrunk.isEmpty else { return }
706 let cell = theme.column
707 for segment in shrunk.segments where segment.range.overlaps(range) && segment.range.upperBound <= storage.length {
708 let r = segment.range
709 let shown = segment.display.count
710 let kept = min(shown, r.count)
711 if r.count > kept { storage.addAttributes(theme.hidden, range: NSRange(location: r.lowerBound, length: r.count - kept)) }
712 guard kept > 0 else { continue }
713 let visible = NSRange(location: r.upperBound - kept, length: kept)
714 let color = storage.attribute(.foregroundColor, at: visible.location, effectiveRange: nil) as? UIColor ?? theme.foreground
715 storage.addAttribute(.foregroundColor, value: UIColor.clear, range: visible)
716 storage.addAttributes([.orgEntityDisplay: segment.display, .orgEntityColor: color], range: NSRange(location: visible.location, length: 1))
717 if shown > kept { storage.addAttribute(.kern, value: CGFloat(shown - kept) * cell, range: NSRange(location: NSMaxRange(visible) - 1, length: 1)) }
718 }
719 }
720
623 // MARK: - Inline images 721 // MARK: - Inline images
624 722
625 private func toggleImages() { 723 private func toggleImages() {
@@ -631,7 +729,7 @@ final class MobileEditor: NSObject, DocumentBuffer {
631 var offset = 0 729 var offset = 0
632 while offset < ns.length { 730 while offset < ns.length {
633 let line = ns.lineRange(for: NSRange(location: offset, length: 0)) 731 let line = ns.lineRange(for: NSRange(location: offset, length: 0))
634 if let image = InlineImages.image(atLine: line.location, in: ns), loadImage(image.path) != nil { count += 1 } 732 if let image = InlineImages.image(atLine: line.location, in: ns), Self.loadImage(image.path, relativeTo: baseDirectory) != nil { count += 1 }
635 offset = NSMaxRange(line) 733 offset = NSMaxRange(line)
636 } 734 }
637 onMessage?("\(count) images displayed inline") 735 onMessage?("\(count) images displayed inline")
@@ -640,7 +738,8 @@ final class MobileEditor: NSObject, DocumentBuffer {
640 } 738 }
641 } 739 }
642 740
643 private func loadImage(_ path: String) -> UIImage? { 741 /// An image link's image, by its path or one relative to `baseDirectory`.
742 static func loadImage(_ path: String, relativeTo baseDirectory: URL?) -> UIImage? {
644 let expanded = (path as NSString).expandingTildeInPath 743 let expanded = (path as NSString).expandingTildeInPath
645 let url: URL 744 let url: URL
646 if expanded.hasPrefix("/") { 745 if expanded.hasPrefix("/") {
@@ -669,7 +768,7 @@ final class MobileEditor: NSObject, DocumentBuffer {
669 while location < range.upperBound, location < text.length { 768 while location < range.upperBound, location < text.length {
670 let line = text.lineRange(for: NSRange(location: location, length: 0)) 769 let line = text.lineRange(for: NSRange(location: location, length: 0))
671 location = NSMaxRange(line) 770 location = NSMaxRange(line)
672 guard let image = InlineImages.image(atLine: line.location, in: text), let picture = loadImage(image.path) else { continue } 771 guard let image = InlineImages.image(atLine: line.location, in: text), let picture = Self.loadImage(image.path, relativeTo: baseDirectory) else { continue }
673 let width = min(image.width.map(CGFloat.init) ?? picture.size.width, maxWidth) 772 let width = min(image.width.map(CGFloat.init) ?? picture.size.width, maxWidth)
674 let height = picture.size.width > 0 ? width * picture.size.height / picture.size.width : 0 773 let height = picture.size.width > 0 ? width * picture.size.height / picture.size.width : 0
675 let content = NSRange(location: line.location, length: line.length - (text.substring(with: line).hasSuffix("\n") ? 1 : 0)) 774 let content = NSRange(location: line.location, length: line.length - (text.substring(with: line).hasSuffix("\n") ? 1 : 0))
@@ -755,6 +854,7 @@ final class MobileEditor: NSObject, DocumentBuffer {
755 854
756 /// The caret left hidden text (a tap past a fold): what hides it opens. 855 /// The caret left hidden text (a tap past a fold): what hides it opens.
757 fileprivate func selectionChanged() { 856 fileprivate func selectionChanged() {
857 redrawSelectedBlocks()
758 let caret = textView.selectedRange.location 858 let caret = textView.selectedRange.location
759 if hidden.containing(caret) != nil { unfold(around: caret) } 859 if hidden.containing(caret) != nil { unfold(around: caret) }
760 revealCaretLine() 860 revealCaretLine()
@@ -827,6 +927,10 @@ extension MobileEditor: NSTextLayoutManagerDelegate {
827 let fragment = OrgLineFragment(textElement: textElement, range: range) 927 let fragment = OrgLineFragment(textElement: textElement, range: range)
828 fragment.folded = folded 928 fragment.folded = folded
829 fragment.band = band 929 fragment.band = band
930 if band != nil {
931 fragment.start = offset
932 fragment.style = fragmentStyle
933 }
830 fragment.image = image 934 fragment.image = image
831 return fragment 935 return fragment
832 } 936 }
@@ -850,6 +954,29 @@ final class InlineImageBox: NSObject, @unchecked Sendable {
850 } 954 }
851} 955}
852 956
957/// Selected text's background, in one color however the rects overlap.
958final class SelectionHighlightView: UIView, UITextSelectionHighlightView {
959 var selectionRects: [UITextSelectionRect] = [] { didSet { setNeedsDisplay() } }
960 var color: UIColor = .clear { didSet { setNeedsDisplay() } }
961
962 override init(frame: CGRect) {
963 super.init(frame: frame)
964 isOpaque = false
965 backgroundColor = .clear
966 isUserInteractionEnabled = false
967 registerForTraitChanges([UITraitUserInterfaceStyle.self]) { (view: SelectionHighlightView, _) in view.setNeedsDisplay() }
968 }
969
970 required init?(coder: NSCoder) { fatalError("init(coder:) is not used") }
971
972 override func draw(_ rect: CGRect) {
973 let path = UIBezierPath()
974 for selection in selectionRects where !selection.rect.isEmpty { path.append(UIBezierPath(rect: selection.rect)) }
975 color.setFill()
976 path.fill()
977 }
978}
979
853/// A line drawn with more than its text, as the Mac editor's fragments draw them: a folded 980/// A line drawn with more than its text, as the Mac editor's fragments draw them: a folded
854/// line's ellipsis, a block's band across the view, an image under an image link, and pretty 981/// line's ellipsis, a block's band across the view, an image under an image link, and pretty
855/// entities' characters where the entities' last (invisible) characters sit. 982/// entities' characters where the entities' last (invisible) characters sit.
@@ -857,6 +984,9 @@ final class OrgLineFragment: NSTextLayoutFragment, @unchecked Sendable {
857 var folded = false 984 var folded = false
858 var band: (color: UIColor, width: CGFloat)? 985 var band: (color: UIColor, width: CGFloat)?
859 var image: InlineImageBox? 986 var image: InlineImageBox?
987 /// For a block's lines: where the fragment starts, and where the selection is read.
988 var start = 0
989 var style: FragmentStyle?
860 990
861 static func image(_ string: NSAttributedString) -> InlineImageBox? { 991 static func image(_ string: NSAttributedString) -> InlineImageBox? {
862 var found: InlineImageBox? 992 var found: InlineImageBox?
@@ -878,7 +1008,9 @@ final class OrgLineFragment: NSTextLayoutFragment, @unchecked Sendable {
878 guard let band else { return nil } 1008 guard let band else { return nil }
879 // Not under the empty line TextKit adds after a final newline. 1009 // Not under the empty line TextKit adds after a final newline.
880 let height = textLineFragments.last { $0.characterRange.length > 0 }?.typographicBounds.maxY ?? layoutFragmentFrame.height 1010 let height = textLineFragments.last { $0.characterRange.length > 0 }?.typographicBounds.maxY ?? layoutFragmentFrame.height
881 return CGRect(x: -layoutFragmentFrame.minX, y: 0, width: max(band.width, layoutFragmentFrame.maxX), height: height) 1011 // The width as it is now: the view may have been laid out since this fragment was made.
1012 let width = style?.blockBand.width ?? band.width
1013 return CGRect(x: -layoutFragmentFrame.minX, y: 0, width: max(width, layoutFragmentFrame.maxX), height: height)
882 } 1014 }
883 1015
884 private var imageRect: CGRect? { 1016 private var imageRect: CGRect? {
@@ -899,6 +1031,7 @@ final class OrgLineFragment: NSTextLayoutFragment, @unchecked Sendable {
899 context.setFillColor(band.color.cgColor) 1031 context.setFillColor(band.color.cgColor)
900 context.fill(rect.offsetBy(dx: point.x, dy: point.y)) 1032 context.fill(rect.offsetBy(dx: point.x, dy: point.y))
901 context.restoreGState() 1033 context.restoreGState()
1034 drawSelection(at: point, in: context, bandRect: rect)
902 } 1035 }
903 super.draw(at: point, in: context) 1036 super.draw(at: point, in: context)
904 UIGraphicsPushContext(context) 1037 UIGraphicsPushContext(context)
@@ -915,6 +1048,27 @@ final class OrgLineFragment: NSTextLayoutFragment, @unchecked Sendable {
915 } 1048 }
916 } 1049 }
917 1050
1051 /// The selected part of each line, over the band; a selection running past a line's end
1052 /// fills to the band's edge.
1053 private func drawSelection(at point: CGPoint, in context: CGContext, bandRect: CGRect) {
1054 guard let selection = style?.selection else { return }
1055 context.saveGState()
1056 context.setFillColor(selection.color.cgColor)
1057 for line in textLineFragments where line.characterRange.length > 0 {
1058 let lineStart = start + line.characterRange.location
1059 let lineEnd = lineStart + line.characterRange.length
1060 let from = max(selection.range.lowerBound, lineStart), to = min(selection.range.upperBound, lineEnd)
1061 guard from < to || (from == to && selection.range.upperBound > lineEnd && from == lineEnd) else { continue }
1062 let bounds = line.typographicBounds
1063 // From the margin when the selection began on an earlier line, as the system draws it.
1064 let margin = bandRect.minX + (textLayoutManager?.textContainer?.lineFragmentPadding ?? 0)
1065 let x1 = selection.range.lowerBound < lineStart ? margin : bounds.minX + line.locationForCharacter(at: from - start).x
1066 let x2 = selection.range.upperBound >= lineEnd ? bandRect.maxX : bounds.minX + line.locationForCharacter(at: to - start).x
1067 context.fill(CGRect(x: point.x + x1, y: point.y + bounds.minY, width: max(0, x2 - x1), height: bounds.height))
1068 }
1069 context.restoreGState()
1070 }
1071
918 private func drawEntities(at point: CGPoint) { 1072 private func drawEntities(at point: CGPoint) {
919 guard let string = (textElement as? NSTextParagraph)?.attributedString else { return } 1073 guard let string = (textElement as? NSTextParagraph)?.attributedString else { return }
920 string.enumerateAttribute(.orgEntityDisplay, in: NSRange(location: 0, length: string.length)) { value, range, _ in 1074 string.enumerateAttribute(.orgEntityDisplay, in: NSRange(location: 0, length: string.length)) { value, range, _ in
Sources/OrgstarMobile/MobileTheme.swift +2 −1
@@ -115,7 +115,8 @@ struct MobileTheme {
115 case .footnote, .cookie, .target, .macro, .latex: fg("special") 115 case .footnote, .cookie, .target, .macro, .latex: fg("special")
116 case .table, .rule: fg("table") 116 case .table, .rule: fg("table")
117 case .block: break 117 case .block: break
118 case .syntax: break 118 case .syntax(let category):
119 if let key = category.themeKey { fg(key) }
119 } 120 }
120 } 121 }
121 122
Sources/OrgstarMobile/ReaderScreen.swift +97 −22
@@ -29,6 +29,8 @@ struct ReaderScreen: View {
29 @State private var fold = FoldState() 29 @State private var fold = FoldState()
30 @State private var folded: [Range<Int>] = [] 30 @State private var folded: [Range<Int>] = []
31 @State private var loadedPath: String? 31 @State private var loadedPath: String?
32 /// The file's display: indentation, leading stars, inline images, truncation.
33 @State private var startup: StartupDisplay?
32 @State private var showingOutline = false 34 @State private var showingOutline = false
33 @State private var message: String? 35 @State private var message: String?
34 @Environment(\.openURL) private var openURL 36 @Environment(\.openURL) private var openURL
@@ -41,8 +43,9 @@ struct ReaderScreen: View {
41 // Read again when settings or the Dynamic Type size change. 43 // Read again when settings or the Dynamic Type size change.
42 let _ = model.settingsVersion 44 let _ = model.settingsVersion
43 let theme = MobileTheme(model.theme) 45 let theme = MobileTheme(model.theme)
46 let truncated = startup?.truncated ?? false
44 ScrollViewReader { proxy in 47 ScrollViewReader { proxy in
45 ScrollView { 48 ScrollView(truncated ? [.vertical, .horizontal] : .vertical) {
46 LazyVStack(alignment: .leading, spacing: 8) { 49 LazyVStack(alignment: .leading, spacing: 8) {
47 if let tree = session.document?.tree { 50 if let tree = session.document?.tree {
48 let preambleEnd = outline.first?.start ?? (tree.text as NSString).length 51 let preambleEnd = outline.first?.start ?? (tree.text as NSString).length
@@ -52,15 +55,17 @@ struct ReaderScreen: View {
52 heading(tree, entry, theme).id(entry.start) 55 heading(tree, entry, theme).id(entry.start)
53 if !fold.folds.contains(entry.start), !fold.bodyFolds.contains(entry.start) { 56 if !fold.folds.contains(entry.start), !fold.bodyFolds.contains(entry.start) {
54 let body = bodyRange(index, tree) 57 let body = bodyRange(index, tree)
55 if !body.isEmpty { textView(tree, body, theme).padding(.leading, indent(entry)) } 58 if !body.isEmpty { textView(tree, body, theme).padding(.leading, bodyIndent(entry, theme)) }
56 } 59 }
57 } 60 }
58 } 61 }
59 } 62 }
60 } 63 }
61 .padding() 64 .padding()
62 .frame(maxWidth: .infinity, alignment: .leading) 65 .frame(maxWidth: truncated ? nil : .infinity, alignment: .leading)
63 } 66 }
67 // Narrower than the view while truncated, the text still starts at the top left.
68 .defaultScrollAnchor(truncated ? .topLeading : nil)
64 .background(theme.swiftColor("background") ?? Color(uiColor: .systemBackground)) 69 .background(theme.swiftColor("background") ?? Color(uiColor: .systemBackground))
65 .onChange(of: session.revealRequest?.id) { 70 .onChange(of: session.revealRequest?.id) {
66 guard let offset = session.revealRequest?.offset else { return } 71 guard let offset = session.revealRequest?.offset else { return }
@@ -89,12 +94,31 @@ struct ReaderScreen: View {
89 .onAppear(perform: open) 94 .onAppear(perform: open)
90 .onChange(of: session.path) { loadFolds() } 95 .onChange(of: session.path) { loadFolds() }
91 .onChange(of: session.editVersion) { loadFolds() } 96 .onChange(of: session.editVersion) { loadFolds() }
97 .onChange(of: model.settingsVersion) { loadFolds() }
92 } 98 }
93 99
94 // MARK: - Content 100 // MARK: - Content
95 101
96 private func indent(_ entry: OutlineEntry) -> CGFloat { CGFloat(entry.level - 1) * 14 } 102 private func indent(_ entry: OutlineEntry) -> CGFloat { CGFloat(entry.level - 1) * 14 }
97 103
104 private var indented: Bool { startup?.indented ?? true }
105
106 /// The text as the editor's display settings show it.
107 private var display: ReadingText.Display {
108 ReadingText.Display(showMarkup: model.showMarkup, options: session.options, highlighter: MobileEditor.highlighter)
109 }
110
111 /// org-indent: a heading's text and its body start past its stars, at level + 1 columns,
112 /// the fold mark standing where the last star and its space would. Without it nothing is
113 /// indented and the stars show.
114 private func headingIndent(_ entry: OutlineEntry, _ theme: MobileTheme) -> CGFloat {
115 indented ? CGFloat(entry.level - 1) * theme.column : 0
116 }
117
118 private func bodyIndent(_ entry: OutlineEntry, _ theme: MobileTheme) -> CGFloat {
119 indented ? CGFloat(entry.level + 1) * theme.column : 0
120 }
121
98 /// Hidden under a folded ancestor. 122 /// Hidden under a folded ancestor.
99 private func isShown(_ index: Int) -> Bool { 123 private func isShown(_ index: Int) -> Bool {
100 var parent = outline[index].parent 124 var parent = outline[index].parent
@@ -116,20 +140,19 @@ struct ReaderScreen: View {
116 140
117 private func heading(_ tree: OrgTree, _ entry: OutlineEntry, _ theme: MobileTheme) -> some View { 141 private func heading(_ tree: OrgTree, _ entry: OutlineEntry, _ theme: MobileTheme) -> some View {
118 let ns = tree.text as NSString 142 let ns = tree.text as NSString
119 var line = ns.lineRange(for: NSRange(location: entry.start, length: 0)) 143 let line = ns.lineRange(for: NSRange(location: entry.start, length: 0))
120 let title = min(entry.start + entry.level + 1, NSMaxRange(line)) 144 let start = indented ? min(entry.start + entry.level + 1, NSMaxRange(line)) : entry.start
121 line.length = NSMaxRange(line) - title 145 let text = attributed(ReadingText.segments(tree, in: start..<NSMaxRange(line), display: display), heading: entry.level, theme)
122 let text = attributed(ReadingText.segments(tree, in: title..<(title + line.length)), heading: entry.level, theme) 146 let hasContent = entry.end > NSMaxRange(line)
123 let hasContent = entry.end > NSMaxRange(ns.lineRange(for: NSRange(location: entry.start, length: 0)))
124 let foldedMark = fold.folds.contains(entry.start) && hasContent 147 let foldedMark = fold.folds.contains(entry.start) && hasContent
125 return HStack(alignment: .firstTextBaseline, spacing: 6) { 148 return HStack(alignment: .firstTextBaseline, spacing: 0) {
126 Image(systemName: foldedMark ? "chevron.right" : "chevron.down") 149 Image(systemName: foldedMark ? "chevron.right" : "chevron.down")
127 .font(.caption.weight(.semibold)).foregroundStyle(theme.swiftColor("markup") ?? Color(uiColor: .tertiaryLabel)) 150 .font(.caption.weight(.semibold)).foregroundStyle(theme.swiftColor("markup") ?? Color(uiColor: .tertiaryLabel))
128 .opacity(hasContent ? 1 : 0) 151 .opacity(hasContent ? 1 : 0)
129 Text(text.trimmingTrailingNewlines()).lineSpacing(CGFloat(max(0, theme.spec.lineSpacing))) 152 .frame(width: 2 * theme.column, alignment: .leading)
130 .frame(maxWidth: .infinity, alignment: .leading) 153 lineText(text.trimmingTrailingNewlines(), theme)
131 } 154 }
132 .padding(.leading, indent(entry)) 155 .padding(.leading, headingIndent(entry, theme))
133 .padding(.top, entry.level == 1 ? 6 : 0) 156 .padding(.top, entry.level == 1 ? 6 : 0)
134 .contentShape(Rectangle()) 157 .contentShape(Rectangle())
135 .onTapGesture { fold = Presentation.cycle(entry.start, in: tree, fold) } 158 .onTapGesture { fold = Presentation.cycle(entry.start, in: tree, fold) }
@@ -138,10 +161,52 @@ struct ReaderScreen: View {
138 } 161 }
139 162
140 private func textView(_ tree: OrgTree, _ range: Range<Int>, _ theme: MobileTheme) -> some View { 163 private func textView(_ tree: OrgTree, _ range: Range<Int>, _ theme: MobileTheme) -> some View {
141 Text(attributed(ReadingText.segments(tree, in: range, folded: folded), heading: nil, theme).trimmingTrailingNewlines()) 164 VStack(alignment: .leading, spacing: 4) {
165 ForEach(parts(tree, range), id: \.range.lowerBound) { part in
166 if let image = part.image {
167 Image(uiImage: image.picture).resizable().scaledToFit()
168 .frame(maxWidth: image.width.map { CGFloat($0) } ?? image.picture.size.width, alignment: .leading)
169 .accessibilityLabel((image.path as NSString).lastPathComponent)
170 } else {
171 lineText(attributed(ReadingText.segments(tree, in: part.range, folded: folded, display: display), heading: nil, theme).trimmingTrailingNewlines(), theme)
172 .textSelection(.enabled)
173 }
174 }
175 }
176 }
177
178 /// Wrapped to the view's width, or on one line each, scrolling sideways, while truncated.
179 private func lineText(_ text: AttributedString, _ theme: MobileTheme) -> some View {
180 Text(text)
142 .lineSpacing(CGFloat(max(0, theme.spec.lineSpacing))) 181 .lineSpacing(CGFloat(max(0, theme.spec.lineSpacing)))
143 .textSelection(.enabled) 182 .fixedSize(horizontal: startup?.truncated ?? false, vertical: false)
144 .frame(maxWidth: .infinity, alignment: .leading) 183 .frame(maxWidth: startup?.truncated == true ? nil : .infinity, alignment: .leading)
184 }
185
186 private struct Part {
187 let range: Range<Int>
188 var image: (picture: UIImage, path: String, width: Int?)?
189 }
190
191 /// Text, and with inline images on, lines that are only an image link shown as the image.
192 private func parts(_ tree: OrgTree, _ range: Range<Int>) -> [Part] {
193 guard startup?.inlineImages == true, let path = session.path else { return [Part(range: range)] }
194 let base = URL(fileURLWithPath: path).deletingLastPathComponent()
195 let ns = tree.text as NSString
196 var parts: [Part] = []
197 var textStart = range.lowerBound
198 var location = range.lowerBound
199 while location < range.upperBound {
200 let line = ns.lineRange(for: NSRange(location: location, length: 0))
201 location = NSMaxRange(line)
202 guard folded.allSatisfy({ !$0.contains(line.location) }), let image = InlineImages.image(atLine: line.location, in: ns),
203 let picture = MobileEditor.loadImage(image.path, relativeTo: base) else { continue }
204 if textStart < line.location { parts.append(Part(range: textStart..<line.location)) }
205 parts.append(Part(range: line.location..<min(NSMaxRange(line), range.upperBound), image: (picture, image.path, image.width)))
206 textStart = min(NSMaxRange(line), range.upperBound)
207 }
208 if textStart < range.upperBound { parts.append(Part(range: textStart..<range.upperBound)) }
209 return parts
145 } 210 }
146 211
147 /// Segments as styled text in the theme's font and colors, as the editor styles them; 212 /// Segments as styled text in the theme's font and colors, as the editor styles them;
@@ -168,7 +233,11 @@ struct ReaderScreen: View {
168 case .verbatim, .code, .inlineSource: 233 case .verbatim, .code, .inlineSource:
169 if let background = theme.color("inline-background") { part.backgroundColor = Color(uiColor: background) } 234 if let background = theme.color("inline-background") { part.backgroundColor = Color(uiColor: background) }
170 fg(role == .verbatim ? "verbatim" : "code") 235 fg(role == .verbatim ? "verbatim" : "code")
171 case .markup, .linkMarkup, .leadingStars: fg("markup") 236 case .markup, .linkMarkup: fg("markup")
237 case .leadingStars:
238 // As the editor hides them; shown in the heading's color unless hidden.
239 if !Presentation.skipsLeadingStars(role, indented: indented, hideStars: startup?.hideStars ?? false) { color = .clear }
240 case .syntax(let category): if let key = category.themeKey { fg(key) }
172 case .timestamp: fg("timestamp") 241 case .timestamp: fg("timestamp")
173 case .comment: fg("comment") 242 case .comment: fg("comment")
174 case .keyword: fg("keyword") 243 case .keyword: fg("keyword")
@@ -179,13 +248,18 @@ struct ReaderScreen: View {
179 case .link: 248 case .link:
180 part.underlineStyle = .single 249 part.underlineStyle = .single
181 fg("link") 250 fg("link")
182 case .heading, .block, .syntax: break 251 case .heading, .block: break
183 } 252 }
184 } 253 }
185 if segment.link != nil { 254 if segment.link != nil {
186 // Found again by position when followed. 255 // Found again by position when followed.
187 part.link = URL(string: "orgstar-link:\(segment.offset)") 256 part.link = URL(string: "orgstar-link:\(segment.offset)")
188 } 257 }
258 if let superscript = segment.superscript {
259 // Raised or lowered as the editor draws `org-pretty-entities` scripts.
260 part.baselineOffset = (superscript ? 0.3 : -0.3) * font.pointSize
261 font = font.withSize(font.pointSize * 0.7)
262 }
189 part.font = Font(font as CTFont) 263 part.font = Font(font as CTFont)
190 part.foregroundColor = Color(uiColor: color) 264 part.foregroundColor = Color(uiColor: color)
191 result += part 265 result += part
@@ -216,15 +290,16 @@ struct ReaderScreen: View {
216 loadFolds() 290 loadFolds()
217 } 291 }
218 292
219 /// The file's startup visibility, kept while the same file is open. 293 /// The file's startup display, as the editor opens it; its heading folds are kept while
294 /// the same file is open.
220 private func loadFolds() { 295 private func loadFolds() {
221 guard let tree = session.document?.tree else { return } 296 guard let tree = session.document?.tree else { return }
222 folded = Presentation.startupWrappers( 297 let display = Presentation.startupDisplay(tree, options: session.options)
223 tree, hideDrawers: session.options.hideDrawerStartup, hideBlocks: session.options.hideBlockStartup 298 startup = display
224 ).map(\.hidden) 299 folded = display.wrappers.map(\.hidden)
225 guard loadedPath != session.path else { return } 300 guard loadedPath != session.path else { return }
226 loadedPath = session.path 301 loadedPath = session.path
227 fold = Presentation.applyVisibilityProperties(Presentation.startupFoldState(tree) ?? FoldState(), in: tree) 302 fold = display.folds
228 } 303 }
229 304
230 /// Unfolds the way to the heading containing `offset` and scrolls to it. 305 /// Unfolds the way to the heading containing `offset` and scrolls to it.
Tests/OrgCoreTests/BabelTests.swift +2
@@ -201,6 +201,8 @@ struct BabelTests {
201 "#+begin_src sh :dir (concat \"/\" \"usr\") :results output\npwd\n#+end_src\n", 201 "#+begin_src sh :dir (concat \"/\" \"usr\") :results output\npwd\n#+end_src\n",
202 "#+begin_src sh :dir /tmp :results output\npwd\n#+end_src\n", 202 "#+begin_src sh :dir /tmp :results output\npwd\n#+end_src\n",
203 "#+NAME: items\n- one\n- two\n\n#+begin_src shell :var l=items :results output\necho \"$l\"\n#+end_src\n", 203 "#+NAME: items\n- one\n- two\n\n#+begin_src shell :var l=items :results output\necho \"$l\"\n#+end_src\n",
204 // The nearest heading's header-args win.
205 "* A\n:PROPERTIES:\n:header-args: :var x=1\n:END:\n** B\n:PROPERTIES:\n:header-args: :var x=2\n:END:\n*** C\n#+begin_src sh\necho $x\n#+end_src\n",
204 // Lisp values. 206 // Lisp values.
205 "#+begin_src python :var l='(1 2) m='((1 2) (3 4)) n=(+ 1 2) s='(\"a\" \"b\")\nreturn [l, m, n, s]\n#+end_src\n", 207 "#+begin_src python :var l='(1 2) m='((1 2) (3 4)) n=(+ 1 2) s='(\"a\" \"b\")\nreturn [l, m, n, s]\n#+end_src\n",
206 "#+begin_src emacs-lisp :var l='(1 2) h='((1 2) hline (3 4)) s=(concat \"a\" \"b\")\n(list l h s)\n#+end_src\n", 208 "#+begin_src emacs-lisp :var l='(1 2) h='((1 2) hline (3 4)) s=(concat \"a\" \"b\")\n(list l h s)\n#+end_src\n",
Tests/OrgPresentationTests/ReadingTextTests.swift +36
@@ -18,4 +18,40 @@ struct ReadingTextTests {
18 // Offsets point into the file. 18 // Offsets point into the file.
19 #expect(site.map { (text as NSString).substring(with: NSRange(location: $0.offset, length: 8)) } == "the site") 19 #expect(site.map { (text as NSString).substring(with: NSRange(location: $0.offset, length: 8)) } == "the site")
20 } 20 }
21
22 static func shown(_ text: String, _ display: ReadingText.Display) -> [ReadingText.Segment] {
23 ReadingText.segments(OrgParser.parse(text), in: 0..<(text as NSString).length, display: display)
24 }
25
26 @Test func showMarkupShowsLinkBracketsAndEmphasisMarkers() {
27 var options = EditingOptions.org
28 options.hideEmphasisMarkers = true
29 let text = "a *b* [[c.org][d]]\n"
30 #expect(Self.shown(text, .init(options: options)).map(\.text).joined() == "a b d\n")
31 #expect(Self.shown(text, .init(showMarkup: false)).map(\.text).joined() == "a *b* d\n")
32 #expect(Self.shown(text, .init(showMarkup: true, options: options)).map(\.text).joined() == text)
33 }
34
35 @Test func prettyEntitiesShowTheirCharactersAndRaiseScripts() {
36 var options = EditingOptions.org
37 options.prettyEntities = true
38 options.subSuperscriptsNeedBraces = true
39 let text = "\\alpha and x^{2}\n#+begin_example\n\\beta\n#+end_example\n"
40 let segments = Self.shown(text, .init(options: options))
41 #expect(segments.map(\.text).joined() == "α and x2\n#+begin_example\n\\beta\n#+end_example\n")
42 #expect(segments.first { $0.text == "2" }?.superscript == true)
43 #expect(Self.shown(text, .init(showMarkup: true, options: options)).map(\.text).joined() == text)
44 }
45
46 struct Words: CodeHighlighter {
47 func highlights(language: String, code: String) -> [(range: Range<Int>, category: SyntaxCategory)] {
48 [(0..<4, .keyword)]
49 }
50 }
51
52 @Test func highlightsSrcBlocks() {
53 let text = "#+begin_src sh\necho hi\n#+end_src\n"
54 let segments = Self.shown(text, .init(highlighter: Words()))
55 #expect(segments.first { $0.text == "echo" }?.roles.contains(.syntax(.keyword)) == true)
56 }
21} 57}
Tests/OrgPresentationTests/ShrunkColumnsTests.swift added +66
@@ -0,0 +1,66 @@
1import Foundation
2import OrgCore
3import Testing
4@testable import OrgPresentation
5
6struct ShrunkColumnsTests {
7 static let table = "| <3> | b |\n|------+---|\n| abcdef | x |\n"
8
9 @Test func startupShrinksCookieColumnsOnlyWithTheWord() {
10 let plain = OrgParser.parse("intro\n" + Self.table)
11 #expect(ShrunkColumns.startup(plain).isEmpty)
12 let tree = OrgParser.parse("#+STARTUP: shrink\n" + Self.table + "\n| a | b |\n")
13 let shrunk = ShrunkColumns.startup(tree)
14 let start = ("#+STARTUP: shrink\n" as NSString).length
15 #expect(Array(shrunk.tables.keys) == [start])
16 #expect(shrunk.columns(in: start..<start + 1) == [1])
17 #expect(!shrunk.segments.isEmpty)
18 }
19
20 @Test func togglesTheColumnAtTheCaret() throws {
21 let text = Self.table
22 var shrunk = ShrunkColumns()
23 let caret = (text as NSString).range(of: "abc").location
24 guard case .set(let columns, let table) = shrunk.change(for: "org.table.toggle-column-width", at: caret, in: text) else {
25 Issue.record("expected a column")
26 return
27 }
28 #expect(columns == [1])
29 shrunk.set(columns, in: table, text: text)
30 #expect(shrunk.change(for: "org.table.toggle-column-width", at: caret, in: text) == .set([], table: table))
31 #expect(shrunk.change(for: "org.table.expand", at: caret, in: text) == .set([], table: table))
32 #expect(shrunk.change(for: "org.table.shrink", at: caret, in: text) == .set([1], table: table))
33 #expect(shrunk.change(for: "org.table.shrink", at: (text as NSString).length, in: text + "after\n") == .notInTable)
34 guard case .ask(_, let current, _) = shrunk.change(for: "org.table.toggle-column-width", at: 0, in: text) else {
35 Issue.record("expected a prompt before the first column")
36 return
37 }
38 #expect(ShrunkColumns.toggled(current, TableShrink.columns("1-2", max: 4)) == [2])
39 }
40
41 @Test func typingInAColumnWidensItButCommandsKeepIt() throws {
42 let text = Self.table
43 let table = try #require(TableShrink.table(at: 0, in: text))
44 var shrunk = ShrunkColumns()
45 shrunk.set([1], in: table, text: text)
46 let at = (text as NSString).range(of: "abc").location
47 let edit = TextEdit(range: at..<at, replacement: "z")
48 let after = (text as NSString).replacingCharacters(in: NSRange(location: at, length: 0), with: "z")
49 var byCommand = shrunk
50 #expect(byCommand.map(through: edit, in: after, command: true).count == 1)
51 #expect(byCommand.columns(in: table) == [1])
52 #expect(shrunk.map(through: edit, in: after, command: false).count == 1)
53 #expect(shrunk.isEmpty)
54 }
55
56 @Test func editsBeforeATableMoveIt() throws {
57 let text = "x\n" + Self.table
58 let table = try #require(TableShrink.table(at: 2, in: text))
59 var shrunk = ShrunkColumns()
60 shrunk.set([1], in: table, text: text)
61 let after = "xyz\n" + Self.table
62 #expect(shrunk.map(through: TextEdit(range: 1..<1, replacement: "yz"), in: after, command: false).isEmpty)
63 #expect(Array(shrunk.tables.keys) == [4])
64 #expect(shrunk.segments == TableShrink.segments(4..<4 + (Self.table as NSString).length, column: 1, in: after))
65 }
66}
docs/manual/guide/03-keys.org +10 −10
@@ -252,13 +252,13 @@ A =mode= other than =normal=, =insert= or =visual= (including =visual-line=) is
252** More examples 252** More examples
253 253
254#+BEGIN_SRC toml 254#+BEGIN_SRC toml
255# Mac preset: ⌃⌘U goes up to the parent heading, ⌃⌘R recalculates the table row, ⌃⌘; toggles COMMENT. 255# Mac preset: ⌃⌘U goes up to the parent heading, ⌃⌘R opens column view, ⌃⌘; toggles COMMENT.
256[[bind]] 256[[bind]]
257keys = "C-s-u" 257keys = "C-s-u"
258command = "org.heading.up" 258command = "org.heading.up"
259[[bind]] 259[[bind]]
260keys = "C-s-r" 260keys = "C-s-r"
261command = "org.table.recalc" 261command = "org.columns"
262[[bind]] 262[[bind]]
263keys = "C-s-;" 263keys = "C-s-;"
264command = "org.heading.toggle-comment" 264command = "org.heading.toggle-comment"
@@ -332,9 +332,9 @@ Motions move the caret in normal state, extend the selection in visual states, a
332| =$=, =<end>= | End of the line; with a count, of the line count − 1 lines down. | 332| =$=, =<end>= | End of the line; with a count, of the line count − 1 lines down. |
333| =g_= | Last non-blank of the line. | 333| =g_= | Last non-blank of the line. |
334| =gg=, =G= | First line, last line; with a count, that line. The column is kept (=evil-start-of-line= nil). | 334| =gg=, =G= | First line, last line; with a count, that line. The column is kept (=evil-start-of-line= nil). |
335| =f= /x/, =F= /x/, =t= /x/, =T= /x/ | To, or to just before, the next or previous /x/ on the line. These are one-character snipes, as Doom's =evil-snipe-override-mode= makes them: a lowercase /x/ matches either case, an uppercase one only itself; =t= and =T= skip a match right next to the caret; =f SPC= and =t SPC= skip a run of blanks after the caret and stop at the last blank before the next word, or just before it. Accented variants of /x/ don't match (=evil-snipe-char-fold= is not supported). | 335| =f= /x/, =F= /x/, =t= /x/, =T= /x/ | To, or to just before, the next or previous /x/ on the line. These are one-character snipes, as Doom's =evil-snipe-override-mode= makes them. /x/ also matches its accented and other variants, as Doom's =evil-snipe-char-fold= makes it: =a= matches =à=, =À=, =ª= and =a=. A lowercase /x/ matches either case, a capital only capitals; =t= and =T= skip a match right next to the caret; =f SPC= and =t SPC= skip a run of blanks after the caret and stop at the last blank before the next word, or just before it. |
336| =;=, =,= | Repeats the last snipe (=s=, =S=, =f=, =F=, =t= or =T=), forward or reversed. A repeat searches all the text the window shows, so it can go past the caret's line (=evil-snipe-repeat-scope=, as Doom sets it). Right after a snipe, its own key repeats it: =f= goes on in the same direction and =F= reverses, and the same for =t= and =T= and for =s= and =S=. A count before that repeating key is not supported. | 336| =;=, =,= | Repeats the last snipe (=s=, =S=, =f=, =F=, =t= or =T=), forward or reversed. A repeat searches all the text the window shows, so it can go past the caret's line (=evil-snipe-repeat-scope=, as Doom sets it). Right after a snipe, its own key repeats it: =f= goes on in the same direction and =F= reverses, and the same for =t= and =T= and for =s= and =S=. A count typed right after a snipe ends this: the key after the count starts a new snipe with that count, so =f a 2 f a= goes to the next /a/, then to the second /a/ after it. |
337| =s= /xy/, =S= /xy/ | evil-snipe: to the next or previous /xy/ on the line. All-lowercase /xy/ matches case-insensitively. Not available after an operator. | 337| =s= /xy/, =S= /xy/ | evil-snipe: to the next or previous /xy/ on the line. Each character matches its variants as for =f=, and /xy/ without a capital matches case-insensitively. =SPC= and =TAB= are read as a space and a tab. Not available after an operator. |
338| =%= | The bracket matching the next =()=, =[]= or ={}= on the line. | 338| =%= | The bracket matching the next =()=, =[]= or ={}= on the line. |
339| ={=, =}= | Previous, next blank line. | 339| ={=, =}= | Previous, next blank line. |
340| =/=, =?= | Asks in the echo area for a regular expression and searches forward or backward, wrapping around the file. | 340| =/=, =?= | Asks in the echo area for a regular expression and searches forward or backward, wrapping around the file. |
@@ -358,7 +358,7 @@ Search patterns are ICU regular expressions as macOS uses them, close to PCRE; E
358| =gc= /motion/ | Comments or uncomments lines with =#= (=evilnc-comment-operator=). =gcc= acts on lines. See [[*Commenting][Commenting]]. | 358| =gc= /motion/ | Comments or uncomments lines with =#= (=evilnc-comment-operator=). =gcc= acts on lines. See [[*Commenting][Commenting]]. |
359| =gq= /motion/, =gw= /motion/ | Fills the paragraphs in the motion's lines to the fill column, as Fill Paragraph does; other elements in the lines are left alone. =gq= leaves the caret on the first non-blank of the last line, =gw= where it was. Extra spaces between words and at the ends of lines are kept, as Doom fills without squeezing them. =gqq= and =gww= act on lines. | 359| =gq= /motion/, =gw= /motion/ | Fills the paragraphs in the motion's lines to the fill column, as Fill Paragraph does; other elements in the lines are left alone. =gq= leaves the caret on the first non-blank of the last line, =gw= where it was. Extra spaces between words and at the ends of lines are kept, as Doom fills without squeezing them. =gqq= and =gww= act on lines. |
360 360
361=M-q= runs Fill Paragraph in normal, insert and visual state. In visual and visual-line state it fills every paragraph the selection touches and leaves the caret where it was; if the text changed, the editor returns to normal state, otherwise the selection stays. 361=M-q= runs Fill Paragraph in normal, insert and visual state. In visual and visual-line state it fills every paragraph the selection touches and leaves the caret where it was. In visual-block state it fills the paragraph at the caret, as evil does with =transient-mark-mode= off. In each, if the text changed, the editor returns to normal state, otherwise the selection stays.
362 362
363Counts multiply: =2d3w= deletes six words. Doubling an operator with a count acts on that many lines: =3dd=. 363Counts multiply: =2d3w= deletes six words. Doubling an operator with a count acts on that many lines: =3dd=.
364 364
@@ -856,7 +856,7 @@ When a key appears in several rows, it runs the command whose condition holds at
856| Clock In to Recent Entry… (=app.clock.in-recent=) | — | =⌃⌥⌘I= | — | Asks for an entry from the clock history and clocks in to it (=org-clock-in= with =C-u=). | 856| Clock In to Recent Entry… (=app.clock.in-recent=) | — | =⌃⌥⌘I= | — | Asks for an entry from the clock history and clocks in to it (=org-clock-in= with =C-u=). |
857| Clock In to Last Entry (=app.clock.in-last=) | =C-c C-x C-x= | — | =SPC m c I= (N) | Clocks in to the most recently clocked entry (=org-clock-in-last=). | 857| Clock In to Last Entry (=app.clock.in-last=) | =C-c C-x C-x= | — | =SPC m c I= (N) | Clocks in to the most recently clocked entry (=org-clock-in-last=). |
858| Clock Out (=app.clock.out=) | =C-c C-x C-o= | =⌃⇧⌘I= | =SPC m c o= (N) | Stops the clock (=org-clock-out=). | 858| Clock Out (=app.clock.out=) | =C-c C-x C-o= | =⌃⇧⌘I= | =SPC m c o= (N) | Stops the clock (=org-clock-out=). |
859| Cancel Clock (=app.clock.cancel=) | =C-c C-x C-q= | — | =SPC m c c= (N) | Stops the clock and removes the running clock line (=org-clock-cancel=). | 859| Cancel Clock (=app.clock.cancel=) | =C-c C-x C-q= | =⌃⌘K= | =SPC m c c= (N) | Stops the clock and removes the running clock line (=org-clock-cancel=). |
860| Go to Clocked Entry (=app.clock.goto=) | =C-c C-x C-j= | =⌃⌘J= | =SPC m c g= (N) | Opens the entry the clock is running on, or the most recently clocked one (=org-clock-goto=). | 860| Go to Clocked Entry (=app.clock.goto=) | =C-c C-x C-j= | =⌃⌘J= | =SPC m c g= (N) | Opens the entry the clock is running on, or the most recently clocked one (=org-clock-goto=). |
861| Go to Recent Clocked Entry… (=app.clock.goto-recent=) | — | =⌃⌥⌘J= | =SPC m c G= (N) | Asks for an entry from the clock history and opens it (=org-clock-goto= with =C-u=). | 861| Go to Recent Clocked Entry… (=app.clock.goto-recent=) | — | =⌃⌥⌘J= | =SPC m c G= (N) | Asks for an entry from the clock history and opens it (=org-clock-goto= with =C-u=). |
862| Mark as Default Clock Task (=app.clock.default=) | — | — | =SPC m c d= (N) | Makes the current entry the default task, =d= in the clock selection (=org-clock-mark-default-task=). | 862| Mark as Default Clock Task (=app.clock.default=) | — | — | =SPC m c d= (N) | Makes the current entry the default task, =d= in the clock selection (=org-clock-mark-default-task=). |
@@ -882,7 +882,7 @@ When a key appears in several rows, it runs the command whose condition holds at
882| Insert Table Row (=org.table.insert-row=) | =M-S-<down>= | =⌃⌥⌘↓= | =M-J=, =SPC m b i r= (N) | In a table, inserts a row (=org-table-insert-row=). | 882| Insert Table Row (=org.table.insert-row=) | =M-S-<down>= | =⌃⌥⌘↓= | =M-J=, =SPC m b i r= (N) | In a table, inserts a row (=org-table-insert-row=). |
883| Delete Table Row (=org.table.kill-row=) | =M-S-<up>= | =⌃⌥⌘↑= | =M-K=, =SPC m b d r= (N) | In a table, deletes the row (=org-table-kill-row=). | 883| Delete Table Row (=org.table.kill-row=) | =M-S-<up>= | =⌃⌥⌘↑= | =M-K=, =SPC m b d r= (N) | In a table, deletes the row (=org-table-kill-row=). |
884| Insert Table Rule (=org.table.insert-hline=) | =C-c -= | =⌃⌘-= | =SPC m b -= (N), =SPC m b i h= (N) | In a table, inserts a horizontal rule (=org-table-insert-hline=). | 884| Insert Table Rule (=org.table.insert-hline=) | =C-c -= | =⌃⌘-= | =SPC m b -= (N), =SPC m b i h= (N) | In a table, inserts a horizontal rule (=org-table-insert-hline=). |
885| Recalculate Table Row (=org.table.recalc=) | =C-c *= | — | — | In a table, recalculates the current row (=org-table-recalculate=). | 885| Recalculate Table Row (=org.table.recalc=) | =C-c *= | =⌃⌘*= | — | In a table, recalculates the current row (=org-table-recalculate=). On a US keyboard, =⌃⌘*= is typed =⌃⇧⌘8=. |
886| Recalculate Table (=org.table.recalc-all=) | =C-c C-c= | =⌃⌘X= | =SPC m b r= (N) | Recalculates the whole table; =C-c C-c= and =⌃⌘X= run it on a =#+TBLFM= line (=org-table-recalculate= with =C-u=). | 886| Recalculate Table (=org.table.recalc-all=) | =C-c C-c= | =⌃⌘X= | =SPC m b r= (N) | Recalculates the whole table; =C-c C-c= and =⌃⌘X= run it on a =#+TBLFM= line (=org-table-recalculate= with =C-u=). |
887| Set Column Formula (=org.table.column-formula=) | ~C-c =~ | — | — | Asks for the column's formula, offering the stored one (=org-table-eval-formula=). | 887| Set Column Formula (=org.table.column-formula=) | ~C-c =~ | — | — | Asks for the column's formula, offering the stored one (=org-table-eval-formula=). |
888| Edit Table Field (=org.table.edit-field=) | =C-c `= | — | — | In a table, edits the field in a separate editor (=org-table-edit-field=). | 888| Edit Table Field (=org.table.edit-field=) | =C-c `= | — | — | In a table, edits the field in a separate editor (=org-table-edit-field=). |
@@ -906,6 +906,8 @@ When a key appears in several rows, it runs the command whose condition holds at
906| Act at Point (=org.dwim=) | — | — | =RET= (N) | Doom's =+org/dwim-at-point=: follows a link, runs a src block, recalculates or aligns a table, toggles a checkbox, or switches a heading between TODO and done. | 906| Act at Point (=org.dwim=) | — | — | =RET= (N) | Doom's =+org/dwim-at-point=: follows a link, runs a src block, recalculates or aligns a table, toggles a checkbox, or switches a heading between TODO and done. |
907| Run Source Block (=org.babel.execute=) | =C-c C-c= | =⌃⌘X= | — | In a src block, runs it and inserts the results (=org-babel-execute-src-block=). | 907| Run Source Block (=org.babel.execute=) | =C-c C-c= | =⌃⌘X= | — | In a src block, runs it and inserts the results (=org-babel-execute-src-block=). |
908| Tangle File (=org.babel.tangle=) | =C-c C-v t=, =C-c C-v C-t= | =⌃⌘V= | — | Writes the file's src blocks to their tangle targets (=org-babel-tangle=). | 908| Tangle File (=org.babel.tangle=) | =C-c C-v t=, =C-c C-v C-t= | =⌃⌘V= | — | Writes the file's src blocks to their tangle targets (=org-babel-tangle=). |
909| Tangle Block (=org.babel.tangle-block=) | — | =⌃⇧⌘V= | — | Tangles only the src block at point (=org-babel-tangle= with =C-u=). |
910| Tangle Block's Target (=org.babel.tangle-target=) | — | =⌃⌥⌘V= | — | Tangles every block that writes to the same file as the block at point (=org-babel-tangle= with =C-u C-u=). |
909| Insert Structure Template (=org.structure-template=) | =C-c C-,= | — | — | Asks for a block type and inserts the block, or wraps the selection (=org-insert-structure-template=). | 911| Insert Structure Template (=org.structure-template=) | =C-c C-,= | — | — | Asks for a block type and inserts the block, or wraps the selection (=org-insert-structure-template=). |
910| Edit Block (=org.edit-special=) | =C-c '= | =⌃⌘'= | =SPC m '= (N) | Edits the src, example or export block at point in a separate editor (=org-edit-special=). | 912| Edit Block (=org.edit-special=) | =C-c '= | =⌃⌘'= | =SPC m '= (N) | Edits the src, example or export block at point in a separate editor (=org-edit-special=). |
911 913
@@ -971,8 +973,6 @@ No preset binds these. Run them from the palette or a menu, or bind them in =key
971| Show or Hide Markup (=app.toggle-markup=) | Shows or hides link brackets and emphasis markers. View ▸ Show Markup, =⇧⌘M=. | 973| Show or Hide Markup (=app.toggle-markup=) | Shows or hides link brackets and emphasis markers. View ▸ Show Markup, =⇧⌘M=. |
972| Show or Hide Line Numbers (=app.toggle-line-numbers=) | Shows or hides line numbers. View ▸ Show Line Numbers, =⇧⌘L=. | 974| Show or Hide Line Numbers (=app.toggle-line-numbers=) | Shows or hides line numbers. View ▸ Show Line Numbers, =⇧⌘L=. |
973| Show or Hide Tab Bar (=app.toggle-tab-bar=) | Shows or hides the tab bar. View ▸ Show Tab Bar. | 975| Show or Hide Tab Bar (=app.toggle-tab-bar=) | Shows or hides the tab bar. View ▸ Show Tab Bar. |
974| Tangle Block (=org.babel.tangle-block=) | Tangles only the src block at point (=org-babel-tangle= with =C-u=). |
975| Tangle Block's Target (=org.babel.tangle-target=) | Tangles every block that writes to the same file as the block at point (=org-babel-tangle= with =C-u C-u=). |
976| Column View of File (=org.columns.global=) | Shows the column view of the whole file (=org-columns= with =C-u=). | 976| Column View of File (=org.columns.global=) | Shows the column view of the whole file (=org-columns= with =C-u=). |
977| Remove Schedule (=org.schedule.remove=) | Removes =SCHEDULED= (=org-schedule= with =C-u=). | 977| Remove Schedule (=org.schedule.remove=) | Removes =SCHEDULED= (=org-schedule= with =C-u=). |
978| Remove Deadline (=org.deadline.remove=) | Removes =DEADLINE= (=org-deadline= with =C-u=). | 978| Remove Deadline (=org.deadline.remove=) | Removes =DEADLINE= (=org-deadline= with =C-u=). |
docs/manual/guide/06-dates-and-clocking.org +6 −4
@@ -214,7 +214,7 @@ Clocking records the time you work on an entry as =CLOCK:= lines in its =LOGBOOK
214| Clock In to Recent Entry… | =org-clock-in= with =C-u= | | =⌃⌥⌘I= | | | 214| Clock In to Recent Entry… | =org-clock-in= with =C-u= | | =⌃⌥⌘I= | | |
215| Clock In to Last Entry | =org-clock-in-last= | =C-c C-x C-x= | | =SPC m c I= | | 215| Clock In to Last Entry | =org-clock-in-last= | =C-c C-x C-x= | | =SPC m c I= | |
216| Clock Out | =org-clock-out= | =C-c C-x C-o= | =⌃⇧⌘I= | =SPC m c o= | =O= | 216| Clock Out | =org-clock-out= | =C-c C-x C-o= | =⌃⇧⌘I= | =SPC m c o= | =O= |
217| Cancel Clock | =org-clock-cancel= | =C-c C-x C-q= | | =SPC m c c= | | 217| Cancel Clock | =org-clock-cancel= | =C-c C-x C-q= | =⌃⌘K= | =SPC m c c= | |
218| Go to Clocked Entry | =org-clock-goto= | =C-c C-x C-j= | =⌃⌘J= | =SPC m c g= | | 218| Go to Clocked Entry | =org-clock-goto= | =C-c C-x C-j= | =⌃⌘J= | =SPC m c g= | |
219| Go to Recent Clocked Entry… | =org-clock-goto= with =C-u= | | =⌃⌥⌘J= | =SPC m c G= | | 219| Go to Recent Clocked Entry… | =org-clock-goto= with =C-u= | | =⌃⌥⌘J= | =SPC m c G= | |
220| Mark as Default Clock Task | =org-clock-mark-default-task= | | | =SPC m c d= | | 220| Mark as Default Clock Task | =org-clock-mark-default-task= | | | =SPC m c d= | |
@@ -243,7 +243,7 @@ CLOCK: [2026-10-06 Tue 14:00]--[2026-10-06 Tue 15:30] => 1:30
243- Cancel Clock removes the running clock's line, and the drawer if it is left empty. 243- Cancel Clock removes the running clock's line, and the drawer if it is left empty.
244- Go to Clocked Entry opens the file and moves the caret to the running clock's line. With no clock running, it goes to the most recently clocked entry and says "No running clock, this is the most recently clocked task". 244- Go to Clocked Entry opens the file and moves the caret to the running clock's line. With no clock running, it goes to the most recently clocked entry and says "No running clock, this is the most recently clocked task".
245 245
246With no clock running, Clock In first asks about open clocks; see Open clocks below. 246With no clock running, Clock In first asks about open clocks; see Open clocks below. So do the agenda's =I= and a capture template's =clock-in=.
247 247
248Orgstar remembers the running clock and the clock history across restarts, in =clock.json= in =~/Library/Application Support/Orgstar=. If the open =CLOCK:= line is deleted from the file, Clock Out reports "Clock start time is gone" and forgets the clock. 248Orgstar remembers the running clock and the clock history across restarts, in =clock.json= in =~/Library/Application Support/Orgstar=. If the open =CLOCK:= line is deleted from the file, Clock Out reports "Clock start time is gone" and forgets the clock.
249 249
@@ -294,7 +294,9 @@ When you clock in with no clock running, Orgstar first looks for open clocks in
294Dangling clock started 95 mins ago [jkKtTgGSscCiq]? 294Dangling clock started 95 mins ago [jkKtTgGSscCiq]?
295#+END_EXAMPLE 295#+END_EXAMPLE
296 296
297Resolve Open Clocks… asks the same about every open clock, the running one included, and says "No open clocks" when there are none. Clocking in from the agenda or a capture template doesn't look for open clocks first. 297Clocking in from the agenda (=I=) or from a capture template with =clock-in= asks too, as =org-clock-in= does in Org. A capture template resolves open clocks as of when the capture began, which is when its clock starts. On the Mac, the questions for an agenda or capture clock-in are asked in the main window's echo area.
298
299Resolve Open Clocks… asks the same about every open clock, the running one included, and says "No open clocks" when there are none.
298 300
299Unlike Org, Orgstar doesn't show the clock's line while it asks; =j= opens it afterwards, except while clocking in. 301Unlike Org, Orgstar doesn't show the clock's line while it asks; =j= opens it afterwards, except while clocking in.
300 302
@@ -322,7 +324,7 @@ The answer is a key, as in =org-clock-resolve=. The idle time is the time since
322 324
323While clocking in, an answer never restarts the clock it resolves: where a key would start a new clock or keep one running, the line ends instead, and the clock you asked for starts. Resolving an open clock that isn't running with =k= and all the minutes, outside a clock-in, makes it the running clock. 325While clocking in, an answer never restarts the clock it resolves: where a key would start a new clock or keep one running, the line ends instead, and the clock you asked for starts. Resolving an open clock that isn't running with =k= and all the minutes, outside a clock-in, makes it the running clock.
324 326
325When =K=, =T= or =S= ends a clock outside a clock-in, the next clock-in asks: 327When =K=, =T= or =S= ends a clock outside a clock-in, the next clock-in, from the agenda or a capture template too, asks:
326 328
327#+BEGIN_EXAMPLE 329#+BEGIN_EXAMPLE
328You stopped another clock 12 mins ago; start this one from then? (y or n) 330You stopped another clock 12 mins ago; start this one from then? (y or n)
docs/manual/guide/07-agenda.org +2
@@ -383,6 +383,8 @@ Select a line with the arrow keys or the mouse. These keys work in the agenda wi
383 383
384=C-c C-w= brings the main window forward and asks for the target there, where the target list is searchable. 384=C-c C-w= brings the main window forward and asks for the target there, where the target list is searchable.
385 385
386=I= clocks in as Clock In does, so with no clock running it first asks about open clocks, in the main window's echo area. See [[file:06-dates-and-clocking.org][Dates, scheduling and clocking]].
387
386Each action finds the entry again by its heading line before it changes anything, so an action on a line whose entry has since moved or changed reports that rather than editing the wrong text. Edits go through the open buffer when the file is open, and through the file otherwise. 388Each action finds the entry again by its heading line before it changes anything, so an action on a line whose entry has since moved or changed reports that rather than editing the wrong text. Edits go through the open buffer when the file is open, and through the file otherwise.
387 389
388** Bulk actions 390** Bulk actions
docs/manual/guide/08-capture.org +1 −1
@@ -139,7 +139,7 @@ Placement follows =org-capture-place-entry= and its siblings, including how blan
139 139
140** Clocking while capturing 140** Clocking while capturing
141 141
142With =clock-in = true=, the captured entry gets a clock entry from when the template was filled to when you filed it, as Emacs clocks in while the capture buffer is open and out on finalize. With =clock-keep = true= as well, the clock keeps running in the new entry. With =clock-resume = true=, the clock that was running before the capture starts again after filing. See [[file:06-dates-and-clocking.org][Dates, scheduling and clocking]]. 142With =clock-in = true=, the captured entry gets a clock entry from when the template was filled to when you filed it, as Emacs clocks in while the capture buffer is open and out on finalize. With =clock-keep = true= as well, the clock keeps running in the new entry. With =clock-resume = true=, the clock that was running before the capture starts again after filing. With no clock running, clocking in to the entry first asks about open clocks, as Clock In does, as of when the capture began; on the Mac the questions are in the main window's echo area. See [[file:06-dates-and-clocking.org][Dates, scheduling and clocking]].
143 143
144* Template escapes 144* Template escapes
145 145
docs/manual/guide/10-tables.org +7 −2
@@ -142,6 +142,10 @@ A column without a width cookie shrinks to a bare =…= when toggled. Typing in
142field widens its column again, as editing Org's overlays does. =#+STARTUP: shrink= 142field widens its column again, as editing Org's overlays does. =#+STARTUP: shrink=
143narrows every column with a width cookie when the file opens. 143narrows every column with a width cookie when the file opens.
144 144
145The iOS editor narrows columns the same way, with =#+STARTUP: shrink= and the three
146commands, which are in Commands when the caret is in a table. The iOS reader shows
147tables at full width.
148
145* Importing and exporting 149* Importing and exporting
146 150
147| Command | Org command | 151| Command | Org command |
@@ -481,7 +485,7 @@ The formulas are stored sorted the way =org-table-formula-less-p= sorts them.
481| Command | Org command | Emacs | Mac | Doom | 485| Command | Org command | Emacs | Mac | Doom |
482|----------------------------------+-----------------------------------+-------------------------------+-----------------------------+-------------------------------------| 486|----------------------------------+-----------------------------------+-------------------------------+-----------------------------+-------------------------------------|
483| Recalculate Table | =org-table-recalculate= with =C-u= | =C-c C-c= on =#+TBLFM:= | =⌃⌘X= on =#+TBLFM:= | =SPC m b r=, =C-c C-c= on =#+TBLFM:= | 487| Recalculate Table | =org-table-recalculate= with =C-u= | =C-c C-c= on =#+TBLFM:= | =⌃⌘X= on =#+TBLFM:= | =SPC m b r=, =C-c C-c= on =#+TBLFM:= |
484| Recalculate Table Row | =org-table-recalculate= | =C-c *= | Org ▸ Recalculate Table Row | =C-c *= | 488| Recalculate Table Row | =org-table-recalculate= | =C-c *= | =⌃⌘*= (=⌃⇧⌘8= on a US keyboard) | =C-c *= |
485 489
486In Doom's normal state, =RET= in a table recalculates it when it has a =#+TBLFM:= 490In Doom's normal state, =RET= in a table recalculates it when it has a =#+TBLFM:=
487line and aligns it otherwise; on a =#+TBLFM:= line it recalculates. 491line and aligns it otherwise; on a =#+TBLFM:= line it recalculates.
@@ -565,5 +569,6 @@ plots (=org-plot/gnuplot= is not available).
565 569
566The iOS app evaluates formulas natively with the same engine. Tables that need Emacs 570The iOS app evaluates formulas natively with the same engine. Tables that need Emacs
567are not recalculated there; the app reports =This table needs Emacs, which runs on the 571are not recalculated there; the app reports =This table needs Emacs, which runs on the
568Mac= with the reason. Table import and export are Mac only. See 572Mac= with the reason. Table import and export are Mac only. Narrow columns work in the
573editor, as described under /Narrow columns/. See
569[[file:14-ios.org][iOS]]. 574[[file:14-ios.org][iOS]].
docs/manual/guide/11-code-blocks.org +71 −18
@@ -18,7 +18,7 @@ Lines inside a block that start with =*= or =#+= are protected with a leading co
18 18
19** Syntax highlighting 19** Syntax highlighting
20 20
21On the Mac, the code in a block is highlighted in the editor and in the block editor. Highlighting uses tree-sitter grammars for these language names: 21The code in a block is highlighted in the editor on the Mac and on iOS, in the iOS reader, and in the Mac's block editor, in the theme's =syntax-*= colours. Highlighting uses tree-sitter grammars for these language names:
22 22
23| Language names | Grammar | 23| Language names | Grammar |
24|---------------------------------+------------| 24|---------------------------------+------------|
@@ -41,7 +41,7 @@ On the Mac, the code in a block is highlighted in the editor and in the block ed
41| =toml=, =conf-toml= | TOML | 41| =toml=, =conf-toml= | TOML |
42| =lua= | Lua | 42| =lua= | Lua |
43 43
44Names are matched without regard to case. Blocks in any other language show as plain monospaced text. The iOS app does not highlight code. 44Names are matched without regard to case. Blocks in any other language show as plain monospaced text.
45 45
46* Editing a block apart 46* Editing a block apart
47 47
@@ -95,6 +95,7 @@ On the Mac, Orgstar starts each interpreter through =/usr/bin/env=. Because an a
95| =R= | =Rscript -= | 95| =R= | =Rscript -= |
96| =awk= | =awk -f /dev/stdin= | 96| =awk= | =awk -f /dev/stdin= |
97| =dot=, =plantuml=, =mermaid= | =dot=, =plantuml=, =mmdc=; see Graphics below | 97| =dot=, =plantuml=, =mermaid= | =dot=, =plantuml=, =mmdc=; see Graphics below |
98| =C=, =C++=, =cpp=, =D=, =java=, =fortran=, =clojure= | A compiler, or =bb= or =clojure=; see Compiled languages below |
98 99
99For =ruby=, =js=, =javascript=, =R= and =awk=, =:cmd= names a different program. These languages always return their standard output, and =:var= is refused for them. 100For =ruby=, =js=, =javascript=, =R= and =awk=, =:cmd= names a different program. These languages always return their standard output, and =:var= is refused for them.
100 101
@@ -102,6 +103,42 @@ Any other language is refused with "No way to run /language/ blocks yet."
102 103
103A run that takes longer than five minutes is stopped. Runs in a =:session= have no time limit. 104A run that takes longer than five minutes is stopped. Runs in a =:session= have no time limit.
104 105
106** Compiled languages
107
108On the Mac, =C=, =C++=, =cpp=, =D=, =java=, =fortran= and =clojure= blocks run as Org's =ob-C=, =ob-java=, =ob-fortran= and =ob-clojure= run them. Orgstar writes the body, expanded as tangling writes it (see Tangling below), to a source file in a temporary folder, compiles it and runs the program in the file's folder or =:dir=, with a newline on standard input. What the compiler prints is dropped.
109
110| Language | Commands |
111|-----------------+----------------------------------------------------------------------------------|
112| =C= | =gcc -o bin FLAGS src LIBS=, then =bin CMDLINE= |
113| =C++=, =cpp= | =g++ -o bin FLAGS src LIBS=, then =bin CMDLINE= |
114| =D= | =rdmd FLAGS src CMDLINE=, which compiles and runs |
115| =fortran= | =gfortran -o bin FLAGS src=, then =bin CMDLINE= |
116| =java= | =javac CMPFLAG Class.java=, then =java -cp dir CMDLINE Class CMDARGS= |
117| =clojure= | =bb src= (babashka) when =bb= is installed, otherwise =clojure -M src= |
118
119FLAGS is =:flags=, LIBS is =:libs= or the inherited =LIBS= property, and CMDLINE is =:cmdline=. A Lisp list works for =:flags= and =:libs=; its items are joined with spaces.
120
121| Argument | Languages | Effect |
122|---------------------+-----------------------+-----------------------------------------------------------------------------------------|
123| =:flags= | C, C++, D, Fortran | Compiler options. |
124| =:libs= | C, C++ | Libraries, after the source file, such as =-lm=. |
125| =:cmdline= | C, C++, D, Fortran | The program's arguments. |
126| =:cmdline= | Java | Options for =java=, before the class name. |
127| =:cmdargs= | Java | The program's arguments. |
128| =:cmpflag= | Java | Options for =javac=. |
129| =:javac=, =:java= | Java | The compiler and runtime commands, with options; =javac= and =java= by default. |
130| =:classname= | Java | The class to run; a dotted name gives its package. |
131| =:backend= | Clojure | =babashka= runs =bb=, =clojure-cli= runs =clojure -M=. |
132| =:includes=, =:defines=, =:namespaces=, =:imports=, =:main=, =:prologue=, =:epilogue=, =:ns=, =:var= | as for tangling | What the expansion writes; see Tangling below. |
133
134When =:imports= is absent, a D block reads the =IMPORTS= property where it is, and a Fortran block without =:includes= or =:defines= reads the =INCLUDES= and =DEFINES= properties, as Org does when it runs them. =:session= is ignored for these languages, as in Org.
135
136Java's defaults are =:results output= and =:dir .= (=org-babel-default-header-args:java=). The =.java= and =.class= files are written in the folder the block runs in, under folders for the class's package (=org/ex/Hello.java= for =:classname org.ex.Hello=), and are left there. The class is =:classname=, the body's own class with its =package=, or =Main=.
137
138Any other Clojure backend is refused: "The cider backend for clojure needs Emacs; Orgstar runs babashka or clojure-cli."
139
140Before a run, Orgstar checks that each program it needs is on the =PATH= described above. If not, the block fails with "gcc isn't installed, so C blocks can't run." (=g++= for C++, =rdmd=, =gfortran=, or the commands =:javac= and =:java= name). For Clojure without a =:backend=, the message is "Neither bb nor clojure is installed, so clojure blocks can't run."
141
105** The trust prompt 142** The trust prompt
106 143
107Before a block runs, Orgstar asks "Run this /language/ block? (yes, no, always)", as =org-confirm-babel-evaluate= does. 144Before a block runs, Orgstar asks "Run this /language/ block? (yes, no, always)", as =org-confirm-babel-evaluate= does.
@@ -170,6 +207,10 @@ What "value" means depends on the language:
170| Python in a =:session= | The value of the last expression. | 207| Python in a =:session= | The value of the last expression. |
171| Emacs Lisp | The value of the last form. | 208| Emacs Lisp | The value of the last form. |
172| =ruby=, =js=, =R=, =awk= | Standard output, always. | 209| =ruby=, =js=, =R=, =awk= | Standard output, always. |
210| C, C++, D | Standard output without its common indentation, read as a table as for shells. |
211| Fortran | The same, with blank space around the output trimmed. |
212| Java | With =:results value=, what the body returns; it runs as =main=, so it needs =return=. Lists and arrays become tables, with =null= rows as rules, and a returned string is written without its quotes. Java's default is =:results output=. |
213| Clojure | The value of the last form as Clojure prints it. A number, or a string without its quotes, is written as that; vectors, lists and maps are written as printed, not as tables. |
173 214
174Python lists of lists become tables, with =None= rows as rules. A flat list becomes a one-row table. Emacs Lisp lists become tables the same way, with =hline= for rules. Numbers are written the way Emacs prints them. 215Python lists of lists become tables, with =None= rows as rules. A flat list becomes a one-row table. Emacs Lisp lists become tables the same way, with =hline= for rules. Numbers are written the way Emacs prints them.
175 216
@@ -184,6 +225,18 @@ Python lists of lists become tables, with =None= rows as rules. A flat list beco
184 225
185=:results verbatim= on an Emacs Lisp value writes it as =prin1= would, with quotes around strings. 226=:results verbatim= on an Emacs Lisp value writes it as =prin1= would, with quotes around strings.
186 227
228With =:results output list=, the list made from the output is written as an example, in lines such as =: - a=, as Org writes it:
229
230#+BEGIN_SRC org
231,#+begin_src sh :results output list
232printf 'a\nb\n'
233,#+end_src
234
235,#+RESULTS:
236: - a
237: - b
238#+END_SRC
239
187** Result formats 240** Result formats
188 241
189| Word | Written as | 242| Word | Written as |
@@ -303,9 +356,9 @@ A string or number takes the place of the form. Lisp that the interpreter cannot
303| =:separator= | text | Column separator for tables in shell variables; a tab by default. | 356| =:separator= | text | Column separator for tables in shell variables; a tab by default. |
304| =:hline-string= | text | What a rule becomes in a shell variable with =:hlines yes=; =hline= by default. | 357| =:hline-string= | text | What a rule becomes in a shell variable with =:hlines yes=; =hline= by default. |
305| =:dir= | folder | Folder to run in, relative to the file's folder. It must exist. | 358| =:dir= | folder | Folder to run in, relative to the file's folder. It must exist. |
306| =:session= | name, =none= | Runs in a long-lived interpreter (see Sessions below). Shells and Python only. | 359| =:session= | name, =none= | Runs in a long-lived interpreter (see Sessions below). Shells and Python only; ignored for the compiled languages. |
307| =:stdin= | name of a table, list or block | Feeds the value to standard input. Shells only. | 360| =:stdin= | name of a table, list or block | Feeds the value to standard input. Shells only. |
308| =:cmdline= | arguments | Command-line arguments. Shells, =dot=, =plantuml= and =mermaid= only. | 361| =:cmdline= | arguments | Command-line arguments. Shells, =dot=, =plantuml=, =mermaid= and the compiled languages only. |
309| =:shebang= | =#!…= line | Runs the block as a script with this first line. Shells only; also used by tangling. | 362| =:shebang= | =#!…= line | Runs the block as a script with this first line. Shells only; also used by tangling. |
310| =:padline= | =no= | No blank line after the shebang of a script, or between tangled blocks. | 363| =:padline= | =no= | No blank line after the shebang of a script, or between tangled blocks. |
311| =:python= | program | Python interpreter to use. | 364| =:python= | program | Python interpreter to use. |
@@ -326,10 +379,10 @@ Orgstar does not run a block whose arguments it would handle differently from Em
326 379
327| Argument | Refused for | Message | 380| Argument | Refused for | Message |
328|-----------------------------+-------------------------------------------------+----------------------------------------------------------| 381|-----------------------------+-------------------------------------------------+----------------------------------------------------------|
329| =:prologue=, =:epilogue=, =:post= | every language when running (tangling uses =:prologue= and =:epilogue=) | "=:prologue= isn't supported yet; nothing was run." | 382| =:prologue=, =:epilogue=, =:post= | every language when running, except =:prologue= and =:epilogue= for the compiled languages (tangling uses =:prologue= and =:epilogue=) | "=:prologue= isn't supported yet; nothing was run." |
330| =:stdin=, =:shebang= | languages other than shells | "=:stdin= isn't supported yet; nothing was run." | 383| =:stdin=, =:shebang= | languages other than shells | "=:stdin= isn't supported yet; nothing was run." |
331| =:cmdline= | languages other than shells and graphics | "=:cmdline= isn't supported for /language/ yet; nothing was run." | 384| =:cmdline= | languages other than shells, graphics and the compiled languages | "=:cmdline= isn't supported for /language/ yet; nothing was run." |
332| =:session= | languages other than shells and Python | "=:session= isn't supported for /language/ yet; nothing was run." | 385| =:session= | languages other than shells, Python and the compiled languages, which ignore it | "=:session= isn't supported for /language/ yet; nothing was run." |
333| =:var= | =ruby=, =js=, =javascript=, =R=, =awk= | "=:var= isn't supported for /language/ yet." | 386| =:var= | =ruby=, =js=, =javascript=, =R=, =awk= | "=:var= isn't supported for /language/ yet." |
334 387
335* Variables 388* Variables
@@ -373,7 +426,7 @@ How a value reaches the code depends on the language:
373| Python | literal | list | list of lists, =None= for rules | 426| Python | literal | list | list of lists, =None= for rules |
374| Emacs Lisp | =let=-bound value | list | list of lists, =hline= for rules | 427| Emacs Lisp | =let=-bound value | list | list of lists, =hline= for rules |
375 428
376For =shell= blocks, the bash forms are used when =SHELL= is bash. 429For =shell= blocks, the bash forms are used when =SHELL= is bash. C, C++, D, Java, Fortran and Clojure blocks get declarations as their expansion writes them; see Tangling below.
377 430
378#+BEGIN_SRC org 431#+BEGIN_SRC org
379,#+NAME: kv 432,#+NAME: kv
@@ -393,7 +446,7 @@ A table passed as a variable loses some of its structure first (=org-babel-disas
393- The first row is taken off as column names when =:colnames yes=, or when the table's only rule is under the first row. =:colnames no= keeps it as data. 446- The first row is taken off as column names when =:colnames yes=, or when the table's only rule is under the first row. =:colnames no= keeps it as data.
394- The first column is taken off as row names when =:rownames yes=. 447- The first column is taken off as row names when =:rownames yes=.
395 448
396If the result is a table of the same width (for columns) or height (for rows), the names are put back on it (=org-babel-reassemble-table=). =:colnames= and =:rownames= can also be Lisp lists of names to put on the result, such as =:colnames '("x" "y")=. 449If the result is a table of the same width (for columns) or height (for rows), the names are put back on it (=org-babel-reassemble-table=). Clojure results don't get them back, as in Org. =:colnames= and =:rownames= can also be Lisp lists of names to put on the result, such as =:colnames '("x" "y")=.
397 450
398#+BEGIN_SRC org 451#+BEGIN_SRC org
399,#+NAME: tbl 452,#+NAME: tbl
@@ -445,7 +498,7 @@ With =:cache yes=, Orgstar computes a SHA-1 hash of the block's header arguments
445 498
446Change the block or its arguments and it runs again. Results inserted with =append= or =prepend= carry no hash. Inline blocks are not cached. A cached block that has Lisp in its header arguments the interpreter cannot evaluate is refused. 499Change the block or its arguments and it runs again. Results inserted with =append= or =prepend= carry no hash. Inline blocks are not cached. A cached block that has Lisp in its header arguments the interpreter cannot evaluate is refused.
447 500
448C, C++, D, Fortran and Clojure blocks don't run in Orgstar, but their hash is taken over the body as tangling expands it (see Tangling below), as Emacs does. A result Emacs wrote for such a block with =:cache yes= is recognised as current, and =C-c C-c= shows it. 501The hash of a C, C++, D, Java, Fortran or Clojure block is taken over the body as the language expands it (see Tangling below), with the =IMPORTS=, =INCLUDES= and =DEFINES= properties where the block is, and Java's default header arguments, as Emacs does. A result Emacs wrote for such a block with =:cache yes= is recognised as current, and =C-c C-c= shows it.
449 502
450* Noweb 503* Noweb
451 504
@@ -561,11 +614,11 @@ digraph { a -> b }
561 614
562Tangling writes source blocks to the files their =:tangle= argument names (=org-babel-tangle=). 615Tangling writes source blocks to the files their =:tangle= argument names (=org-babel-tangle=).
563 616
564| Command | Emacs and Doom | Mac | What it tangles | 617| Command | Emacs and Doom | Mac | What it tangles |
565|-------------------------+-----------------------------+--------+---------------------------------------------------| 618|-------------------------+-----------------------------+---------+---------------------------------------------------|
566| Tangle File | =C-c C-v t=, =C-c C-v C-t= | =⌃⌘V= | Every block in the file | 619| Tangle File | =C-c C-v t=, =C-c C-v C-t= | =⌃⌘V= | Every block in the file |
567| Tangle Block | none | none | The block at the caret (Emacs: =C-u C-c C-v t=) | 620| Tangle Block | none | =⌃⇧⌘V= | The block at the caret (Emacs: =C-u C-c C-v t=) |
568| Tangle Block's Target | none | none | Every block going to the same file as the one at the caret (Emacs: =C-u C-u C-c C-v t=) | 621| Tangle Block's Target | none | =⌃⌥⌘V= | Every block going to the same file as the one at the caret (Emacs: =C-u C-u C-c C-v t=) |
569 622
570All three are in the Org menu and the command palette. Tangling uses the text in the editor, saved or not, and the message area reports "Tangled /N/ code blocks from /file/". 623All three are in the Org menu and the command palette. Tangling uses the text in the editor, saved or not, and the message area reports "Tangled /N/ code blocks from /file/".
571 624
@@ -614,9 +667,9 @@ A table in =:var= loses its first row when its only rule is under that row, or w
614| Language | Written | 667| Language | Written |
615|----------------+--------------------------------------------------------------------------------------------------------------| 668|----------------+--------------------------------------------------------------------------------------------------------------|
616| =C=, =C++=, =cpp= | =#include= lines from =:includes=, =#define= lines from =:defines=, =using namespace= lines from =:namespaces=, the =:var= declarations with table sizes and column-name helpers, then the body between =:prologue= and =:epilogue=, wrapped in =int main()= unless it has a =main= or =:main no= is given. | 669| =C=, =C++=, =cpp= | =#include= lines from =:includes=, =#define= lines from =:defines=, =using namespace= lines from =:namespaces=, the =:var= declarations with table sizes and column-name helpers, then the body between =:prologue= and =:epilogue=, wrapped in =int main()= unless it has a =main= or =:main no= is given. |
617| =D= | =module mmm;=, =import= lines from =:imports= plus =std.stdio= and =std.conv=, the =:var= declarations, and the body wrapped in =int main()= as for C. | 670| =D= | =module mmm;=, =import= lines from =:imports= (or the =IMPORTS= property, except when tangling) plus =std.stdio= and =std.conv=, the =:var= declarations, and the body wrapped in =int main()= as for C. |
618| =java= | The body between =:prologue= and =:epilogue=, wrapped in a =main= method when it has no method and in a class when it has none. The class is named by =:classname= or the body's own class; a dotted =:classname= adds a =package= line. =:imports= adds =import= lines, and =:var= values become static fields. | 671| =java= | The body between =:prologue= and =:epilogue=, wrapped in a =main= method when it has no method and in a class when it has none. The class is named by =:classname= or the body's own class; a dotted =:classname= adds a =package= line. =:imports= adds =import= lines, and =:var= values become static fields. |
619| =fortran= | =#include= and =#define= lines from =:includes= and =:defines=, then the =:var= declarations and the body in =program main=, unless the body has its own =program= statement (then =:var= is refused) or =:main no= is given. | 672| =fortran= | =#include= and =#define= lines from =:includes= and =:defines= (or the =INCLUDES= and =DEFINES= properties, except when tangling), then the =:var= declarations and the body in =program main=, unless the body has its own =program= statement (then =:var= is refused) or =:main no= is given. |
620| =clojure= | =(ns …)= from =:ns=, the body in a =let= of the =:var= values, and a printer around it unless =:results output=. | 673| =clojure= | =(ns …)= from =:ns=, the body in a =let= of the =:var= values, and a printer around it unless =:results output=. |
621 674
622With =:hlines yes=, a table that keeps rules is refused for C, C++, D and Fortran; Java writes =null= for each rule. 675With =:hlines yes=, a table that keeps rules is refused for C, C++, D and Fortran; Java writes =null= for each rule.
@@ -657,7 +710,7 @@ Tangling stops, writes nothing and says why when:
657 710
658* On iOS 711* On iOS
659 712
660- Only Emacs Lisp blocks run, in Orgstar's own interpreter. Any other language fails with "/language/ blocks need the Mac to run.", and so does an Emacs Lisp block whose =:var= refers to a block in another language. 713- Only Emacs Lisp blocks run, in Orgstar's own interpreter. Any other language, compiled languages included, fails with "/language/ blocks need the Mac to run." (for example "C blocks need the Mac to run."), and so does an Emacs Lisp block whose =:var= refers to a block in another language.
661- There are no sessions and no graphics. 714- There are no sessions and no graphics.
662- The trust prompt works the same way, with its own =trusted.json= on the device. 715- The trust prompt works the same way, with its own =trusted.json= on the device.
663- There is no cancel command. 716- There is no cancel command.
docs/manual/guide/13-configuration.org +1 −1
@@ -559,4 +559,4 @@ The editor uses one font for everything: body text, headings, code and tables. C
559- Headings are bold. Level 1 is =font-size= plus three times =heading-size-step=, level 2 plus two times, level 3 plus one time; level 4 and deeper are body size. Set =heading-size-step = 0= for one size throughout. 559- Headings are bold. Level 1 is =font-size= plus three times =heading-size-step=, level 2 plus two times, level 3 plus one time; level 4 and deeper are body size. Set =heading-size-step = 0= for one size throughout.
560- =line-spacing= adds space between lines, in points. 560- =line-spacing= adds space between lines, in points.
561 561
562On iPhone and iPad, the editor and reader use the same theme, read from the synced configuration folder. =font= applies when the family is installed on the device, otherwise the system's monospaced font is used, and =font-size= is the size at the default Dynamic Type setting, scaled with the size chosen on the device. The =selection= color and the =syntax-*= colors aren't used there. See [[file:14-ios.org][iPhone and iPad]]. 562On iPhone and iPad, the editor and reader use the same theme, read from the synced configuration folder. =font= applies when the family is installed on the device, otherwise the system's monospaced font is used, and =font-size= is the size at the default Dynamic Type setting, scaled with the size chosen on the device. The =selection= color, the =cursor= color and the =syntax-*= colors apply there too. See [[file:14-ios.org][iPhone and iPad]].
docs/manual/guide/14-ios.org +10 −9
@@ -33,9 +33,9 @@ There is no way to open a single file from the Files app. Add the folder that co
33Tap a file in Folders, Search or the agenda to read it. 33Tap a file in Folders, Search or the agenda to read it.
34 34
35- Tap a heading to fold or unfold it, as =TAB= cycles it on the Mac. A chevron marks headings with content. 35- Tap a heading to fold or unfold it, as =TAB= cycles it on the Mac. A chevron marks headings with content.
36- The file opens with the visibility its =#+STARTUP= line and =VISIBILITY= properties ask for. Drawers and blocks are folded as =org-cycle-hide-drawer-startup= and =org-cycle-hide-block-startup= say, or as the file's =#+STARTUP= says (=hidedrawers=, =nohideblocks= and the like). 36- The file opens with the visibility its =#+STARTUP= line asks for, then each heading's =VISIBILITY= property when =#+STARTUP= sets a visibility. Drawers and blocks are folded as =org-cycle-hide-drawer-startup= and =org-cycle-hide-block-startup= say, or as the file's =#+STARTUP= says (=hidedrawers=, =nohideblocks= and the like).
37- Text is styled as in the editor, in the theme's colours, font, size, line spacing and heading sizes, on the theme's background: TODO keywords, priorities, tags, emphasis, code, timestamps and links. Text can be selected and copied. 37- Text is styled as in the editor, in the theme's colours, font, size, line spacing and heading sizes, on the theme's background: TODO keywords, priorities, tags, emphasis, code, timestamps, links, and the code in src blocks. Text can be selected and copied.
38- The reader doesn't apply =show-markup=, =org-pretty-entities=, =org-startup-indented=, inline images or truncated lines. Markup shows as typed, and bodies are indented by their heading's level. 38- The reader follows the editor's display settings (see Themes and display below): Show Markup, hidden emphasis markers, pretty entities, indentation, leading stars, inline images and truncated lines. Tables show at full width, without narrowed columns.
39- Tap a link to follow it. Links to headings and files in your folders open in the reader; web links open in the browser. 39- Tap a link to follow it. Links to headings and files in your folders open in the reader; web links open in the browser.
40- The toolbar has Outline (a list of headings to jump to), Export, and Edit. 40- The toolbar has Outline (a list of headings to jump to), Export, and Edit.
41 41
@@ -66,9 +66,9 @@ The editor and the reader use the theme set in the configuration folder's =confi
66- Font :: =font= when that family is installed on the device, otherwise the system's monospaced font. 66- Font :: =font= when that family is installed on the device, otherwise the system's monospaced font.
67- Size :: =font-size= is the size at the default Dynamic Type setting, 13 pt by default. Text grows and shrinks with the text size chosen in the system Settings app. 67- Size :: =font-size= is the size at the default Dynamic Type setting, 13 pt by default. Text grows and shrinks with the text size chosen in the system Settings app.
68- Line spacing and headings :: =line-spacing= and =heading-size-step= apply as on the Mac. 68- Line spacing and headings :: =line-spacing= and =heading-size-step= apply as on the Mac.
69- Caret and selection :: the caret and the selection highlight take the theme's =cursor= colour; =selection= isn't used. 69- Caret and selection :: the selection highlight takes the theme's =selection= colour, over block bands too; the caret and the selection handles take =cursor=.
70 70
71The editor applies these display settings; the reader applies only the drawer and block folding. The startup settings (=org-cycle-hide-*-startup=, =org-startup-*=, =org-hide-leading-stars=) apply when a file opens, and a =#+STARTUP= keyword in the file overrides them, as on the Mac. 71The editor and the reader apply these display settings; only the editor aligns tables when a file opens. The startup settings (=org-cycle-hide-*-startup=, =org-startup-*=, =org-hide-leading-stars=) apply when a file opens, and a =#+STARTUP= keyword in the file overrides them, as on the Mac.
72 72
73| Setting | In the iOS editor | =#+STARTUP= | 73| Setting | In the iOS editor | =#+STARTUP= |
74|----------------------------------+--------------------------------------------------------------------------------+----------------------------------| 74|----------------------------------+--------------------------------------------------------------------------------+----------------------------------|
@@ -83,13 +83,15 @@ The editor applies these display settings; the reader applies only the drawer an
83| =org-startup-align-all-tables= | Every table is aligned | =align=, =noalign= | 83| =org-startup-align-all-tables= | Every table is aligned | =align=, =noalign= |
84| =org-startup-truncated= | Long lines run off the right edge, and the editor scrolls sideways | | 84| =org-startup-truncated= | Long lines run off the right edge, and the editor scrolls sideways | |
85 85
86While markup is hidden, the line with the caret shows its markup, so you can edit it. More ▸ Show Markup, or Show or Hide Markup in Commands, switches markup in every editor. The switch lasts until =show-markup= in =config.toml= changes; then the file's value applies. 86While markup is hidden, the line with the caret shows its markup, so you can edit it. More ▸ Show Markup, or Show or Hide Markup in Commands, switches markup in every editor and in the reader. The switch lasts until =show-markup= in =config.toml= changes; then the file's value applies.
87 87
88The visibility from =#+STARTUP= applies first, then each heading's =VISIBILITY= property. As on the Mac, =VISIBILITY= properties apply only when =#+STARTUP= sets a visibility (=overview=, =content=, =showall= and the like). 88The visibility from =#+STARTUP= applies first, then each heading's =VISIBILITY= property. As on the Mac, =VISIBILITY= properties apply only when =#+STARTUP= sets a visibility (=overview=, =content=, =showall= and the like).
89 89
90An image line shows its image, and the link text is hidden except on the caret's line. =#+ATTR_ORG: :width N= sets the width in points; images are never wider than the editor. Show or Hide Inline Images in Commands, or =C-c C-x C-v= on a hardware keyboard, switches images in the open file. Truncate or Wrap Long Lines in Commands, or =C-x x t=, switches long lines. See [[file:02-the-editor.org][The editor]] for which lines show as images. 90An image line shows its image, and the link text is hidden except on the caret's line. =#+ATTR_ORG: :width N= sets the width in points; images are never wider than the editor. Show or Hide Inline Images in Commands, or =C-c C-x C-v= on a hardware keyboard, switches images in the open file. Truncate or Wrap Long Lines in Commands, or =C-x x t=, switches long lines. See [[file:02-the-editor.org][The editor]] for which lines show as images.
91 91
92The Mac editor's code highlighting in src blocks (the =syntax-*= colours) and =#+STARTUP: shrink= aren't on iOS. 92Code in src blocks is highlighted in the theme's =syntax-*= colours, as on the Mac (see [[file:11-code-blocks.org][Code blocks]]).
93
94Table columns with width cookies narrow as on the Mac: =#+STARTUP: shrink= narrows them when the file opens, and Shrink or Expand Table Column (=C-c TAB=), Shrink Table Columns with Widths and Expand Table Columns are in Commands when the caret is in a table. See [[file:10-tables.org][Tables]].
93 95
94** The key bar 96** The key bar
95 97
@@ -208,7 +210,7 @@ Clock in from the editor (More ▸ Clock In, or Clock In in Commands) or from an
208 210
209Recent Entries, in the bar and in the editor's More menu, lists the recently clocked entries; tap one to clock in to it. It also has Clock In to Recent Entry… and Go to Recent Clocked Entry…, and is disabled until you have clocked in once. Commands has Clock In to Recent Entry…, Clock In to Last Entry, Go to Recent Clocked Entry…, Mark as Default Clock Task and Resolve Open Clocks…. 211Recent Entries, in the bar and in the editor's More menu, lists the recently clocked entries; tap one to clock in to it. It also has Clock In to Recent Entry… and Go to Recent Clocked Entry…, and is disabled until you have clocked in once. Commands has Clock In to Recent Entry…, Clock In to Last Entry, Go to Recent Clocked Entry…, Mark as Default Clock Task and Resolve Open Clocks….
210 212
211Clock questions open in a sheet: the task selection and the resolution keys as lists to tap, and minutes or a date and time as a field. Cancel answers nothing, as =q= does. Clocking in with no clock running first asks about open clocks in your folders, except from the agenda or a capture template; Resolve Open Clocks… asks about every open clock. Both work as on the Mac. 213Clock questions open in a sheet: the task selection and the resolution keys as lists to tap, and minutes or a date and time as a field. Cancel answers nothing, as =q= does. Clocking in with no clock running first asks about open clocks in your folders, from the editor, an agenda entry's Clock In or a capture template with =clock-in=; Resolve Open Clocks… asks about every open clock. Both work as on the Mac.
212 214
213The iOS app has no idle detection, so =org-clock-idle-time= doesn't apply. =org-clock-history-length= does. 215The iOS app has no idle detection, so =org-clock-idle-time= doesn't apply. =org-clock-history-length= does.
214 216
@@ -300,7 +302,6 @@ Quick Look in the Files app shows org files as the HTML export renders them.
300- Running code blocks in languages other than Emacs Lisp, Emacs Lisp beyond Orgstar's interpreter, and tables that need Emacs. 302- Running code blocks in languages other than Emacs Lisp, Emacs Lisp beyond Orgstar's interpreter, and tables that need Emacs.
301- PDF, ODT, LaTeX and plain-text export. 303- PDF, ODT, LaTeX and plain-text export.
302- The Mac and Doom keymaps, Vim keys, and =keymap.toml=. 304- The Mac and Doom keymaps, Vim keys, and =keymap.toml=.
303- The =selection= colour, code highlighting in src blocks, and =#+STARTUP: shrink=.
304- Idle detection while a clock runs. 305- Idle detection while a clock runs.
305- Import from Emacs. 306- Import from Emacs.
306- The board, column view, the backlinks pane, and the buffer list and tab bar. 307- The board, column view, the backlinks pane, and the buffer list and tab bar.
docs/manual/guide/15-alongside-emacs.org +5 −4
@@ -203,10 +203,11 @@ Orgstar refuses some things with a message rather than doing something different
203 203
204Code blocks (see [[file:11-code-blocks.org][Code blocks]]): 204Code blocks (see [[file:11-code-blocks.org][Code blocks]]):
205 205
206- =:cmdline= is supported only for shells, =dot=, =plantuml= and =mermaid=. 206- =:cmdline= is supported only for shells, =dot=, =plantuml=, =mermaid= and C, C++, D, Java, Fortran and Clojure.
207- =:prologue=, =:epilogue= and =:post= aren't supported; =:stdin= and =:shebang= only for shells. 207- =:post= isn't supported; =:prologue= and =:epilogue= only for C, C++, D, Java, Fortran and Clojure; =:stdin= and =:shebang= only for shells.
208- =:session= is supported only for shells and Python. 208- =:session= is supported only for shells and Python. C, C++, D, Java, Fortran and Clojure ignore it, as in Org.
209- =:var= isn't supported for some languages; references with arguments, as =block(x=1)=, and using another source block's result in =:var= aren't supported. 209- Clojure runs with babashka or the Clojure CLI only; other =:backend= values are refused.
210- =:var= isn't supported for Ruby, JavaScript, R and awk blocks.
210- Header arguments, =:var= values and =:cache= that need Lisp evaluated by Emacs are refused when Orgstar's interpreter can't evaluate them: "… is Lisp that only Emacs can evaluate; nothing was run." 211- Header arguments, =:var= values and =:cache= that need Lisp evaluated by Emacs are refused when Orgstar's interpreter can't evaluate them: "… is Lisp that only Emacs can evaluate; nothing was run."
211- Noweb references that run a block aren't supported. 212- Noweb references that run a block aren't supported.
212- Tangling refuses =:var= that would run a block, and tables and lists in =:var= for some languages. 213- Tangling refuses =:var= that would run a block, and tables and lists in =:var= for some languages.
docs/manual/install.org +11 −1
@@ -31,7 +31,17 @@ them formatted, and Spotlight indexes their headings and text.
31 31
32* The iOS app 32* The iOS app
33 33
34The iOS app (iOS 26 or later) currently builds for the Simulator: 34The iOS app (iOS 26 or later) is built with Xcode from =ios/Orgstar.xcodeproj=:
35
361. Open =ios/Orgstar.xcodeproj=.
372. Select the *Orgstar iOS* target, then Signing & Capabilities, and choose your team.
38 Change the bundle identifiers (=sh.krz.orgstar= and the two extensions' =.share= and
39 =.quicklook=) and the App Group (=group.sh.krz.orgstar=) to ones your team can register.
403. Choose your iPhone or iPad (or a Simulator) as the destination and Run (=⌘R=).
41
42On a device, Developer Mode must be on (Settings ▸ Privacy & Security ▸ Developer Mode).
43
44For the Simulator without opening Xcode:
35 45
36#+BEGIN_SRC sh 46#+BEGIN_SRC sh
37scripts/build-ios-app.sh 47scripts/build-ios-app.sh
ios/Orgstar.xcodeproj/project.pbxproj added +642
@@ -0,0 +1,642 @@
1// !$*UTF8*$!
2{
3 archiveVersion = 1;
4 classes = {
5 };
6 objectVersion = 77;
7 objects = {
8
9/* Begin PBXBuildFile section */
10 1B78003BBCE8A4B809333342 = {
11 isa = PBXBuildFile;
12 productRef = A2BE626BBE45EA52880B6169;
13 };
14 1E5861C0EFE1D96CDC21A22F = {
15 isa = PBXBuildFile;
16 productRef = BA239181876756F7732397EB;
17 };
18 80E85E72A5B727A15D7123D4 = {
19 isa = PBXBuildFile;
20 fileRef = 54F0339BC26341A6010C1386;
21 settings = {
22 ATTRIBUTES = (
23 RemoveHeadersOnCopy,
24 );
25 };
26 };
27 9BE045FD696469CA8D19F22C = {
28 isa = PBXBuildFile;
29 productRef = 47D54A361A74FE9E2B0722BB;
30 };
31 A05D351FCD8FE36B6A58E035 = {
32 isa = PBXBuildFile;
33 fileRef = D128CD70D4E88FAA82D23FD9;
34 settings = {
35 ATTRIBUTES = (
36 RemoveHeadersOnCopy,
37 );
38 };
39 };
40 AB68F3B4EE90C0961355E986 = {
41 isa = PBXBuildFile;
42 productRef = 64DF80C4FBF50B0AF5DC6E33;
43 };
44/* End PBXBuildFile section */
45
46/* Begin PBXContainerItemProxy section */
47 5932E50A667F73AEF6E5FB26 = {
48 isa = PBXContainerItemProxy;
49 containerPortal = 46F86FAA6BBF9AC94A7E4595;
50 proxyType = 1;
51 remoteGlobalIDString = 92364A1473ECC9B162FEAE51;
52 remoteInfo = OrgstarShare;
53 };
54 D0655711FB3B470A356B2D36 = {
55 isa = PBXContainerItemProxy;
56 containerPortal = 46F86FAA6BBF9AC94A7E4595;
57 proxyType = 1;
58 remoteGlobalIDString = BBA37636EB6BBA564493899D;
59 remoteInfo = OrgstarQuickLook;
60 };
61/* End PBXContainerItemProxy section */
62
63/* Begin PBXCopyFilesBuildPhase section */
64 269605D45C104F12CBCDC8FB = {
65 isa = PBXCopyFilesBuildPhase;
66 buildActionMask = 2147483647;
67 dstPath = "";
68 dstSubfolderSpec = 13;
69 files = (
70 A05D351FCD8FE36B6A58E035,
71 80E85E72A5B727A15D7123D4,
72 );
73 name = "Embed Foundation Extensions";
74 runOnlyForDeploymentPostprocessing = 0;
75 };
76/* End PBXCopyFilesBuildPhase section */
77
78/* Begin PBXFileReference section */
79 008B67FA6385670637488313 = {
80 isa = PBXFileReference;
81 lastKnownFileType = text.plist.entitlements;
82 path = Orgstar/Orgstar.entitlements;
83 sourceTree = "<group>";
84 };
85 1025FACEDEC31014F0AFA230 = {
86 isa = PBXFileReference;
87 lastKnownFileType = text.plist.entitlements;
88 path = OrgstarShare/OrgstarShare.entitlements;
89 sourceTree = "<group>";
90 };
91 48A21BB1AB1E70D4429DCDE4 = {
92 isa = PBXFileReference;
93 lastKnownFileType = text.plist.xml;
94 path = OrgstarQuickLook/Info.plist;
95 sourceTree = "<group>";
96 };
97 54F0339BC26341A6010C1386 = {
98 isa = PBXFileReference;
99 explicitFileType = wrapper.app-extension;
100 includeInIndex = 0;
101 path = OrgstarQuickLook.appex;
102 sourceTree = BUILT_PRODUCTS_DIR;
103 };
104 D128CD70D4E88FAA82D23FD9 = {
105 isa = PBXFileReference;
106 explicitFileType = wrapper.app-extension;
107 includeInIndex = 0;
108 path = OrgstarShare.appex;
109 sourceTree = BUILT_PRODUCTS_DIR;
110 };
111 D72184D78ACF70837216BCBF = {
112 isa = PBXFileReference;
113 lastKnownFileType = text.plist.xml;
114 path = OrgstarShare/Info.plist;
115 sourceTree = "<group>";
116 };
117 ECD4A6B56983444E4E07CE63 = {
118 isa = PBXFileReference;
119 explicitFileType = wrapper.application;
120 includeInIndex = 0;
121 path = Orgstar.app;
122 sourceTree = BUILT_PRODUCTS_DIR;
123 };
124 F05C9F05F8A61806F30E9328 = {
125 isa = PBXFileReference;
126 lastKnownFileType = text.plist.xml;
127 path = Orgstar/Info.plist;
128 sourceTree = "<group>";
129 };
130/* End PBXFileReference section */
131
132/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */
133 25D1FFC8C8FE4375AA373DF9 = {
134 isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
135 membershipExceptions = (
136 main.swift,
137 );
138 target = BBA37636EB6BBA564493899D;
139 };
140 921E3E2198CDD080F66DD902 = {
141 isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
142 membershipExceptions = (
143 main.swift,
144 );
145 target = 92364A1473ECC9B162FEAE51;
146 };
147/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */
148
149/* Begin PBXFileSystemSynchronizedRootGroup section */
150 2412EC8ED6427B76498FCD18 = {
151 isa = PBXFileSystemSynchronizedRootGroup;
152 path = ../Sources/OrgstarQuickLook;
153 sourceTree = "<group>";
154 exceptions = (
155 25D1FFC8C8FE4375AA373DF9,
156 );
157 };
158 6425CB8F177EDFF8EE2BD447 = {
159 isa = PBXFileSystemSynchronizedRootGroup;
160 path = ../Sources/OrgstarShare;
161 sourceTree = "<group>";
162 exceptions = (
163 921E3E2198CDD080F66DD902,
164 );
165 };
166 7E85FA5E5BA11D0F6891693E = {
167 isa = PBXFileSystemSynchronizedRootGroup;
168 path = ../Sources/OrgstarMobile;
169 sourceTree = "<group>";
170 };
171/* End PBXFileSystemSynchronizedRootGroup section */
172
173/* Begin PBXFrameworksBuildPhase section */
174 1439C48F60EF427CC7ADB87B = {
175 isa = PBXFrameworksBuildPhase;
176 buildActionMask = 2147483647;
177 files = (
178 1E5861C0EFE1D96CDC21A22F,
179 );
180 runOnlyForDeploymentPostprocessing = 0;
181 };
182 2058F3B51F8D10551554307D = {
183 isa = PBXFrameworksBuildPhase;
184 buildActionMask = 2147483647;
185 files = (
186 AB68F3B4EE90C0961355E986,
187 );
188 runOnlyForDeploymentPostprocessing = 0;
189 };
190 843FAAECD041CD2466904790 = {
191 isa = PBXFrameworksBuildPhase;
192 buildActionMask = 2147483647;
193 files = (
194 1B78003BBCE8A4B809333342,
195 9BE045FD696469CA8D19F22C,
196 );
197 runOnlyForDeploymentPostprocessing = 0;
198 };
199/* End PBXFrameworksBuildPhase section */
200
201/* Begin PBXGroup section */
202 0A2C978E52A76F0AA9F68BB5 = {
203 isa = PBXGroup;
204 children = (
205 ECD4A6B56983444E4E07CE63,
206 D128CD70D4E88FAA82D23FD9,
207 54F0339BC26341A6010C1386,
208 );
209 name = Products;
210 sourceTree = "<group>";
211 };
212 2B731CEFC6751AAE0EC69B98 = {
213 isa = PBXGroup;
214 children = (
215 6425CB8F177EDFF8EE2BD447,
216 2412EC8ED6427B76498FCD18,
217 7E85FA5E5BA11D0F6891693E,
218 40FCC6CF7BFC065FCDD48D4E,
219 0A2C978E52A76F0AA9F68BB5,
220 );
221 sourceTree = "<group>";
222 };
223 40FCC6CF7BFC065FCDD48D4E = {
224 isa = PBXGroup;
225 children = (
226 F05C9F05F8A61806F30E9328,
227 008B67FA6385670637488313,
228 D72184D78ACF70837216BCBF,
229 1025FACEDEC31014F0AFA230,
230 48A21BB1AB1E70D4429DCDE4,
231 );
232 name = Support;
233 sourceTree = "<group>";
234 };
235/* End PBXGroup section */
236
237/* Begin PBXNativeTarget section */
238 4E815AD2268DF19F304A2880 = {
239 isa = PBXNativeTarget;
240 buildConfigurationList = 3F4C2119C1AEC3C58EDF26F9;
241 buildPhases = (
242 FD11E99E3EE9450636C880B9,
243 843FAAECD041CD2466904790,
244 287027B677CE75B2D4715EE6,
245 269605D45C104F12CBCDC8FB,
246 );
247 buildRules = (
248 );
249 dependencies = (
250 7F4807D68646366ED2DCA5C2,
251 B35F6E044645C7D88B689DC1,
252 );
253 fileSystemSynchronizedGroups = (
254 7E85FA5E5BA11D0F6891693E,
255 );
256 name = "Orgstar iOS";
257 packageProductDependencies = (
258 A2BE626BBE45EA52880B6169,
259 47D54A361A74FE9E2B0722BB,
260 );
261 productName = Orgstar;
262 productReference = ECD4A6B56983444E4E07CE63;
263 productType = com.apple.product-type.application;
264 };
265 92364A1473ECC9B162FEAE51 = {
266 isa = PBXNativeTarget;
267 buildConfigurationList = 9E5D2D8CAA074680FE17F119;
268 buildPhases = (
269 E5AC38BB173B87555EBEC0AC,
270 1439C48F60EF427CC7ADB87B,
271 1A9DC7DD7E76A6C5A1DC674C,
272 );
273 buildRules = (
274 );
275 dependencies = (
276 );
277 fileSystemSynchronizedGroups = (
278 6425CB8F177EDFF8EE2BD447,
279 );
280 name = OrgstarShare;
281 packageProductDependencies = (
282 BA239181876756F7732397EB,
283 );
284 productName = OrgstarShare;
285 productReference = D128CD70D4E88FAA82D23FD9;
286 productType = com.apple.product-type.app-extension;
287 };
288 BBA37636EB6BBA564493899D = {
289 isa = PBXNativeTarget;
290 buildConfigurationList = FA45BEE00EE2451462D002FF;
291 buildPhases = (
292 347F295A9254F751A96C2737,
293 2058F3B51F8D10551554307D,
294 D4E4B37C7E22E9760E5FA492,
295 );
296 buildRules = (
297 );
298 dependencies = (
299 );
300 fileSystemSynchronizedGroups = (
301 2412EC8ED6427B76498FCD18,
302 );
303 name = OrgstarQuickLook;
304 packageProductDependencies = (
305 64DF80C4FBF50B0AF5DC6E33,
306 );
307 productName = OrgstarQuickLook;
308 productReference = 54F0339BC26341A6010C1386;
309 productType = com.apple.product-type.app-extension;
310 };
311/* End PBXNativeTarget section */
312
313/* Begin PBXProject section */
314 46F86FAA6BBF9AC94A7E4595 = {
315 isa = PBXProject;
316 attributes = {
317 BuildIndependentTargetsInParallel = 1;
318 LastSwiftUpdateCheck = 2700;
319 LastUpgradeCheck = 2700;
320 };
321 buildConfigurationList = 30435AE6E633F256CC883684;
322 developmentRegion = en;
323 hasScannedForEncodings = 0;
324 knownRegions = (
325 en,
326 Base,
327 );
328 mainGroup = 2B731CEFC6751AAE0EC69B98;
329 minimizedProjectReferenceProxies = 1;
330 packageReferences = (
331 A46A1BCE0B67C45BEC8F435B,
332 );
333 preferredProjectObjectVersion = 77;
334 productRefGroup = 0A2C978E52A76F0AA9F68BB5;
335 projectDirPath = "";
336 projectRoot = "";
337 targets = (
338 4E815AD2268DF19F304A2880,
339 92364A1473ECC9B162FEAE51,
340 BBA37636EB6BBA564493899D,
341 );
342 };
343/* End PBXProject section */
344
345/* Begin PBXResourcesBuildPhase section */
346 1A9DC7DD7E76A6C5A1DC674C = {
347 isa = PBXResourcesBuildPhase;
348 buildActionMask = 2147483647;
349 files = (
350 );
351 runOnlyForDeploymentPostprocessing = 0;
352 };
353 287027B677CE75B2D4715EE6 = {
354 isa = PBXResourcesBuildPhase;
355 buildActionMask = 2147483647;
356 files = (
357 );
358 runOnlyForDeploymentPostprocessing = 0;
359 };
360 D4E4B37C7E22E9760E5FA492 = {
361 isa = PBXResourcesBuildPhase;
362 buildActionMask = 2147483647;
363 files = (
364 );
365 runOnlyForDeploymentPostprocessing = 0;
366 };
367/* End PBXResourcesBuildPhase section */
368
369/* Begin PBXSourcesBuildPhase section */
370 347F295A9254F751A96C2737 = {
371 isa = PBXSourcesBuildPhase;
372 buildActionMask = 2147483647;
373 files = (
374 );
375 runOnlyForDeploymentPostprocessing = 0;
376 };
377 E5AC38BB173B87555EBEC0AC = {
378 isa = PBXSourcesBuildPhase;
379 buildActionMask = 2147483647;
380 files = (
381 );
382 runOnlyForDeploymentPostprocessing = 0;
383 };
384 FD11E99E3EE9450636C880B9 = {
385 isa = PBXSourcesBuildPhase;
386 buildActionMask = 2147483647;
387 files = (
388 );
389 runOnlyForDeploymentPostprocessing = 0;
390 };
391/* End PBXSourcesBuildPhase section */
392
393/* Begin PBXTargetDependency section */
394 7F4807D68646366ED2DCA5C2 = {
395 isa = PBXTargetDependency;
396 target = 92364A1473ECC9B162FEAE51;
397 targetProxy = 5932E50A667F73AEF6E5FB26;
398 };
399 B35F6E044645C7D88B689DC1 = {
400 isa = PBXTargetDependency;
401 target = BBA37636EB6BBA564493899D;
402 targetProxy = D0655711FB3B470A356B2D36;
403 };
404/* End PBXTargetDependency section */
405
406/* Begin XCBuildConfiguration section */
407 0BF40655E429259B35B06BEC = {
408 isa = XCBuildConfiguration;
409 buildSettings = {
410 CODE_SIGN_STYLE = Automatic;
411 DEVELOPMENT_TEAM = ZCNAX3VL9D;
412 INFOPLIST_FILE = OrgstarQuickLook/Info.plist;
413 GENERATE_INFOPLIST_FILE = NO;
414 PRODUCT_BUNDLE_IDENTIFIER = sh.krz.orgstar.quicklook;
415 PRODUCT_NAME = "$(TARGET_NAME)";
416 MARKETING_VERSION = 0.1.0;
417 CURRENT_PROJECT_VERSION = 1;
418 TARGETED_DEVICE_FAMILY = "1,2";
419 LD_RUNPATH_SEARCH_PATHS = (
420 "$(inherited)",
421 "@executable_path/Frameworks",
422 "@executable_path/../../Frameworks",
423 );
424 SKIP_INSTALL = YES;
425 };
426 name = Release;
427 };
428 0D865C988DB7EAA7BA355661 = {
429 isa = XCBuildConfiguration;
430 buildSettings = {
431 CODE_SIGN_STYLE = Automatic;
432 DEVELOPMENT_TEAM = ZCNAX3VL9D;
433 INFOPLIST_FILE = OrgstarShare/Info.plist;
434 GENERATE_INFOPLIST_FILE = NO;
435 PRODUCT_BUNDLE_IDENTIFIER = sh.krz.orgstar.share;
436 PRODUCT_NAME = "$(TARGET_NAME)";
437 MARKETING_VERSION = 0.1.0;
438 CURRENT_PROJECT_VERSION = 1;
439 TARGETED_DEVICE_FAMILY = "1,2";
440 LD_RUNPATH_SEARCH_PATHS = (
441 "$(inherited)",
442 "@executable_path/Frameworks",
443 "@executable_path/../../Frameworks",
444 );
445 SKIP_INSTALL = YES;
446 CODE_SIGN_ENTITLEMENTS = OrgstarShare/OrgstarShare.entitlements;
447 };
448 name = Debug;
449 };
450 1339A23112C9EBCAEF5EF7FE = {
451 isa = XCBuildConfiguration;
452 buildSettings = {
453 CODE_SIGN_STYLE = Automatic;
454 DEVELOPMENT_TEAM = ZCNAX3VL9D;
455 INFOPLIST_FILE = OrgstarShare/Info.plist;
456 GENERATE_INFOPLIST_FILE = NO;
457 PRODUCT_BUNDLE_IDENTIFIER = sh.krz.orgstar.share;
458 PRODUCT_NAME = "$(TARGET_NAME)";
459 MARKETING_VERSION = 0.1.0;
460 CURRENT_PROJECT_VERSION = 1;
461 TARGETED_DEVICE_FAMILY = "1,2";
462 LD_RUNPATH_SEARCH_PATHS = (
463 "$(inherited)",
464 "@executable_path/Frameworks",
465 "@executable_path/../../Frameworks",
466 );
467 SKIP_INSTALL = YES;
468 CODE_SIGN_ENTITLEMENTS = OrgstarShare/OrgstarShare.entitlements;
469 };
470 name = Release;
471 };
472 2FA7055951A13CF159CF0B9C = {
473 isa = XCBuildConfiguration;
474 buildSettings = {
475 CODE_SIGN_STYLE = Automatic;
476 DEVELOPMENT_TEAM = ZCNAX3VL9D;
477 INFOPLIST_FILE = Orgstar/Info.plist;
478 GENERATE_INFOPLIST_FILE = NO;
479 PRODUCT_BUNDLE_IDENTIFIER = sh.krz.orgstar;
480 PRODUCT_NAME = Orgstar;
481 MARKETING_VERSION = 0.1.0;
482 CURRENT_PROJECT_VERSION = 1;
483 TARGETED_DEVICE_FAMILY = "1,2";
484 LD_RUNPATH_SEARCH_PATHS = (
485 "$(inherited)",
486 "@executable_path/Frameworks",
487 );
488 PRODUCT_MODULE_NAME = OrgstarMobile;
489 CODE_SIGN_ENTITLEMENTS = Orgstar/Orgstar.entitlements;
490 };
491 name = Release;
492 };
493 942C95A5D90B164020736D83 = {
494 isa = XCBuildConfiguration;
495 buildSettings = {
496 CODE_SIGN_STYLE = Automatic;
497 DEVELOPMENT_TEAM = ZCNAX3VL9D;
498 INFOPLIST_FILE = OrgstarQuickLook/Info.plist;
499 GENERATE_INFOPLIST_FILE = NO;
500 PRODUCT_BUNDLE_IDENTIFIER = sh.krz.orgstar.quicklook;
501 PRODUCT_NAME = "$(TARGET_NAME)";
502 MARKETING_VERSION = 0.1.0;
503 CURRENT_PROJECT_VERSION = 1;
504 TARGETED_DEVICE_FAMILY = "1,2";
505 LD_RUNPATH_SEARCH_PATHS = (
506 "$(inherited)",
507 "@executable_path/Frameworks",
508 "@executable_path/../../Frameworks",
509 );
510 SKIP_INSTALL = YES;
511 };
512 name = Debug;
513 };
514 B7DFA010494D99B3247DD1DF = {
515 isa = XCBuildConfiguration;
516 buildSettings = {
517 ALWAYS_SEARCH_USER_PATHS = NO;
518 CLANG_ENABLE_MODULES = YES;
519 SWIFT_VERSION = 6.0;
520 IPHONEOS_DEPLOYMENT_TARGET = 26.0;
521 SDKROOT = iphoneos;
522 SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
523 ENABLE_USER_SCRIPT_SANDBOXING = YES;
524 DEBUG_INFORMATION_FORMAT = dwarf-with-dsym;
525 SWIFT_COMPILATION_MODE = wholemodule;
526 VALIDATE_PRODUCT = YES;
527 };
528 name = Release;
529 };
530 CD700063997E34E9BA5D262B = {
531 isa = XCBuildConfiguration;
532 buildSettings = {
533 CODE_SIGN_STYLE = Automatic;
534 DEVELOPMENT_TEAM = ZCNAX3VL9D;
535 INFOPLIST_FILE = Orgstar/Info.plist;
536 GENERATE_INFOPLIST_FILE = NO;
537 PRODUCT_BUNDLE_IDENTIFIER = sh.krz.orgstar;
538 PRODUCT_NAME = Orgstar;
539 MARKETING_VERSION = 0.1.0;
540 CURRENT_PROJECT_VERSION = 1;
541 TARGETED_DEVICE_FAMILY = "1,2";
542 LD_RUNPATH_SEARCH_PATHS = (
543 "$(inherited)",
544 "@executable_path/Frameworks",
545 );
546 PRODUCT_MODULE_NAME = OrgstarMobile;
547 CODE_SIGN_ENTITLEMENTS = Orgstar/Orgstar.entitlements;
548 };
549 name = Debug;
550 };
551 F25EF7827B5210B4D9103995 = {
552 isa = XCBuildConfiguration;
553 buildSettings = {
554 ALWAYS_SEARCH_USER_PATHS = NO;
555 CLANG_ENABLE_MODULES = YES;
556 SWIFT_VERSION = 6.0;
557 IPHONEOS_DEPLOYMENT_TARGET = 26.0;
558 SDKROOT = iphoneos;
559 SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
560 ENABLE_USER_SCRIPT_SANDBOXING = YES;
561 DEBUG_INFORMATION_FORMAT = dwarf;
562 ONLY_ACTIVE_ARCH = YES;
563 SWIFT_OPTIMIZATION_LEVEL = -Onone;
564 SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
565 ENABLE_TESTABILITY = YES;
566 GCC_OPTIMIZATION_LEVEL = 0;
567 };
568 name = Debug;
569 };
570/* End XCBuildConfiguration section */
571
572/* Begin XCConfigurationList section */
573 30435AE6E633F256CC883684 = {
574 isa = XCConfigurationList;
575 buildConfigurations = (
576 F25EF7827B5210B4D9103995,
577 B7DFA010494D99B3247DD1DF,
578 );
579 defaultConfigurationIsVisible = 0;
580 defaultConfigurationName = Release;
581 };
582 3F4C2119C1AEC3C58EDF26F9 = {
583 isa = XCConfigurationList;
584 buildConfigurations = (
585 CD700063997E34E9BA5D262B,
586 2FA7055951A13CF159CF0B9C,
587 );
588 defaultConfigurationIsVisible = 0;
589 defaultConfigurationName = Release;
590 };
591 9E5D2D8CAA074680FE17F119 = {
592 isa = XCConfigurationList;
593 buildConfigurations = (
594 0D865C988DB7EAA7BA355661,
595 1339A23112C9EBCAEF5EF7FE,
596 );
597 defaultConfigurationIsVisible = 0;
598 defaultConfigurationName = Release;
599 };
600 FA45BEE00EE2451462D002FF = {
601 isa = XCConfigurationList;
602 buildConfigurations = (
603 942C95A5D90B164020736D83,
604 0BF40655E429259B35B06BEC,
605 );
606 defaultConfigurationIsVisible = 0;
607 defaultConfigurationName = Release;
608 };
609/* End XCConfigurationList section */
610
611/* Begin XCLocalSwiftPackageReference section */
612 A46A1BCE0B67C45BEC8F435B = {
613 isa = XCLocalSwiftPackageReference;
614 relativePath = ..;
615 };
616/* End XCLocalSwiftPackageReference section */
617
618/* Begin XCSwiftPackageProductDependency section */
619 47D54A361A74FE9E2B0722BB = {
620 isa = XCSwiftPackageProductDependency;
621 package = A46A1BCE0B67C45BEC8F435B;
622 productName = OrgHighlight;
623 };
624 64DF80C4FBF50B0AF5DC6E33 = {
625 isa = XCSwiftPackageProductDependency;
626 package = A46A1BCE0B67C45BEC8F435B;
627 productName = OrgCore;
628 };
629 A2BE626BBE45EA52880B6169 = {
630 isa = XCSwiftPackageProductDependency;
631 package = A46A1BCE0B67C45BEC8F435B;
632 productName = OrgApp;
633 };
634 BA239181876756F7732397EB = {
635 isa = XCSwiftPackageProductDependency;
636 package = A46A1BCE0B67C45BEC8F435B;
637 productName = OrgApp;
638 };
639/* End XCSwiftPackageProductDependency section */
640 };
641 rootObject = 46F86FAA6BBF9AC94A7E4595;
642}
ios/Orgstar.xcodeproj/project.xcworkspace/contents.xcworkspacedata added +7
@@ -0,0 +1,7 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<Workspace
3 version = "1.0">
4 <FileRef
5 location = "self:">
6 </FileRef>
7</Workspace>
ios/Orgstar.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings added +8
@@ -0,0 +1,8 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3<plist version="1.0">
4<dict>
5 <key>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key>
6 <false/>
7</dict>
8</plist>
ios/Orgstar.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved added +177
@@ -0,0 +1,177 @@
1{
2 "originHash" : "7d490d34f6af67a62b54f98eb646b0c3d836db8f93b6fe4eda66d23de815ac9a",
3 "pins" : [
4 {
5 "identity" : "grdb.swift",
6 "kind" : "remoteSourceControl",
7 "location" : "https://github.com/groue/GRDB.swift",
8 "state" : {
9 "revision" : "b83108d10f42680d78f23fe4d4d80fc88dab3212",
10 "version" : "7.11.1"
11 }
12 },
13 {
14 "identity" : "swift-tree-sitter",
15 "kind" : "remoteSourceControl",
16 "location" : "https://github.com/tree-sitter/swift-tree-sitter",
17 "state" : {
18 "revision" : "08ef81eb8620617b55b08868126707ad72bf754f",
19 "version" : "0.25.0"
20 }
21 },
22 {
23 "identity" : "tree-sitter",
24 "kind" : "remoteSourceControl",
25 "location" : "https://github.com/tree-sitter/tree-sitter",
26 "state" : {
27 "revision" : "da6fe9beb4f7f67beb75914ca8e0d48ae48d6406",
28 "version" : "0.25.10"
29 }
30 },
31 {
32 "identity" : "tree-sitter-bash",
33 "kind" : "remoteSourceControl",
34 "location" : "https://github.com/tree-sitter/tree-sitter-bash",
35 "state" : {
36 "revision" : "a06c2e4415e9bc0346c6b86d401879ffb44058f7",
37 "version" : "0.25.1"
38 }
39 },
40 {
41 "identity" : "tree-sitter-c",
42 "kind" : "remoteSourceControl",
43 "location" : "https://github.com/tree-sitter/tree-sitter-c",
44 "state" : {
45 "revision" : "b780e47fc780ddc8da13afa35a3f4ed5c157823d",
46 "version" : "0.24.2"
47 }
48 },
49 {
50 "identity" : "tree-sitter-cpp",
51 "kind" : "remoteSourceControl",
52 "location" : "https://github.com/tree-sitter/tree-sitter-cpp",
53 "state" : {
54 "revision" : "f41e1a044c8a84ea9fa8577fdd2eab92ec96de02",
55 "version" : "0.23.4"
56 }
57 },
58 {
59 "identity" : "tree-sitter-go",
60 "kind" : "remoteSourceControl",
61 "location" : "https://github.com/tree-sitter/tree-sitter-go",
62 "state" : {
63 "revision" : "1547678a9da59885853f5f5cc8a99cc203fa2e2c",
64 "version" : "0.25.0"
65 }
66 },
67 {
68 "identity" : "tree-sitter-haskell",
69 "kind" : "remoteSourceControl",
70 "location" : "https://github.com/tree-sitter/tree-sitter-haskell",
71 "state" : {
72 "revision" : "97288e585b0bd44199720280d067fa35bacd81ff",
73 "version" : "0.24.1"
74 }
75 },
76 {
77 "identity" : "tree-sitter-java",
78 "kind" : "remoteSourceControl",
79 "location" : "https://github.com/tree-sitter/tree-sitter-java",
80 "state" : {
81 "revision" : "94703d5a6bed02b98e438d7cad1136c01a60ba2c",
82 "version" : "0.23.5"
83 }
84 },
85 {
86 "identity" : "tree-sitter-javascript",
87 "kind" : "remoteSourceControl",
88 "location" : "https://github.com/tree-sitter/tree-sitter-javascript",
89 "state" : {
90 "revision" : "44c892e0be055ac465d5eeddae6d3e194424e7de",
91 "version" : "0.25.0"
92 }
93 },
94 {
95 "identity" : "tree-sitter-json",
96 "kind" : "remoteSourceControl",
97 "location" : "https://github.com/tree-sitter/tree-sitter-json",
98 "state" : {
99 "revision" : "ee35a6ebefcef0c5c416c0d1ccec7370cfca5a24",
100 "version" : "0.24.8"
101 }
102 },
103 {
104 "identity" : "tree-sitter-lua",
105 "kind" : "remoteSourceControl",
106 "location" : "https://github.com/tree-sitter-grammars/tree-sitter-lua",
107 "state" : {
108 "revision" : "10fe0054734eec83049514ea2e718b2a56acd0c9",
109 "version" : "0.5.0"
110 }
111 },
112 {
113 "identity" : "tree-sitter-python",
114 "kind" : "remoteSourceControl",
115 "location" : "https://github.com/tree-sitter/tree-sitter-python",
116 "state" : {
117 "revision" : "293fdc02038ee2bf0e2e206711b69c90ac0d413f",
118 "version" : "0.25.0"
119 }
120 },
121 {
122 "identity" : "tree-sitter-r",
123 "kind" : "remoteSourceControl",
124 "location" : "https://github.com/r-lib/tree-sitter-r",
125 "state" : {
126 "revision" : "346d3707b8c9301f1051e8f6e32666e67529f7d2",
127 "version" : "1.3.0"
128 }
129 },
130 {
131 "identity" : "tree-sitter-ruby",
132 "kind" : "remoteSourceControl",
133 "location" : "https://github.com/tree-sitter/tree-sitter-ruby",
134 "state" : {
135 "revision" : "71bd32fb7607035768799732addba884a37a6210",
136 "version" : "0.23.1"
137 }
138 },
139 {
140 "identity" : "tree-sitter-rust",
141 "kind" : "remoteSourceControl",
142 "location" : "https://github.com/tree-sitter/tree-sitter-rust",
143 "state" : {
144 "revision" : "77a3747266f4d621d0757825e6b11edcbf991ca5",
145 "version" : "0.24.2"
146 }
147 },
148 {
149 "identity" : "tree-sitter-scheme",
150 "kind" : "remoteSourceControl",
151 "location" : "https://github.com/6cdh/tree-sitter-scheme",
152 "state" : {
153 "revision" : "933883742f909cf79bd8aa6fde05ef51d79c9263",
154 "version" : "0.24.7-1"
155 }
156 },
157 {
158 "identity" : "tree-sitter-toml",
159 "kind" : "remoteSourceControl",
160 "location" : "https://github.com/tree-sitter-grammars/tree-sitter-toml",
161 "state" : {
162 "revision" : "64b56832c2cffe41758f28e05c756a3a98d16f41",
163 "version" : "0.7.0"
164 }
165 },
166 {
167 "identity" : "tree-sitter-yaml",
168 "kind" : "remoteSourceControl",
169 "location" : "https://github.com/tree-sitter-grammars/tree-sitter-yaml",
170 "state" : {
171 "revision" : "7708026449bed86239b1cd5bce6e3c34dbca6415",
172 "version" : "0.7.2"
173 }
174 }
175 ],
176 "version" : 3
177}
ios/Orgstar.xcodeproj/xcshareddata/xcschemes/Orgstar iOS.xcscheme added +76
@@ -0,0 +1,76 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<Scheme
3 LastUpgradeVersion = "2700"
4 version = "1.7">
5 <BuildAction
6 parallelizeBuildables = "YES"
7 buildImplicitDependencies = "YES">
8 <BuildActionEntries>
9 <BuildActionEntry
10 buildForTesting = "YES"
11 buildForRunning = "YES"
12 buildForProfiling = "YES"
13 buildForArchiving = "YES"
14 buildForAnalyzing = "YES">
15 <BuildableReference
16 BuildableIdentifier = "primary"
17 BlueprintIdentifier = "4E815AD2268DF19F304A2880"
18 BuildableName = "Orgstar.app"
19 BlueprintName = "Orgstar iOS"
20 ReferencedContainer = "container:Orgstar.xcodeproj">
21 </BuildableReference>
22 </BuildActionEntry>
23 </BuildActionEntries>
24 </BuildAction>
25 <TestAction
26 buildConfiguration = "Debug"
27 selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28 selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29 shouldUseLaunchSchemeArgsEnv = "YES">
30 </TestAction>
31 <LaunchAction
32 buildConfiguration = "Debug"
33 selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
34 selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
35 launchStyle = "0"
36 useCustomWorkingDirectory = "NO"
37 ignoresPersistentStateOnLaunch = "NO"
38 debugDocumentVersioning = "YES"
39 debugServiceExtension = "internal"
40 allowLocationSimulation = "YES">
41 <BuildableProductRunnable
42 runnableDebuggingMode = "0">
43 <BuildableReference
44 BuildableIdentifier = "primary"
45 BlueprintIdentifier = "4E815AD2268DF19F304A2880"
46 BuildableName = "Orgstar.app"
47 BlueprintName = "Orgstar iOS"
48 ReferencedContainer = "container:Orgstar.xcodeproj">
49 </BuildableReference>
50 </BuildableProductRunnable>
51 </LaunchAction>
52 <ProfileAction
53 buildConfiguration = "Release"
54 shouldUseLaunchSchemeArgsEnv = "YES"
55 savedToolIdentifier = ""
56 useCustomWorkingDirectory = "NO"
57 debugDocumentVersioning = "YES">
58 <BuildableProductRunnable
59 runnableDebuggingMode = "0">
60 <BuildableReference
61 BuildableIdentifier = "primary"
62 BlueprintIdentifier = "4E815AD2268DF19F304A2880"
63 BuildableName = "Orgstar.app"
64 BlueprintName = "Orgstar iOS"
65 ReferencedContainer = "container:Orgstar.xcodeproj">
66 </BuildableReference>
67 </BuildableProductRunnable>
68 </ProfileAction>
69 <AnalyzeAction
70 buildConfiguration = "Debug">
71 </AnalyzeAction>
72 <ArchiveAction
73 buildConfiguration = "Release"
74 revealArchiveInOrganizer = "YES">
75 </ArchiveAction>
76</Scheme>
ios/Orgstar/Info.plist added +67
@@ -0,0 +1,67 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3<plist version="1.0">
4<dict>
5 <key>CFBundleIdentifier</key>
6 <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
7 <key>CFBundleName</key>
8 <string>Orgstar</string>
9 <key>CFBundleDisplayName</key>
10 <string>Orgstar</string>
11 <key>CFBundleExecutable</key>
12 <string>$(EXECUTABLE_NAME)</string>
13 <key>CFBundlePackageType</key>
14 <string>APPL</string>
15 <key>CFBundleShortVersionString</key>
16 <string>$(MARKETING_VERSION)</string>
17 <key>CFBundleVersion</key>
18 <string>$(CURRENT_PROJECT_VERSION)</string>
19 <key>UILaunchScreen</key>
20 <dict/>
21 <key>UIApplicationSceneManifest</key>
22 <dict>
23 <key>UIApplicationSupportsMultipleScenes</key>
24 <true/>
25 </dict>
26 <key>UISupportedInterfaceOrientations</key>
27 <array>
28 <string>UIInterfaceOrientationPortrait</string>
29 <string>UIInterfaceOrientationLandscapeLeft</string>
30 <string>UIInterfaceOrientationLandscapeRight</string>
31 </array>
32 <key>UISupportedInterfaceOrientations~ipad</key>
33 <array>
34 <string>UIInterfaceOrientationPortrait</string>
35 <string>UIInterfaceOrientationPortraitUpsideDown</string>
36 <string>UIInterfaceOrientationLandscapeLeft</string>
37 <string>UIInterfaceOrientationLandscapeRight</string>
38 </array>
39 <!-- public.text, not public.plain-text as on the Mac: iOS previews plain text itself and
40 never asks the Quick Look extension. -->
41 <key>UTImportedTypeDeclarations</key>
42 <array>
43 <dict>
44 <key>UTTypeIdentifier</key>
45 <string>org.orgmode.org</string>
46 <key>UTTypeDescription</key>
47 <string>Org document</string>
48 <key>UTTypeConformsTo</key>
49 <array><string>public.text</string></array>
50 <key>UTTypeTagSpecification</key>
51 <dict>
52 <key>public.filename-extension</key>
53 <array><string>org</string><string>org_archive</string></array>
54 </dict>
55 </dict>
56 </array>
57 <key>CFBundleURLTypes</key>
58 <array>
59 <dict>
60 <key>CFBundleURLName</key>
61 <string>org-protocol</string>
62 <key>CFBundleURLSchemes</key>
63 <array><string>org-protocol</string></array>
64 </dict>
65 </array>
66</dict>
67</plist>
ios/Orgstar/Orgstar.entitlements added +8
@@ -0,0 +1,8 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3<plist version="1.0">
4<dict>
5 <key>com.apple.security.application-groups</key>
6 <array><string>group.sh.krz.orgstar</string></array>
7</dict>
8</plist>
ios/OrgstarQuickLook/Info.plist added +29
@@ -0,0 +1,29 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3<plist version="1.0">
4<dict>
5 <key>CFBundleIdentifier</key>
6 <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
7 <key>CFBundleName</key>
8 <string>$(PRODUCT_NAME)</string>
9 <key>CFBundleDisplayName</key>
10 <string>Orgstar</string>
11 <key>CFBundleExecutable</key>
12 <string>$(EXECUTABLE_NAME)</string>
13 <key>CFBundlePackageType</key>
14 <string>XPC!</string>
15 <key>CFBundleShortVersionString</key>
16 <string>$(MARKETING_VERSION)</string>
17 <key>CFBundleVersion</key>
18 <string>$(CURRENT_PROJECT_VERSION)</string>
19 <key>NSExtension</key>
20 <dict>
21 <key>NSExtensionPointIdentifier</key>
22 <string>com.apple.quicklook.preview</string>
23 <key>NSExtensionPrincipalClass</key>
24 <string>PreviewProvider</string>
25 <key>NSExtensionAttributes</key>
26 <dict><key>QLSupportedContentTypes</key><array><string>org.orgmode.org</string></array><key>QLIsDataBasedPreview</key><true/></dict>
27 </dict>
28</dict>
29</plist>
ios/OrgstarShare/Info.plist added +29
@@ -0,0 +1,29 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3<plist version="1.0">
4<dict>
5 <key>CFBundleIdentifier</key>
6 <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
7 <key>CFBundleName</key>
8 <string>$(PRODUCT_NAME)</string>
9 <key>CFBundleDisplayName</key>
10 <string>Orgstar</string>
11 <key>CFBundleExecutable</key>
12 <string>$(EXECUTABLE_NAME)</string>
13 <key>CFBundlePackageType</key>
14 <string>XPC!</string>
15 <key>CFBundleShortVersionString</key>
16 <string>$(MARKETING_VERSION)</string>
17 <key>CFBundleVersion</key>
18 <string>$(CURRENT_PROJECT_VERSION)</string>
19 <key>NSExtension</key>
20 <dict>
21 <key>NSExtensionPointIdentifier</key>
22 <string>com.apple.share-services</string>
23 <key>NSExtensionPrincipalClass</key>
24 <string>ShareViewController</string>
25 <key>NSExtensionAttributes</key>
26 <dict><key>NSExtensionActivationRule</key><dict><key>NSExtensionActivationSupportsWebURLWithMaxCount</key><integer>1</integer><key>NSExtensionActivationSupportsText</key><true/></dict></dict>
27 </dict>
28</dict>
29</plist>
ios/OrgstarShare/OrgstarShare.entitlements added +8
@@ -0,0 +1,8 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3<plist version="1.0">
4<dict>
5 <key>com.apple.security.application-groups</key>
6 <array><string>group.sh.krz.orgstar</string></array>
7</dict>
8</plist>