Replace across files; rename a tag or TODO keyword everywhere !487

merged merged by cmc on 2026-11-26 08:18 UTC · krz/orgstar:m5-replace into main

24 files changed, +3460 −77

One commit's changes, read-only. Review comments go on all commits.

Layout: unified · split

Changed files (24)
Sources/OrgApp/CommandRanking.swift +1 −1 · view
@@ -77,7 +77,7 @@ public enum CommandGroups {
77 public static let orgMenu: [Group] = [ 77 public static let orgMenu: [Group] = [
78 Group(title: String(localized: "Visibility", comment: "Org menu submenu"), prefixes: ["org.cycle", "org.fold.", "org.narrow.", "org.widen", "org.sparse-tree", "org.toggle-inline-images", "org.latex-preview"]), 78 Group(title: String(localized: "Visibility", comment: "Org menu submenu"), prefixes: ["org.cycle", "org.fold.", "org.narrow.", "org.widen", "org.sparse-tree", "org.toggle-inline-images", "org.latex-preview"]),
79 Group(title: String(localized: "Headings", comment: "Org menu submenu"), prefixes: ["org.heading.", "org.subtree.", "org.element.", "org.goto", "org.sort", "org.archive.", "app.refile", "app.archive"]), 79 Group(title: String(localized: "Headings", comment: "Org menu submenu"), prefixes: ["org.heading.", "org.subtree.", "org.element.", "org.goto", "org.sort", "org.archive.", "app.refile", "app.archive"]),
80 Group(title: String(localized: "TODO and Tags", comment: "Org menu submenu"), prefixes: ["org.todo.", "org.priority.", "org.tags.", "org.effort."]), 80 Group(title: String(localized: "TODO and Tags", comment: "Org menu submenu"), prefixes: ["org.todo.", "org.priority.", "org.tags.", "org.effort.", "app.rename-"]),
81 Group(title: String(localized: "Properties and Columns", comment: "Org menu submenu"), prefixes: ["org.property.", "org.columns", "org.drawer."]), 81 Group(title: String(localized: "Properties and Columns", comment: "Org menu submenu"), prefixes: ["org.property.", "org.columns", "org.drawer."]),
82 Group(title: String(localized: "Dates and Timers", comment: "Org menu submenu"), prefixes: ["org.schedule", "org.deadline", "org.timestamp.", "org.timer."]), 82 Group(title: String(localized: "Dates and Timers", comment: "Org menu submenu"), prefixes: ["org.schedule", "org.deadline", "org.timestamp.", "org.timer."]),
83 Group(title: String(localized: "Lists", comment: "Org menu submenu"), prefixes: ["org.item.", "org.checkbox."]), 83 Group(title: String(localized: "Lists", comment: "Org menu submenu"), prefixes: ["org.item.", "org.checkbox."]),
Sources/OrgApp/CommandTitles.swift +3 · view
@@ -258,8 +258,11 @@ enum CommandTitles {
258 String(localized: "Rename Note from Front Matter", comment: "Command title"), 258 String(localized: "Rename Note from Front Matter", comment: "Command title"),
259 String(localized: "Rename Notes in Folder from Front Matter…", comment: "Command title"), 259 String(localized: "Rename Notes in Folder from Front Matter…", comment: "Command title"),
260 String(localized: "Rename Note…", comment: "Command title"), 260 String(localized: "Rename Note…", comment: "Command title"),
261 String(localized: "Rename TODO Keyword…", comment: "Command title"),
262 String(localized: "Rename Tag…", comment: "Command title"),
261 String(localized: "Reparent Note with Descendants…", comment: "Command title"), 263 String(localized: "Reparent Note with Descendants…", comment: "Command title"),
262 String(localized: "Reparent Note…", comment: "Command title"), 264 String(localized: "Reparent Note…", comment: "Command title"),
265 String(localized: "Replace in Files…", comment: "Command title"),
263 String(localized: "Resolve Open Clocks…", comment: "Command title"), 266 String(localized: "Resolve Open Clocks…", comment: "Command title"),
264 String(localized: "Resolve Sync Conflicts…", comment: "Command title"), 267 String(localized: "Resolve Sync Conflicts…", comment: "Command title"),
265 String(localized: "Revert to File on Disk", comment: "Command title"), 268 String(localized: "Revert to File on Disk", comment: "Command title"),
Sources/OrgApp/DocumentSession.swift +39 · view
@@ -899,6 +899,45 @@ public final class DocumentSession {
899 } 899 }
900 } 900 }
901 901
902 /// Applies `edits`, computed against `expected`, to `path` as one change, as Replace in
903 /// Files and the renames do. An open buffer takes them as an edit its editor can undo; a
904 /// buffer with no editor yet, and a file that isn't open, first has its text kept in
905 /// recovery (labelled `replace`), and the file is written through the save path. Nil when
906 /// done, else why not; nothing changes when the text is no longer `expected`.
907 public func applyChanges(_ edits: [TextEdit], to path: String, expecting expected: String, now: Date = Date()) -> String? {
908 let url = URL(fileURLWithPath: path)
909 let name = url.lastPathComponent
910 let stale = "\(name) changed after the search; nothing was changed in it."
911 if let entry = entry(path) {
912 let state = entry.buffer.document
913 guard state.isEditable else { return "\(name) isn't UTF-8, so it can't be changed." }
914 guard state.text == expected else { return stale }
915 if entry.buffer is StateBuffer {
916 do { try recovery.keep(try state.encodedText(), for: url, label: "replace") } catch {
917 return "Can't keep a copy of \(name): \(error.localizedDescription)"
918 }
919 }
920 if case .failed(let message) = entry.buffer.perform(PrecomputedEdit(EditResult(baseRevision: state.revision, edits: edits)), now: now, answers: [:]) {
921 return message
922 }
923 changed(entry)
924 return nil
925 }
926 do {
927 guard let bytes = try fileSystem.read(url) else { return "\(name) no longer exists." }
928 var state = loaded(bytes, path: path)
929 guard state.isEditable else { return "\(name) isn't UTF-8, so it can't be changed." }
930 guard state.text == expected else { return stale }
931 try recovery.keep(bytes, for: url, label: "replace")
932 try state.apply(edits, baseRevision: state.revision)
933 if case .conflict = try saver.save(&state, to: url) { return "\(name) changed on disk; nothing was changed." }
934 textChanged?(path)
935 return nil
936 } catch {
937 return "Can't change \(name): \(error.localizedDescription)"
938 }
939 }
940
902 // MARK: - External work 941 // MARK: - External work
903 942
904 /// Recalculates a table in Emacs from a snapshot of the buffer, then replaces the table 943 /// Recalculates a table in Emacs from a snapshot of the buffer, then replaces the table
Sources/OrgApp/ReplaceInFiles.swift added +341 · view
@@ -0,0 +1,341 @@
1import Foundation
2import Observation
3import OrgCore
4import OrgDocument
5
6/// Replace in Files, Rename Tag and Rename TODO Keyword: a search of the files of one folder or
7/// all folders, off the main actor and cancellable, whose changes are listed by file and line
8/// to untick, then applied as one change per file through `DocumentSession.applyChanges`.
9/// Open buffers are searched as they are, unsaved edits included. Encrypted files (`.gpg`) and
10/// org-crypt's encrypted entries are left out.
11@MainActor
12@Observable
13public final class ReplaceInFiles {
14 public enum Mode: Sendable, Equatable {
15 case replace(TextReplace)
16 case renameTag(from: String, to: String)
17 case renameKeyword(from: String, to: String)
18 }
19
20 /// `org-todo-keywords` and `org-tag-alist` in config.toml, and how to change one by its
21 /// user-defaults key.
22 public struct Config {
23 public var todoKeywords: String
24 public var tagAlist: String
25 public var set: @MainActor (_ defaultsKey: String, _ value: String) -> Void
26
27 public init(todoKeywords: String, tagAlist: String, set: @escaping @MainActor (String, String) -> Void) {
28 self.todoKeywords = todoKeywords
29 self.tagAlist = tagAlist
30 self.set = set
31 }
32
33 /// From user defaults; on the Mac, a change there is written into config.toml.
34 public static var standard: Config {
35 let defaults = UserDefaults.standard
36 return Config(todoKeywords: defaults.string(forKey: "todoKeywords") ?? OrgPreferences.defaultTodoKeywords,
37 tagAlist: defaults.string(forKey: "tagAlist") ?? "") { key, value in defaults.set(value, forKey: key) }
38 }
39 }
40
41 /// The changes found in one file.
42 public struct FileChanges: Identifiable, Sendable {
43 public let path: String
44 /// The path below its folder.
45 public let relativePath: String
46 public let changes: [ProposedChange]
47 /// The text the changes were found in.
48 let text: String
49 /// Changes left out, by id.
50 public var unticked: Set<Int> = []
51 public var id: String { path }
52 public var name: String { (path as NSString).lastPathComponent }
53 public var isIncluded: Bool { unticked.count < changes.count }
54 }
55
56 /// A setting of config.toml the rename changes too, if the user agrees.
57 public struct ConfigChange: Equatable, Sendable {
58 /// Its name in config.toml.
59 public let key: String
60 let defaultsKey: String
61 public let old: String
62 public let new: String
63 }
64
65 public private(set) var mode: Mode?
66 public private(set) var files: [FileChanges] = []
67 public private(set) var configChange: ConfigChange?
68 /// Apply also changes config.toml.
69 public var changesConfig = true
70 /// Files searched so far, of how many.
71 public private(set) var progress: (done: Int, total: Int) = (0, 0)
72 public private(set) var isSearching = false
73 public private(set) var wasCancelled = false
74 /// Why there is nothing to apply: a pattern that doesn't compile, a refused rename.
75 public private(set) var problem: String?
76
77 private let session: DocumentSession
78 private let workspace: WorkspaceModel
79 @ObservationIgnored private var config: Config
80 @ObservationIgnored private var task: Task<Void, Never>?
81 @ObservationIgnored private var generation = 0
82
83 public init(session: DocumentSession, workspace: WorkspaceModel, config: Config = .standard) {
84 self.session = session
85 self.workspace = workspace
86 self.config = config
87 }
88
89 public var changeCount: Int { files.reduce(0) { $0 + $1.changes.count } }
90 public var tickedCount: Int { files.reduce(0) { $0 + $1.changes.count - $1.unticked.count } }
91
92 /// Extensions searched besides org files, by Replace in Files.
93 static let textExtensions: Set<String> = ["txt", "md", "markdown"]
94
95 /// Searches the files of the folder `scope` (a root's path), or of every folder. A rename
96 /// with `includeConfig` also renames in config.toml. Cancels a search that is running.
97 public func start(_ mode: Mode, scope: String?, includeConfig: Bool = true, cryptTag: String = OrgPreferences.cryptTag()) {
98 task?.cancel()
99 generation += 1
100 self.mode = mode
101 files = []
102 configChange = nil
103 problem = nil
104 wasCancelled = false
105 changesConfig = includeConfig
106 isSearching = false
107 progress = (0, 0)
108
109 var regex: NSRegularExpression?
110 switch mode {
111 case .replace(let query):
112 do {
113 regex = try query.regex()
114 } catch TextReplace.InvalidPattern.empty {
115 return problem = String(localized: "Nothing to search for", comment: "Replace in Files: the search field is empty")
116 } catch {
117 return problem = String(localized: "Not a regular expression: \(query.pattern)", comment: "Replace in Files")
118 }
119 case .renameTag(let old, let new):
120 if let refusal = Self.refusal(old, new, valid: TagRename.isValidName, kind: .tag) { return problem = refusal }
121 if let renamed = TagRename.renamedTagAlist(config.tagAlist, from: old, to: new) {
122 configChange = ConfigChange(key: "org-tag-alist", defaultsKey: "tagAlist", old: config.tagAlist, new: renamed)
123 }
124 case .renameKeyword(let old, let new):
125 if let refusal = Self.refusal(old, new, valid: KeywordRename.isValidName, kind: .keyword) { return problem = refusal }
126 let settings = OrgSettings.default.withTodoKeywords(config.todoKeywords) ?? .default
127 if KeywordRename.crossesStates(settings, from: old, to: new) {
128 return problem = Self.crossing(old, new, settings, in: "config.toml")
129 }
130 if let renamed = KeywordRename.renamedTodoKeywords(config.todoKeywords, from: old, to: new) {
131 configChange = ConfigChange(key: "org-todo-keywords", defaultsKey: "todoKeywords", old: config.todoKeywords, new: renamed)
132 }
133 }
134
135 let entries = workspace.files.filter { entry in
136 guard scope == nil || entry.root == scope, !EncryptedText.isEncryptedFile(entry.path) else { return false }
137 switch entry.kind {
138 case .org, .archive: return true
139 case .other:
140 if case .replace = mode { return Self.textExtensions.contains((entry.path as NSString).pathExtension.lowercased()) }
141 return false
142 case .conflict: return false
143 }
144 }
145 // Open buffers as they are; the rest is read from disk off the main actor.
146 var open: [String: String?] = [:]
147 for entry in entries {
148 if let document = session.document(of: entry.path) { open[entry.path] = document.isEditable ? document.text : nil }
149 }
150 let job = Job(mode: mode, regex: regex, options: session.options, defaults: session.defaults, cryptTag: cryptTag,
151 configRenamed: includeConfig && configChange != nil, scope: Set(entries.map(\.path)))
152 let generation = generation
153 let list = entries.map { ($0.path, $0.relativePath) }
154 progress = (0, list.count)
155 isSearching = true
156 task = Task.detached(priority: .userInitiated) { [weak self] in
157 var found: [FileChanges] = []
158 var refusal: String?
159 for (index, (path, relative)) in list.enumerated() {
160 if Task.isCancelled { break }
161 let text: String?
162 if let buffered = open[path] {
163 text = buffered
164 } else {
165 text = (try? Data(contentsOf: URL(fileURLWithPath: path))).flatMap { data in
166 let source = SourceText(bytes: [UInt8](data))
167 return source.isEditable ? source.text : nil
168 }
169 }
170 if let text {
171 switch job.changes(in: text, path: path) {
172 case .success(let changes):
173 if !changes.isEmpty { found.append(FileChanges(path: path, relativePath: relative, changes: changes, text: text)) }
174 case .failure(let reason):
175 refusal = reason.message
176 }
177 }
178 if refusal != nil { break }
179 if index % 16 == 15 || index == list.count - 1 {
180 let done = index + 1
181 await MainActor.run { self?.reportProgress(done, generation: generation) }
182 }
183 }
184 let cancelled = Task.isCancelled
185 await MainActor.run { [found, refusal] in self?.finish(found, refusal: refusal, cancelled: cancelled, generation: generation) }
186 }
187 }
188
189 /// Waits for the running search, for tests.
190 public func waitForSearch() async {
191 await task?.value
192 }
193
194 /// Stops the search; what it found so far stays listed.
195 public func cancel() {
196 guard isSearching else { return }
197 task?.cancel()
198 wasCancelled = true
199 }
200
201 private func reportProgress(_ done: Int, generation: Int) {
202 guard generation == self.generation else { return }
203 progress.done = done
204 }
205
206 private func finish(_ found: [FileChanges], refusal: String?, cancelled: Bool, generation: Int) {
207 guard generation == self.generation else { return }
208 isSearching = false
209 if cancelled { wasCancelled = true }
210 if let refusal {
211 problem = refusal
212 files = []
213 configChange = nil
214 return
215 }
216 files = found.sorted { $0.path.localizedStandardCompare($1.path) == .orderedAscending }
217 }
218
219 // MARK: - Choosing
220
221 public func isTicked(_ change: Int, in path: String) -> Bool {
222 files.first { $0.path == path }.map { !$0.unticked.contains(change) } ?? false
223 }
224
225 public func setTicked(_ on: Bool, change: Int, in path: String) {
226 guard let index = files.firstIndex(where: { $0.path == path }) else { return }
227 if on { files[index].unticked.remove(change) } else { files[index].unticked.insert(change) }
228 }
229
230 /// Ticks or unticks every change in a file.
231 public func setTicked(_ on: Bool, file path: String) {
232 guard let index = files.firstIndex(where: { $0.path == path }) else { return }
233 files[index].unticked = on ? [] : Set(files[index].changes.map(\.id))
234 }
235
236 // MARK: - Applying
237
238 /// Applies the ticked changes, one change per file, and config.toml's when `changesConfig`.
239 /// Returns what happened, for the echo area.
240 @discardableResult
241 public func apply(now: Date = Date()) -> String {
242 var changed = 0
243 var problems: [String] = []
244 for file in files where file.isIncluded {
245 let edits = file.changes.filter { !file.unticked.contains($0.id) }.map(\.edit)
246 if let problem = session.applyChanges(edits, to: file.path, expecting: file.text, now: now) {
247 problems.append(problem)
248 } else {
249 changed += 1
250 }
251 }
252 if let configChange, changesConfig {
253 config.set(configChange.defaultsKey, configChange.new)
254 config = Config(todoKeywords: configChange.defaultsKey == "todoKeywords" ? configChange.new : config.todoKeywords,
255 tagAlist: configChange.defaultsKey == "tagAlist" ? configChange.new : config.tagAlist, set: config.set)
256 }
257 let appliedConfig = configChange != nil && changesConfig
258 files = []
259 configChange = nil
260 var summary = String(localized: "Files changed: \(changed)", comment: "Replace in Files: after applying")
261 if appliedConfig { summary += "; " + String(localized: "config.toml changed", comment: "Replace in Files: after applying") }
262 return ([summary] + problems).joined(separator: "; ")
263 }
264
265 // MARK: - Refusals
266
267 enum NameKind { case tag, keyword }
268
269 private static func refusal(_ old: String, _ new: String, valid: (String) -> Bool, kind: NameKind) -> String? {
270 if old.isEmpty || new.isEmpty { return String(localized: "Give the old and the new name.", comment: "Rename Tag or TODO Keyword") }
271 if old == new { return String(localized: "The new name is the old one.", comment: "Rename Tag or TODO Keyword") }
272 guard valid(new) else {
273 return switch kind {
274 case .tag: String(localized: "\(new) can't be a tag: a tag is letters, digits, _, @, # and %.", comment: "Rename Tag")
275 case .keyword: String(localized: "\(new) can't be a TODO keyword: it has a space, a bar or a parenthesis.", comment: "Rename TODO Keyword")
276 }
277 }
278 return nil
279 }
280
281 nonisolated static func crossing(_ old: String, _ new: String, _ settings: OrgSettings, in place: String) -> String {
282 settings.isDone(old)
283 ? String(localized: "Can't rename \(old) to \(new): in \(place), \(old) is a done state and \(new) isn't.", comment: "Rename TODO Keyword: refused")
284 : String(localized: "Can't rename \(old) to \(new): in \(place), \(new) is a done state and \(old) isn't.", comment: "Rename TODO Keyword: refused")
285 }
286
287 // MARK: - The search
288
289 struct Refusal: Error {
290 let message: String
291 }
292
293 /// What a search looks for, with what it needs to look off the main actor.
294 struct Job: Sendable {
295 let mode: Mode
296 let regex: NSRegularExpression?
297 let options: EditingOptions
298 let defaults: OrgSettings
299 let cryptTag: String
300 /// config.toml's `org-todo-keywords` is renamed too.
301 let configRenamed: Bool
302 /// Every file searched.
303 let scope: Set<String>
304
305 func changes(in text: String, path: String) -> Result<[ProposedChange], Refusal> {
306 let skipping = EncryptedText.ranges(in: text, tag: cryptTag)
307 switch mode {
308 case .replace(let query):
309 return .success((try? query.changes(in: text, skipping: skipping, regex: regex)) ?? [])
310 case .renameTag(let old, let new):
311 guard Self.isOrg(path), text.contains(old) else { return .success([]) }
312 let tree = OrgParser.parse(text, defaults: defaults.resolvingSetupFiles(in: text, path: path, read: OrgSettings.readFile))
313 return .success(TagRename.changes(in: text, tree: tree, from: old, to: new, options: options, skipping: skipping))
314 case .renameKeyword(let old, let new):
315 guard Self.isOrg(path), text.contains(old) else { return .success([]) }
316 var setupFiles: [String] = []
317 let settings = defaults.resolvingSetupFiles(in: text, path: path) { file in
318 setupFiles.append(file)
319 return OrgSettings.readFile(file)
320 }
321 let tree = OrgParser.parse(text, defaults: settings)
322 if KeywordRename.crossesStates(tree.settings, from: old, to: new) {
323 return .failure(Refusal(message: ReplaceInFiles.crossing(old, new, tree.settings, in: (path as NSString).lastPathComponent)))
324 }
325 // Headings change where the keyword they get will be one: where the file's own
326 // lines name it, or setup files also searched, or config.toml when it changes.
327 let headings = switch KeywordRename.source(of: old, in: tree) {
328 case .file: true
329 case .setupFile: setupFiles.allSatisfy { scope.contains(($0 as NSString).standardizingPath) || scope.contains($0) }
330 case .defaults: configRenamed
331 case .none: false
332 }
333 return .success(KeywordRename.changes(in: text, tree: tree, from: old, to: new, headings: headings, options: options, skipping: skipping))
334 }
335 }
336
337 static func isOrg(_ path: String) -> Bool {
338 path.hasSuffix(".org") || path.hasSuffix(".org_archive")
339 }
340 }
341}
Sources/OrgApp/ReplacePreview.swift added +143 · view
@@ -0,0 +1,143 @@
1import OrgCore
2import SwiftUI
3
4/// Which of the commands over files a sheet runs.
5public enum ReplaceKind: String, Identifiable, Sendable {
6 case replace, renameTag, renameKeyword
7 public var id: String { rawValue }
8
9 /// The command that opens it.
10 public init?(command: String) {
11 switch command {
12 case "app.replace-in-files": self = .replace
13 case "app.rename-tag": self = .renameTag
14 case "app.rename-todo-keyword": self = .renameKeyword
15 default: return nil
16 }
17 }
18
19 public var title: String {
20 switch self {
21 case .replace: String(localized: "Replace in Files", comment: "Window title")
22 case .renameTag: String(localized: "Rename Tag", comment: "Window title")
23 case .renameKeyword: String(localized: "Rename TODO Keyword", comment: "Window title")
24 }
25 }
26
27 /// What the sheet starts with for a heading line at `caret`: its tag under the caret or
28 /// first tag, or its TODO keyword.
29 public func initial(text: String, caret: Int, keywords: Set<String>) -> String {
30 guard self != .replace else { return "" }
31 let ns = text as NSString
32 let lineRange = ns.lineRange(for: NSRange(location: min(caret, ns.length), length: 0))
33 let line = ns.substring(with: lineRange).trimmingCharacters(in: .newlines)
34 guard line.hasPrefix("*") else { return "" }
35 let words = line.drop { $0 == "*" }.split(whereSeparator: { $0 == " " || $0 == "\t" })
36 if self == .renameKeyword {
37 return words.first.map(String.init).flatMap { keywords.contains($0) ? $0 : nil } ?? ""
38 }
39 guard let tags = line.firstMatch(of: /[ \t]:([\p{L}\p{N}_@#%:]+):[ \t]*$/) else { return "" }
40 let start = line.utf16.distance(from: line.startIndex, to: tags.1.startIndex)
41 var at = start
42 for tag in tags.1.split(separator: ":") {
43 let end = at + tag.utf16.count
44 if (lineRange.location + at...lineRange.location + end).contains(caret) { return String(tag) }
45 at = end + 1
46 }
47 return tags.1.split(separator: ":").first.map(String.init) ?? ""
48 }
49
50 /// The button that applies the ticked changes.
51 public var applyTitle: String {
52 switch self {
53 case .replace: String(localized: "Replace", comment: "Replace in Files: applies the ticked changes")
54 case .renameTag, .renameKeyword: String(localized: "Rename", comment: "Rename Tag or TODO Keyword: applies the ticked changes")
55 }
56 }
57}
58
59/// The changes a search found, by file and line, each with a checkbox: the line with the part
60/// that goes struck through in `removed` and what replaces it in `added`.
61public struct ReplacePreview: View {
62 let model: ReplaceInFiles
63 let removed: Color
64 let added: Color
65 @Environment(\.accessibilityDifferentiateWithoutColor) private var withoutColor
66
67 public init(model: ReplaceInFiles, removed: Color = .red, added: Color = .green) {
68 self.model = model
69 self.removed = removed
70 self.added = added
71 }
72
73 public var body: some View {
74 List {
75 if let change = model.configChange, model.changesConfig {
76 Section {
77 VStack(alignment: .leading, spacing: 2) {
78 Text(verbatim: "\(change.key) = \"\(change.new.replacingOccurrences(of: "\n", with: "\\n"))\"")
79 .font(.system(.callout, design: .monospaced))
80 Text("Was \"\(change.old.replacingOccurrences(of: "\n", with: "\\n"))\"", comment: "Rename: the config.toml setting before the change")
81 .font(.caption).foregroundStyle(.secondary)
82 }
83 } header: {
84 Text(verbatim: "config.toml")
85 }
86 }
87 ForEach(model.files) { file in
88 Section {
89 // Ids unique across files: a List reuses rows by id across its sections.
90 ForEach(file.changes.map { (key: file.path + "#\($0.id)", change: $0) }, id: \.key) { item in
91 let change = item.change
92 Toggle(isOn: Binding(get: { !file.unticked.contains(change.id) }, set: { model.setTicked($0, change: change.id, in: file.path) })) {
93 row(change)
94 }
95 }
96 } header: {
97 Toggle(isOn: Binding(get: { file.isIncluded }, set: { model.setTicked($0, file: file.path) })) {
98 HStack(spacing: 6) {
99 Text(verbatim: file.name).bold()
100 Text(verbatim: file.relativePath).foregroundStyle(.secondary).lineLimit(1).truncationMode(.head)
101 Spacer()
102 Text("\(file.changes.count - file.unticked.count) of \(file.changes.count)", comment: "Replace in Files: ticked changes of the file's changes")
103 .foregroundStyle(.secondary).monospacedDigit()
104 }
105 }
106 }
107 }
108 }
109 #if os(macOS)
110 .toggleStyle(.checkbox)
111 #endif
112 }
113
114 private func row(_ change: ProposedChange) -> some View {
115 let line = change.lineText as NSString
116 let start = min(change.changed.lowerBound, line.length), end = min(change.changed.upperBound, line.length)
117 var old = AttributedString(Self.collapsed(line.substring(with: NSRange(location: start, length: end - start))))
118 old.strikethroughStyle = .single
119 old.foregroundColor = removed
120 var new = AttributedString(Self.collapsed(change.replacement.replacingOccurrences(of: "\n", with: "⏎")))
121 new.foregroundColor = added
122 if withoutColor { new.underlineStyle = .single }
123 let text = AttributedString(Self.trimmedStart(Self.collapsed(line.substring(to: start)))) + old + new
124 + AttributedString(Self.collapsed(line.substring(from: end)))
125 return HStack(alignment: .firstTextBaseline, spacing: 8) {
126 Text(verbatim: "\(change.line)").foregroundStyle(.secondary).monospacedDigit()
127 Text(text).lineLimit(2).font(.system(.callout, design: .monospaced))
128 }
129 .accessibilityElement(children: .ignore)
130 .accessibilityLabel(Text("Line \(change.line): \(change.lineText)", comment: "Replace in Files: a change, for VoiceOver"))
131 .accessibilityValue(Text("Becomes \(line.substring(to: start) + change.replacement + line.substring(from: end))", comment: "Replace in Files: the line after the change, for VoiceOver"))
132 }
133
134 /// Runs of blanks as one space, so the spaces that align tags don't fill the row.
135 static func collapsed(_ text: String) -> String {
136 text.replacingOccurrences(of: "[ \t]{2,}", with: " ", options: .regularExpression)
137 }
138
139 /// A long start of a line, cut to its last 40 characters so the change shows.
140 static func trimmedStart(_ text: String) -> String {
141 text.count > 40 ? "…" + text.suffix(40) : text
142 }
143}
Sources/OrgCore/Replace/ProposedChange.swift added +161 · view
@@ -0,0 +1,161 @@
1import Foundation
2
3/// One change that Replace in Files or a rename proposes in a file: the line it is on, the part
4/// of the line that changes, what takes its place, and the edit to the whole text.
5public struct ProposedChange: Sendable, Equatable, Identifiable {
6 /// Its index among the file's changes.
7 public let id: Int
8 /// 1-based.
9 public let line: Int
10 /// The line as it is, without its line break.
11 public let lineText: String
12 /// The part of `lineText` that changes, in UTF-16 offsets; for a match that runs past the
13 /// line, from its start to the end of the line.
14 public let changed: Range<Int>
15 /// What replaces `changed`.
16 public let replacement: String
17 public let edit: TextEdit
18
19 public init(id: Int, line: Int, lineText: String, changed: Range<Int>, replacement: String, edit: TextEdit) {
20 self.id = id
21 self.line = line
22 self.lineText = lineText
23 self.changed = changed
24 self.replacement = replacement
25 self.edit = edit
26 }
27
28 /// `text` with `changes` applied.
29 public static func apply(_ changes: [ProposedChange], to text: String) -> String {
30 var result = text
31 for change in changes.sorted(by: { $0.edit.range.lowerBound > $1.edit.range.lowerBound }) { result = change.edit.apply(to: result) }
32 return result
33 }
34}
35
36/// Where each line of a text starts, to describe an offset by its line.
37struct LineStarts {
38 let text: NSString
39 private let starts: [Int]
40
41 init(_ text: NSString) {
42 self.text = text
43 var starts = [0]
44 for at in 0..<text.length where text.character(at: at) == 10 { starts.append(at + 1) }
45 self.starts = starts
46 }
47
48 /// The 0-based line holding `offset`.
49 func line(of offset: Int) -> Int {
50 var low = 0, high = starts.count - 1
51 while low < high {
52 let mid = (low + high + 1) / 2
53 if starts[mid] <= offset { low = mid } else { high = mid - 1 }
54 }
55 return low
56 }
57
58 /// The line's text without its line break.
59 func content(ofLine index: Int) -> Range<Int> {
60 let start = starts[index]
61 var end = index + 1 < starts.count ? starts[index + 1] : text.length
62 while end > start, [10, 13].contains(text.character(at: end - 1)) { end -= 1 }
63 return start..<end
64 }
65
66 /// A change for `edit`, described on the line it starts on.
67 /// `shown`, when given, is what the list shows changing, in place of `edit`.
68 func change(id: Int, _ edit: TextEdit, shown: TextEdit? = nil) -> ProposedChange {
69 let index = line(of: edit.range.lowerBound)
70 let content = content(ofLine: index)
71 let lineText = text.substring(with: NSRange(content))
72 let display = shown ?? edit
73 let start = display.range.lowerBound - content.lowerBound
74 let end = min(display.range.upperBound, content.upperBound) - content.lowerBound
75 return ProposedChange(id: id, line: index + 1, lineText: lineText, changed: start..<max(start, end), replacement: display.replacement, edit: edit)
76 }
77
78 /// `edit` (from `edit(lineStart:from:to:)`) widened to whole words of the line, for showing.
79 func wholeWords(_ edit: TextEdit) -> TextEdit {
80 func blank(_ at: Int) -> Bool { [32, 9, 10, 13].contains(text.character(at: at)) }
81 var start = edit.range.lowerBound, end = edit.range.upperBound
82 var before = "", after = ""
83 while start > 0, !blank(start - 1) {
84 start -= 1
85 before = text.substring(with: NSRange(location: start, length: 1)) + before
86 }
87 while end < text.length, !blank(end) {
88 after += text.substring(with: NSRange(location: end, length: 1))
89 end += 1
90 }
91 return TextEdit(range: start..<end, replacement: before + edit.replacement + after)
92 }
93
94 /// The edit that turns the line at `lineStart` from `old` into `new`, the parts both
95 /// share left out, at whole characters.
96 static func edit(lineStart: Int, from old: String, to new: String) -> TextEdit? {
97 guard old != new else { return nil }
98 let a = Array(old.unicodeScalars), b = Array(new.unicodeScalars)
99 var prefix = 0
100 while prefix < a.count, prefix < b.count, a[prefix] == b[prefix] { prefix += 1 }
101 var suffix = 0
102 while suffix < a.count - prefix, suffix < b.count - prefix, a[a.count - 1 - suffix] == b[b.count - 1 - suffix] { suffix += 1 }
103 func utf16(_ scalars: ArraySlice<Unicode.Scalar>) -> Int { scalars.reduce(0) { $0 + $1.utf16.count } }
104 let start = lineStart + utf16(a[..<prefix])
105 let removed = utf16(a[prefix..<(a.count - suffix)])
106 var replacement = String.UnicodeScalarView()
107 replacement.append(contentsOf: b[prefix..<(b.count - suffix)])
108 return TextEdit(range: start..<(start + removed), replacement: String(replacement))
109 }
110}
111
112/// org-crypt's encrypted entries and encrypted files, which searches and renames leave alone.
113public enum EncryptedText {
114 /// A file encrypted as a whole (`notes.org.gpg`), by its extension.
115 public static func isEncryptedFile(_ path: String) -> Bool {
116 path.lowercased().hasSuffix(".gpg")
117 }
118
119 /// The armored PGP messages (`-----BEGIN PGP MESSAGE-----` to `-----END PGP MESSAGE-----`)
120 /// in the entries of headings tagged `tag`, their own tag or inherited: the entries
121 /// org-crypt encrypted. Whole lines.
122 public static func ranges(in text: String, tag: String = "crypt") -> [Range<Int>] {
123 guard text.contains("-----BEGIN PGP MESSAGE-----") else { return [] }
124 let ns = text as NSString
125 var ranges: [Range<Int>] = []
126 // Levels of the headings above the line, with whether each has the tag.
127 var stack: [(level: Int, tagged: Bool)] = []
128 var begin: Int?
129 var at = 0
130 while at < ns.length {
131 let lineRange = ns.lineRange(for: NSRange(location: at, length: 0))
132 let line = ns.substring(with: lineRange).trimmingCharacters(in: .newlines)
133 at = NSMaxRange(lineRange)
134 if let match = line.firstMatch(of: /^(\*+)[ \t]/) {
135 if let open = begin {
136 ranges.append(open..<lineRange.location)
137 begin = nil
138 }
139 let level = match.1.count
140 while let last = stack.last, last.level >= level { stack.removeLast() }
141 let tags = line.firstMatch(of: /[ \t]:([\p{L}\p{N}_@#%:]+):[ \t]*$/).map { $0.1.split(separator: ":").map(String.init) } ?? []
142 stack.append((level, tags.contains(tag) || (stack.last?.tagged ?? false)))
143 continue
144 }
145 let trimmed = line.trimmingCharacters(in: .whitespaces)
146 if begin == nil, trimmed == "-----BEGIN PGP MESSAGE-----", stack.last?.tagged == true {
147 begin = lineRange.location
148 } else if let open = begin, trimmed == "-----END PGP MESSAGE-----" {
149 ranges.append(open..<NSMaxRange(lineRange))
150 begin = nil
151 }
152 }
153 if let open = begin { ranges.append(open..<ns.length) }
154 return ranges
155 }
156
157 /// Whether `range` touches one of `ranges`.
158 static func overlaps(_ range: Range<Int>, _ ranges: [Range<Int>]) -> Bool {
159 ranges.contains { $0.overlaps(range) || ($0.contains(range.lowerBound) && range.isEmpty) }
160 }
161}
Sources/OrgCore/Replace/StructuralRename.swift added +209 · view
@@ -0,0 +1,209 @@
1import Foundation
2
3/// Rename Tag: a tag renamed in heading tag lists, realigned as `org-set-tags` leaves them, and
4/// in `#+TAGS` and `#+FILETAGS` lines; never in other text. A name already there merges.
5public enum TagRename {
6 /// Characters a tag can hold (`org-tag-re`).
7 public static func isValidName(_ name: String) -> Bool {
8 !name.isEmpty && name.allSatisfy { $0.isLetter || $0.isNumber || "_@#%".contains($0) }
9 }
10
11 public static func changes(in text: String, tree: OrgTree, from old: String, to new: String, options: EditingOptions, skipping: [Range<Int>] = []) -> [ProposedChange] {
12 let ns = text as NSString
13 let lines = LineStarts(ns)
14 var edits: [(edit: TextEdit, shown: TextEdit)] = []
15 for node in tree.root.descendants() {
16 switch node.kind {
17 case .heading:
18 guard let token = node.tokens.first(where: { $0.kind == .tags }) else { continue }
19 let tags = token.text.split(separator: ":").map(String.init)
20 guard tags.contains(old) else { continue }
21 var renamed: [String] = []
22 for tag in tags.map({ $0 == old ? new : $0 }) where !renamed.contains(tag) { renamed.append(tag) }
23 let content = lines.content(ofLine: lines.line(of: node.range.lowerBound))
24 let line = ns.substring(with: NSRange(content))
25 let buffer = EmacsBuffer(line, point: 0, settings: tree.settings, options: options)
26 guard (try? SetTags.set(renamed, in: buffer)) != nil else { continue }
27 if let edit = LineStarts.edit(lineStart: content.lowerBound, from: line, to: buffer.string) {
28 edits.append((edit, TextEdit(range: token.range, replacement: renamed.isEmpty ? "" : ":" + renamed.joined(separator: ":") + ":")))
29 }
30 case .keyword:
31 guard let (key, content, line) = keywordLine(node, lines) else { continue }
32 let value = key.value
33 let renamed: String? = switch key.name {
34 case "TAGS": renamedTagsValue(String(line[value]), from: old, to: new)
35 case "FILETAGS": renamedFileTagsValue(String(line[value]), from: old, to: new)
36 default: nil
37 }
38 guard let renamed else { continue }
39 let newLine = String(line[..<value.lowerBound]) + renamed
40 if let edit = LineStarts.edit(lineStart: content.lowerBound, from: line, to: newLine) { edits.append((edit, lines.wholeWords(edit))) }
41 default:
42 break
43 }
44 }
45 return edits.filter { !EncryptedText.overlaps($0.edit.range, skipping) }.enumerated().map { lines.change(id: $0.offset, $0.element.edit, shown: $0.element.shown) }
46 }
47
48 /// Lines of `org-tag-alist` in `#+TAGS` syntax with `old` renamed; nil when none names it.
49 public static func renamedTagAlist(_ alist: String, from old: String, to new: String) -> String? {
50 renamedLines(alist) { renamedTagsValue($0, from: old, to: new) }
51 }
52
53 /// A `#+TAGS` value with the tag `old` renamed, keeping its fast-selection key, or removed
54 /// when `new` is there already; nil when it doesn't name `old`.
55 static func renamedTagsValue(_ value: String, from old: String, to new: String) -> String? {
56 let name = "[\\p{L}\\p{N}_@#%"
57 func token(_ tag: String) -> String { "(?<!\(name)(])" + NSRegularExpression.escapedPattern(for: tag) + "(?!\(name)])" }
58 return renamedValue(value, old: token(old), new: token(new), key: "(?:\\([^)]*\\))?", separators: "\\s", replacement: new)
59 }
60
61 /// A `#+FILETAGS` value (`:a:b:` or `a b`) with `old` renamed, or removed when `new` is
62 /// there already; nil when it doesn't name `old`.
63 static func renamedFileTagsValue(_ value: String, from old: String, to new: String) -> String? {
64 func token(_ tag: String) -> String { "(?<![^\\s:])" + NSRegularExpression.escapedPattern(for: tag) + "(?![^\\s:])" }
65 return renamedValue(value, old: token(old), new: token(new), key: "", separators: "[\\s:]", replacement: new)
66 }
67}
68
69/// Rename TODO Keyword: a keyword renamed where it is a keyword, in heading keyword position
70/// and in `#+TODO`, `#+SEQ_TODO` and `#+TYP_TODO` lines, with the heading's tags realigned;
71/// never in other text. A name already there merges; a rename across done and not-done states
72/// is refused.
73public enum KeywordRename {
74 /// A keyword is a word without parentheses or a bar, which `#+TODO` syntax gives meaning.
75 public static func isValidName(_ name: String) -> Bool {
76 !name.isEmpty && name != "|" && !name.contains { $0.isWhitespace || $0 == "(" || $0 == ")" }
77 }
78
79 /// Whether `old` and `new` are both keywords under `settings`, one a done state and the
80 /// other not.
81 public static func crossesStates(_ settings: OrgSettings, from old: String, to new: String) -> Bool {
82 let names = settings.todoKeywordNames
83 return names.contains(old) && names.contains(new) && settings.isDone(old) != settings.isDone(new)
84 }
85
86 /// Where a file's keyword is defined.
87 public enum Source: Sendable, Equatable {
88 /// The file's own `#+TODO` lines.
89 case file
90 /// A `#+SETUPFILE` it names.
91 case setupFile
92 /// No TODO lines: the keywords for files without them (`org-todo-keywords`).
93 case defaults
94 /// It isn't a keyword in the file.
95 case none
96 }
97
98 public static func source(of keyword: String, in tree: OrgTree) -> Source {
99 let keys: Set<String> = ["TODO", "SEQ_TODO", "TYP_TODO"]
100 func names(_ value: Substring) -> [String] { SettingsScanner.todoSequence(value, kind: .sequence).map { ($0.active + $0.done).map(\.name) } ?? [] }
101 let text = tree.text as NSString
102 let lines = LineStarts(text)
103 for node in tree.root.descendants() where node.kind == .keyword {
104 guard let (key, _, line) = keywordLine(node, lines), keys.contains(key.name) else { continue }
105 if names(line[key.value]).contains(keyword) { return .file }
106 }
107 for (key, value) in SetupFile.keywords(tree.settings.setupKeywords) where keys.contains(key) && names(value).contains(keyword) {
108 return .setupFile
109 }
110 return tree.settings.todoKeywordNames.contains(keyword) ? .defaults : .none
111 }
112
113 /// The changes renaming `old` to `new` in `text`: the TODO keyword lines, and with
114 /// `headings` the headings' keywords.
115 public static func changes(in text: String, tree: OrgTree, from old: String, to new: String, headings: Bool, options: EditingOptions, skipping: [Range<Int>] = []) -> [ProposedChange] {
116 let ns = text as NSString
117 let lines = LineStarts(ns)
118 var edits: [(edit: TextEdit, shown: TextEdit)] = []
119 for node in tree.root.descendants() {
120 switch node.kind {
121 case .heading where headings:
122 guard let token = node.tokens.first(where: { $0.kind == .todoKeyword }), token.text == old else { continue }
123 let content = lines.content(ofLine: lines.line(of: node.range.lowerBound))
124 let line = ns.substring(with: NSRange(content))
125 let at = NSRange(location: token.range.lowerBound - content.lowerBound, length: token.range.count)
126 var buffer = LineBuffer((line as NSString).replacingCharacters(in: at, with: new), caret: nil)
127 // `org-todo` realigns the tags after the keyword changed the title's width.
128 if node.tokens.contains(where: { $0.kind == .tags }) { alignTags(&buffer, options: options) }
129 if let edit = LineStarts.edit(lineStart: content.lowerBound, from: line, to: buffer.string) {
130 edits.append((edit, TextEdit(range: token.range, replacement: new)))
131 }
132 case .keyword:
133 guard let (key, content, line) = keywordLine(node, lines), ["TODO", "SEQ_TODO", "TYP_TODO"].contains(key.name),
134 let renamed = renamedTodoValue(String(line[key.value]), from: old, to: new) else { continue }
135 let newLine = String(line[..<key.value.lowerBound]) + renamed
136 if let edit = LineStarts.edit(lineStart: content.lowerBound, from: line, to: newLine) { edits.append((edit, lines.wholeWords(edit))) }
137 default:
138 break
139 }
140 }
141 return edits.filter { !EncryptedText.overlaps($0.edit.range, skipping) }.enumerated().map { lines.change(id: $0.offset, $0.element.edit, shown: $0.element.shown) }
142 }
143
144 /// `org-todo-keywords` in `#+TODO` syntax, a sequence a line, with `old` renamed; nil when
145 /// none names it.
146 public static func renamedTodoKeywords(_ lines: String, from old: String, to new: String) -> String? {
147 renamedLines(lines) { renamedTodoValue($0, from: old, to: new) }
148 }
149
150 /// A `#+TODO` value with the keyword `old` renamed, keeping its key and logging flags, or
151 /// removed when `new` is there already; nil when it doesn't name `old`.
152 static func renamedTodoValue(_ value: String, from old: String, to new: String) -> String? {
153 func token(_ name: String) -> String { "(?<!\\S)" + NSRegularExpression.escapedPattern(for: name) + "(?=\\(|\\s|$)" }
154 return renamedValue(value, old: token(old), new: token(new), key: "(?:\\([^)]*\\))?", separators: "\\s", replacement: new)
155 }
156}
157
158/// A keyword line's name, upper-cased, and where its value starts in the line.
159struct KeywordLine {
160 let name: String
161 let value: Range<String.Index>
162}
163
164/// The keyword node's line, its range in the text, and its name and value.
165func keywordLine(_ node: SyntaxNode, _ lines: LineStarts) -> (KeywordLine, Range<Int>, String)? {
166 let content = lines.content(ofLine: lines.line(of: node.range.lowerBound))
167 let line = lines.text.substring(with: NSRange(content))
168 guard let match = line.firstMatch(of: /^[ \t]*#\+([^:\s]+):/) else { return nil }
169 return (KeywordLine(name: match.1.uppercased(), value: match.range.upperBound..<line.endIndex), content, line)
170}
171
172/// `value` with the token `old` (a pattern) and its `key` suffix renamed to `replacement`, or,
173/// when the token `new` is in it too, removed with the separators on one side of it. Nil when
174/// `old` isn't in it.
175private func renamedValue(_ value: String, old: String, new: String, key: String, separators: String, replacement: String) -> String? {
176 guard let oldRegex = try? NSRegularExpression(pattern: old), let newRegex = try? NSRegularExpression(pattern: new) else { return nil }
177 let ns = value as NSString
178 let whole = NSRange(location: 0, length: ns.length)
179 guard oldRegex.firstMatch(in: value, range: whole) != nil else { return nil }
180 if newRegex.firstMatch(in: value, range: whole) == nil {
181 return oldRegex.stringByReplacingMatches(in: value, range: whole, withTemplate: NSRegularExpression.escapedTemplate(for: replacement))
182 }
183 // Merging: the separators after the token go with it, else those before it.
184 guard let withKey = try? NSRegularExpression(pattern: "(" + old + key + ")(" + separators + "+)?") else { return nil }
185 var result = value
186 while let match = withKey.firstMatch(in: result, range: NSRange(location: 0, length: (result as NSString).length)) {
187 var range = match.range
188 if match.range(at: 2).location == NSNotFound {
189 let text = result as NSString
190 var start = range.location
191 while start > 0, let scalar = Unicode.Scalar(text.character(at: start - 1)),
192 String(scalar).range(of: "^" + separators + "$", options: .regularExpression) != nil { start -= 1 }
193 range = NSRange(location: start, length: NSMaxRange(range) - start)
194 }
195 result = (result as NSString).replacingCharacters(in: range, with: "")
196 }
197 return result
198}
199
200/// `text`'s lines, each through `rename`; nil when it renamed none.
201private func renamedLines(_ text: String, _ rename: (String) -> String?) -> String? {
202 var changed = false
203 let lines = text.components(separatedBy: "\n").map { line -> String in
204 guard let renamed = rename(line) else { return line }
205 changed = true
206 return renamed
207 }
208 return changed ? lines.joined(separator: "\n") : nil
209}
Sources/OrgCore/Replace/TextReplace.swift added +157 · view
@@ -0,0 +1,157 @@
1import Foundation
2
3/// A replace across files: plain text or a regexp in the dialect of the editor's find bar and
4/// `:s` (ICU, as `NSRegularExpression` reads it, `^` and `$` at line ends), with Emacs's case
5/// rules. `case-fold-search` folds case unless the pattern has an upper-case letter
6/// (`search-upper-case`); while it folds, `case-replace` makes the replacement follow the
7/// case of each match as `replace-match` does.
8public struct TextReplace: Sendable, Equatable {
9 public var pattern: String
10 /// Literal for plain text. For a regexp, `\N` or `$N` is group N, `\&` or `$0` the whole
11 /// match, `\\` a backslash and `\$` a dollar sign.
12 public var replacement: String
13 public var isRegexp: Bool
14 /// `case-fold-search`.
15 public var caseFold: Bool
16 /// `case-replace`.
17 public var caseReplace: Bool
18
19 public init(pattern: String, replacement: String, isRegexp: Bool = false, caseFold: Bool = true, caseReplace: Bool = true) {
20 self.pattern = pattern
21 self.replacement = replacement
22 self.isRegexp = isRegexp
23 self.caseFold = caseFold
24 self.caseReplace = caseReplace
25 }
26
27 public enum InvalidPattern: Error, Equatable {
28 case empty
29 /// ICU can't compile it.
30 case invalid
31 }
32
33 /// Whether matching ignores case: `case-fold-search` on and no upper-case letter in the
34 /// pattern.
35 public var foldsCase: Bool { caseFold && !Self.hasUpperCase(pattern, regexp: isRegexp) }
36
37 /// The pattern compiled, or why it can't be.
38 public func regex() throws -> NSRegularExpression {
39 guard !pattern.isEmpty else { throw InvalidPattern.empty }
40 var options: NSRegularExpression.Options = [.anchorsMatchLines]
41 if foldsCase { options.insert(.caseInsensitive) }
42 do {
43 return try NSRegularExpression(pattern: isRegexp ? pattern : NSRegularExpression.escapedPattern(for: pattern), options: options)
44 } catch {
45 throw InvalidPattern.invalid
46 }
47 }
48
49 /// Every match in `text` outside `skipping`, as changes. `regex` is `regex()`, compiled
50 /// once for many files.
51 public func changes(in text: String, skipping: [Range<Int>] = [], regex: NSRegularExpression? = nil) throws -> [ProposedChange] {
52 let regex = try regex ?? self.regex()
53 let ns = text as NSString
54 let lines = LineStarts(ns)
55 let casifies = caseReplace && foldsCase
56 var changes: [ProposedChange] = []
57 for match in regex.matches(in: text, range: NSRange(location: 0, length: ns.length)) {
58 let range = match.range.location..<NSMaxRange(match.range)
59 guard !EncryptedText.overlaps(range, skipping) else { continue }
60 var new = isRegexp ? Self.expand(replacement, match: match, in: ns) : replacement
61 if casifies { new = Self.casified(new, like: ns.substring(with: match.range)) }
62 changes.append(lines.change(id: changes.count, TextEdit(range: range, replacement: new)))
63 }
64 return changes
65 }
66
67 /// `isearch-no-upper-case-p` negated: whether `pattern` has an upper-case letter, not
68 /// counting, in a regexp, a letter after a backslash or in `[:class:]` and `\p{…}`.
69 static func hasUpperCase(_ pattern: String, regexp: Bool) -> Bool {
70 guard regexp else { return pattern.contains { $0.isUppercase } }
71 var stripped = pattern.replacingOccurrences(of: "\\[:[a-z]+:\\]", with: "", options: .regularExpression)
72 stripped = stripped.replacingOccurrences(of: "\\\\[pP]\\{[^}]*\\}", with: "", options: .regularExpression)
73 var escaped = false
74 for character in stripped {
75 if escaped {
76 escaped = false
77 continue
78 }
79 if character == "\\" {
80 escaped = true
81 continue
82 }
83 if character.isUppercase { return true }
84 }
85 return false
86 }
87
88 /// `template` with the match's groups in place of `\N`, `$N`, `\&`.
89 static func expand(_ template: String, match: NSTextCheckingResult, in ns: NSString) -> String {
90 func group(_ n: Int) -> String {
91 guard n < match.numberOfRanges else { return "" }
92 let range = match.range(at: n)
93 return range.location == NSNotFound ? "" : ns.substring(with: range)
94 }
95 var result = ""
96 var characters = template[...]
97 while let c = characters.popFirst() {
98 if c == "\\" || c == "$", let next = characters.first {
99 if let digit = next.wholeNumberValue, next.isASCII {
100 characters.removeFirst()
101 result += group(digit)
102 continue
103 }
104 if c == "\\", next == "&" {
105 characters.removeFirst()
106 result += group(0)
107 continue
108 }
109 if c == "\\", next == "\\" || next == "$" {
110 characters.removeFirst()
111 result.append(next)
112 continue
113 }
114 }
115 result.append(c)
116 }
117 return result
118 }
119
120 /// `replace-match`'s case conversion: `new` in capitals when `matched` is in capitals
121 /// with a word of two or more letters (or is one capital letter), with each word's
122 /// initial capitalized when every word of `matched` starts with a capital, else as it is.
123 static func casified(_ new: String, like matched: String) -> String {
124 var someMultiletterWord = false, someLowercase = false, someUppercase = false, someNonuppercaseInitial = false
125 var previous: Character = "\n"
126 for c in matched {
127 if c.isLowercase {
128 someLowercase = true
129 if isWord(previous) { someMultiletterWord = true } else { someNonuppercaseInitial = true }
130 } else if c.isUppercase {
131 someUppercase = true
132 if isWord(previous) { someMultiletterWord = true }
133 } else if !isWord(previous), isWord(c) {
134 someNonuppercaseInitial = true
135 }
136 previous = c
137 }
138 if !someLowercase, someMultiletterWord { return new.uppercased() }
139 if !someNonuppercaseInitial, someMultiletterWord { return upcaseInitials(new) }
140 if !someNonuppercaseInitial, someUppercase { return new.uppercased() }
141 return new
142 }
143
144 /// Word constituents in Org mode's syntax table: letters and digits.
145 private static func isWord(_ c: Character) -> Bool { c.isLetter || c.isNumber }
146
147 /// `upcase-initials`: the first letter of each word in capitals, the rest as it is.
148 private static func upcaseInitials(_ text: String) -> String {
149 var result = ""
150 var previous: Character = "\n"
151 for c in text {
152 result += !isWord(previous) && c.isLetter ? c.uppercased() : String(c)
153 previous = c
154 }
155 return result
156 }
157}
Sources/OrgEditorAppKit/EditorCommands.swift +3 · view
@@ -65,6 +65,9 @@ public enum EditorCommands {
65 EditorCommand(id: "org.snippet.next-field", title: "Next Snippet Field", action: .view), 65 EditorCommand(id: "org.snippet.next-field", title: "Next Snippet Field", action: .view),
66 EditorCommand(id: "org.snippet.previous-field", title: "Previous Snippet Field", action: .view), 66 EditorCommand(id: "org.snippet.previous-field", title: "Previous Snippet Field", action: .view),
67 EditorCommand(id: "app.new-file-from-template", title: "New File from Template…", action: .app), 67 EditorCommand(id: "app.new-file-from-template", title: "New File from Template…", action: .app),
68 EditorCommand(id: "app.replace-in-files", title: "Replace in Files…", action: .app),
69 EditorCommand(id: "app.rename-tag", title: "Rename Tag…", action: .app),
70 EditorCommand(id: "app.rename-todo-keyword", title: "Rename TODO Keyword…", action: .app),
68 EditorCommand(id: "editor.toggle-spell-check", title: "Check Spelling While Typing", action: .view), 71 EditorCommand(id: "editor.toggle-spell-check", title: "Check Spelling While Typing", action: .view),
69 EditorCommand(id: "editor.toggle-truncate-lines", title: "Truncate or Wrap Long Lines", action: .view), 72 EditorCommand(id: "editor.toggle-truncate-lines", title: "Truncate or Wrap Long Lines", action: .view),
70 EditorCommand(id: "editor.toggle-auto-fill", title: "Turn Auto Fill On or Off", action: .view), 73 EditorCommand(id: "editor.toggle-auto-fill", title: "Turn Auto Fill On or Off", action: .view),
Sources/Orgstar/ContentView.swift +19 · view
@@ -124,6 +124,8 @@ struct ContentView: View {
124 @State private var plainOutlineShown = false 124 @State private var plainOutlineShown = false
125 @State private var showingImport = false 125 @State private var showingImport = false
126 @State private var showingTemplate = false 126 @State private var showingTemplate = false
127 /// Replace in Files, Rename Tag or Rename TODO Keyword, with the text to start from.
128 @State private var replacing: (kind: ReplaceKind, initial: String)?
127 @AppStorage("showTabBar") private var showTabBar = false 129 @AppStorage("showTabBar") private var showTabBar = false
128 /// This window's panes. 130 /// This window's panes.
129 @State private var window: WindowModel? 131 @State private var window: WindowModel?
@@ -400,6 +402,9 @@ struct ContentView: View {
400 .sheet(isPresented: $showingTemplate) { 402 .sheet(isPresented: $showingTemplate) {
401 TemplateSheet(workspace: workspace, folder: session.path.map { ($0 as NSString).deletingLastPathComponent }) { selectedFile = $0 } 403 TemplateSheet(workspace: workspace, folder: session.path.map { ($0 as NSString).deletingLastPathComponent }) { selectedFile = $0 }
402 } 404 }
405 .sheet(item: Binding(get: { replacing?.kind }, set: { if $0 == nil { replacing = nil } })) { kind in
406 ReplaceInFilesSheet(kind: kind, workspace: workspace, session: session, initial: replacing?.initial ?? "") { commands.show($0) }
407 }
403 .sheet(item: $panel) { panel in panelView(panel) } 408 .sheet(item: $panel) { panel in panelView(panel) }
404 .sheet(item: Bindable(ProAccess.shared).paywall) { feature in 409 .sheet(item: Bindable(ProAccess.shared).paywall) { feature in
405 #if APPSTORE 410 #if APPSTORE
@@ -986,6 +991,18 @@ struct ContentView: View {
986 } 991 }
987 } 992 }
988 993
994 /// What Replace in Files starts with (the selection on one line) or a rename (the tag or
995 /// keyword at the caret).
996 private func replaceInitial(for kind: ReplaceKind) -> String {
997 guard let editor = commands.editor else { return "" }
998 let context = editor.context()
999 if kind == .replace {
1000 let selected = context.selection.first.map { (context.text as NSString).substring(with: NSRange($0)) } ?? ""
1001 return selected.contains("\n") ? "" : selected
1002 }
1003 return kind.initial(text: context.text, caret: context.caret, keywords: context.tree.settings.todoKeywordNames)
1004 }
1005
989 /// `new` in place of the buffer's text, as one edit, with the caret at `caret` or where it was. 1006 /// `new` in place of the buffer's text, as one edit, with the caret at `caret` or where it was.
990 private func applyText(_ new: String, caret: Int? = nil) { 1007 private func applyText(_ new: String, caret: Int? = nil) {
991 guard let editor = commands.editor else { return } 1008 guard let editor = commands.editor else { return }
@@ -1340,6 +1357,8 @@ struct ContentView: View {
1340 case "app.toggle-line-numbers": showLineNumbers.toggle() 1357 case "app.toggle-line-numbers": showLineNumbers.toggle()
1341 case "app.import-emacs": showingImport = true 1358 case "app.import-emacs": showingImport = true
1342 case "app.new-file-from-template": showingTemplate = true 1359 case "app.new-file-from-template": showingTemplate = true
1360 case "app.replace-in-files", "app.rename-tag", "app.rename-todo-keyword":
1361 replacing = ReplaceKind(command: id).map { ($0, replaceInitial(for: $0)) }
1343 case "app.edit-config": commands.jump(path: UserConfig.configFile.path, offset: 0) 1362 case "app.edit-config": commands.jump(path: UserConfig.configFile.path, offset: 0)
1344 case "app.quick-open": commands.showingQuickOpen = true 1363 case "app.quick-open": commands.showingQuickOpen = true
1345 case "app.palette": commands.showingPalette = true 1364 case "app.palette": commands.showingPalette = true
Sources/Orgstar/DevelopmentHooks.swift +2 −1 · view
@@ -9,7 +9,8 @@ import OrgEditorAppKit
9/// - `ORGSTAR_WINDOW`: a window to open at launch (`agenda`, `settings`); the snapshot renders it. 9/// - `ORGSTAR_WINDOW`: a window to open at launch (`agenda`, `settings`); the snapshot renders it.
10/// - `ORGSTAR_COMMAND`: commands to run at launch, separated by commas (`app.import-emacs`); a 10/// - `ORGSTAR_COMMAND`: commands to run at launch, separated by commas (`app.import-emacs`); a
11/// sheet or prompt they open is what the snapshot renders. 11/// sheet or prompt they open is what the snapshot renders.
12/// - `ORGSTAR_ANSWERS`: answers to the prompts those commands ask, in order, separated by commas. 12/// - `ORGSTAR_ANSWERS`: answers to the prompts those commands ask, in order, separated by commas;
13/// for Replace in Files and the renames, the two names, then the search runs.
13/// - `ORGSTAR_URL`: an `org-protocol://` link to handle at launch, as if opened from a browser. 14/// - `ORGSTAR_URL`: an `org-protocol://` link to handle at launch, as if opened from a browser.
14/// - `ORGSTAR_PASTEBOARD`: the name of a pasteboard to paste images and files from, instead of 15/// - `ORGSTAR_PASTEBOARD`: the name of a pasteboard to paste images and files from, instead of
15/// the clipboard. 16/// the clipboard.
Sources/Orgstar/OrgstarApp.swift +4 −1 · view
@@ -643,7 +643,7 @@ struct OrgMenuItems: View {
643 static let groups: [(title: LocalizedStringKey, prefixes: [String])] = [ 643 static let groups: [(title: LocalizedStringKey, prefixes: [String])] = [
644 ("Visibility", ["org.cycle", "org.fold.", "org.narrow.", "org.widen", "org.sparse-tree", "org.toggle-inline-images", "org.latex-preview"]), 644 ("Visibility", ["org.cycle", "org.fold.", "org.narrow.", "org.widen", "org.sparse-tree", "org.toggle-inline-images", "org.latex-preview"]),
645 ("Headings", ["org.heading.", "org.subtree.", "org.element.", "org.goto", "org.sort", "org.archive.", "app.refile", "app.archive"]), 645 ("Headings", ["org.heading.", "org.subtree.", "org.element.", "org.goto", "org.sort", "org.archive.", "app.refile", "app.archive"]),
646 ("TODO and Tags", ["org.todo.", "org.priority.", "org.tags.", "org.effort."]), 646 ("TODO and Tags", ["org.todo.", "org.priority.", "org.tags.", "org.effort.", "app.rename-"]),
647 ("Properties and Columns", ["org.property.", "org.columns", "org.drawer."]), 647 ("Properties and Columns", ["org.property.", "org.columns", "org.drawer."]),
648 ("Dates and Timers", ["org.schedule", "org.deadline", "org.timestamp.", "org.timer."]), 648 ("Dates and Timers", ["org.schedule", "org.deadline", "org.timestamp.", "org.timer."]),
649 ("Lists", ["org.item.", "org.checkbox."]), 649 ("Lists", ["org.item.", "org.checkbox."]),
@@ -751,6 +751,9 @@ struct FindMenu: View {
751 item("Find Next", "edit.find-next", "g") 751 item("Find Next", "edit.find-next", "g")
752 item("Find Previous", "edit.find-previous", "g", [.command, .shift]) 752 item("Find Previous", "edit.find-previous", "g", [.command, .shift])
753 item("Use Selection for Find", "edit.use-selection-for-find", "e") 753 item("Use Selection for Find", "edit.use-selection-for-find", "e")
754 Divider()
755 Button("Replace in Files…") { commands.run("app.replace-in-files") }
756 .keyboardShortcut("f", modifiers: [.command, .option, .shift])
754 } 757 }
755 } 758 }
756 759
Sources/Orgstar/ReplaceInFilesSheet.swift added +173 · view
@@ -0,0 +1,173 @@
1import OrgApp
2import OrgCore
3import SwiftUI
4
5/// Edit ▸ Find ▸ Replace in Files…, Org ▸ TODO and Tags ▸ Rename Tag… and Rename TODO Keyword…:
6/// what to look for and where, then every change by file and line to untick, then apply.
7struct ReplaceInFilesSheet: View {
8 let kind: ReplaceKind
9 let workspace: WorkspaceModel
10 let session: DocumentSession
11 /// Called with what was done, after applying.
12 let done: (String) -> Void
13 @State private var model: ReplaceInFiles
14 @State private var find = ""
15 @State private var replacement = ""
16 @AppStorage("replaceRegexp") private var regexp = false
17 @AppStorage("replaceCaseFold") private var caseFold = true
18 @AppStorage("replaceCaseReplace") private var caseReplace = true
19 @State private var includeConfig = true
20 /// A root's path, or empty for every folder.
21 @State private var scope = ""
22 @Environment(\.orgTheme) private var theme
23 @Environment(\.dismiss) private var dismiss
24
25 init(kind: ReplaceKind, workspace: WorkspaceModel, session: DocumentSession, initial: String = "", done: @escaping (String) -> Void) {
26 self.kind = kind
27 self.workspace = workspace
28 self.session = session
29 self.done = done
30 _model = State(initialValue: ReplaceInFiles(session: session, workspace: workspace))
31 _find = State(initialValue: initial)
32 }
33
34 var body: some View {
35 VStack(alignment: .leading, spacing: 12) {
36 Text(kind.title).font(.headline)
37 form
38 Divider()
39 results
40 HStack {
41 Text(summary).foregroundStyle(.secondary)
42 Spacer()
43 Button("Close") { model.cancel(); dismiss() }
44 .keyboardShortcut(.cancelAction)
45 Button(kind.applyTitle) {
46 done(model.apply())
47 dismiss()
48 }
49 .disabled(model.isSearching || (model.tickedCount == 0 && !(model.configChange != nil && model.changesConfig)))
50 }
51 }
52 .padding()
53 .frame(minWidth: 640, idealWidth: 760, minHeight: 460, idealHeight: 560)
54 // Which headings a keyword rename changes depends on it, so the search runs again.
55 .onChange(of: includeConfig) { if model.mode != nil, !find.isEmpty { search() } }
56 #if !APPSTORE
57 .onAppear {
58 // Scripted runs answer the two fields and search, for the snapshot.
59 let answers = DevelopmentHooks.answers
60 guard answers.count >= 2 else { return }
61 find = answers[0]
62 replacement = answers[1]
63 search()
64 }
65 #endif
66 }
67
68 @ViewBuilder
69 private var form: some View {
70 Form {
71 switch kind {
72 case .replace:
73 TextField("Find:", text: $find, prompt: regexp ? Text("Regular expression") : Text("Text"))
74 TextField("Replace with:", text: $replacement, prompt: regexp ? Text("\\1 or $1 for a group") : Text("Text"))
75 VStack(alignment: .leading, spacing: 4) {
76 Toggle("Regular expression", isOn: $regexp)
77 Toggle("Ignore case when the search is lower case", isOn: $caseFold)
78 .help("case-fold-search: a search with an upper-case letter matches case exactly")
79 Toggle("Keep each match's case", isOn: $caseReplace)
80 .help("case-replace: FOO becomes BAR and Foo becomes Bar")
81 .disabled(!caseFold)
82 }
83 case .renameTag:
84 LabeledContent("Tag:") { nameField($find, suggestions: knownTags) }
85 TextField("New name:", text: $replacement)
86 Toggle("Also rename it in org-tag-alist in config.toml", isOn: $includeConfig)
87 case .renameKeyword:
88 LabeledContent("Keyword:") { nameField($find, suggestions: knownKeywords) }
89 TextField("New name:", text: $replacement)
90 Toggle("Also rename it in org-todo-keywords in config.toml", isOn: $includeConfig)
91 }
92 HStack {
93 Picker("In:", selection: $scope) {
94 Text("All Folders").tag("")
95 ForEach(workspace.rootPaths, id: \.self) { root in
96 Text(verbatim: (root as NSString).lastPathComponent).tag(root)
97 }
98 }
99 .fixedSize()
100 Spacer()
101 if model.isSearching {
102 ProgressView(value: Double(model.progress.done), total: Double(max(1, model.progress.total)))
103 .frame(width: 160)
104 Button("Stop") { model.cancel() }
105 } else {
106 Button("Find") { search() }
107 .keyboardShortcut(.defaultAction)
108 .disabled(find.isEmpty || (kind != .replace && replacement.isEmpty))
109 }
110 }
111 }
112 }
113
114 @ViewBuilder
115 private var results: some View {
116 if let problem = model.problem {
117 ContentUnavailableView(problem, systemImage: "exclamationmark.triangle")
118 .frame(maxHeight: .infinity)
119 } else if model.files.isEmpty && !(model.configChange != nil && model.changesConfig) {
120 if model.mode == nil || model.isSearching {
121 Color.clear.frame(maxHeight: .infinity)
122 } else {
123 ContentUnavailableView(String(localized: "No Matches", comment: "Replace in Files: the search found nothing"), systemImage: "magnifyingglass")
124 .frame(maxHeight: .infinity)
125 }
126 } else {
127 ReplacePreview(model: model, removed: theme.color("todo") ?? .red, added: theme.color("done") ?? .green)
128 .frame(maxHeight: .infinity)
129 }
130 }
131
132 private var summary: String {
133 if model.isSearching {
134 return String(localized: "Searched \(model.progress.done) of \(model.progress.total) files", comment: "Replace in Files: progress")
135 }
136 guard model.mode != nil, model.problem == nil else { return "" }
137 let base = String(localized: "\(model.tickedCount) of \(model.changeCount) changes; files: \(model.files.count)", comment: "Replace in Files: what applying does")
138 return model.wasCancelled ? base + " · " + String(localized: "Stopped", comment: "Replace in Files: the search was stopped") : base
139 }
140
141 private func nameField(_ text: Binding<String>, suggestions: [String]) -> some View {
142 HStack(spacing: 4) {
143 TextField("", text: text).labelsHidden()
144 Menu {
145 ForEach(suggestions, id: \.self) { name in Button(name) { text.wrappedValue = name } }
146 } label: {
147 Image(systemName: "chevron.down")
148 }
149 .menuIndicator(.hidden)
150 .fixedSize()
151 .disabled(suggestions.isEmpty)
152 .accessibilityLabel(Text("Choose", comment: "Rename: menu of the existing names"))
153 }
154 }
155
156 private var knownTags: [String] { ((try? workspace.index.tags()) ?? []).sorted { $0.localizedStandardCompare($1) == .orderedAscending } }
157
158 private var knownKeywords: [String] {
159 var names: [String] = []
160 let sequences = session.defaults.todoSequences + (session.document?.tree.settings.todoSequences ?? [])
161 for name in sequences.flatMap({ ($0.active + $0.done).map(\.name) }) where !names.contains(name) { names.append(name) }
162 return names
163 }
164
165 private func search() {
166 let mode: ReplaceInFiles.Mode = switch kind {
167 case .replace: .replace(TextReplace(pattern: find, replacement: replacement, isRegexp: regexp, caseFold: caseFold, caseReplace: caseReplace))
168 case .renameTag: .renameTag(from: find.trimmingCharacters(in: .whitespaces), to: replacement.trimmingCharacters(in: .whitespaces))
169 case .renameKeyword: .renameKeyword(from: find.trimmingCharacters(in: .whitespaces), to: replacement.trimmingCharacters(in: .whitespaces))
170 }
171 model.start(mode, scope: scope.isEmpty ? nil : scope, includeConfig: includeConfig)
172 }
173}
Sources/Orgstar/VersionViews.swift +1 · view
@@ -218,6 +218,7 @@ struct HistorySheet: View {
218 case "external": "Disk version, replaced" 218 case "external": "Disk version, replaced"
219 case "sync-conflict": "Sync conflict copy" 219 case "sync-conflict": "Sync conflict copy"
220 case "snapshot": "Snapshot, before a save" 220 case "snapshot": "Snapshot, before a save"
221 case "replace": String(localized: "Before a change across files", comment: "Recovery version kept before Replace in Files or a rename changed the file")
221 default: label 222 default: label
222 } 223 }
223 } 224 }
Sources/OrgstarMobile/EditorScreen.swift +9 · view
@@ -92,6 +92,8 @@ struct EditorScreen: View {
92 case crypt(CryptRequest) 92 case crypt(CryptRequest)
93 case backlinks 93 case backlinks
94 case graph 94 case graph
95 /// Rename Tag or Rename TODO Keyword, starting from this name.
96 case rename(ReplaceKind, String)
95 /// The subtree at this offset, to export. 97 /// The subtree at this offset, to export.
96 case exportSubtree(Int) 98 case exportSubtree(Int)
97 99
@@ -109,6 +111,7 @@ struct EditorScreen: View {
109 case .crypt(let request): request.id.uuidString 111 case .crypt(let request): request.id.uuidString
110 case .backlinks: "backlinks" 112 case .backlinks: "backlinks"
111 case .graph: "graph" 113 case .graph: "graph"
114 case .rename(let kind, _): kind.rawValue
112 case .exportSubtree: "exportSubtree" 115 case .exportSubtree: "exportSubtree"
113 } 116 }
114 } 117 }
@@ -238,6 +241,8 @@ struct EditorScreen: View {
238 RoamGraphScreen(workspace: workspace, session: session, path: path, caret: editor?.editContext().caret ?? 0) { location in 241 RoamGraphScreen(workspace: workspace, session: session, path: path, caret: editor?.editContext().caret ?? 0) { location in
239 if location.path == path { editor?.reveal(location.start) } else { model.openRequest = .heading(location) } 242 if location.path == path { editor?.reveal(location.start) } else { model.openRequest = .heading(location) }
240 } 243 }
244 case .rename(let kind, let initial):
245 RenameScreen(kind: kind, workspace: workspace, session: session, initial: initial) { message = $0 }
241 } 246 }
242 } 247 }
243 .fileImporter(isPresented: $importingTable, allowedContentTypes: [.commaSeparatedText, .tabSeparatedText, .plainText]) { result in 248 .fileImporter(isPresented: $importingTable, allowedContentTypes: [.commaSeparatedText, .tabSeparatedText, .plainText]) { result in
@@ -503,6 +508,9 @@ struct EditorScreen: View {
503 roamActions.run(id) 508 roamActions.run(id)
504 } else if id == "app.backlinks" { 509 } else if id == "app.backlinks" {
505 sheet = .backlinks 510 sheet = .backlinks
511 } else if let kind = ReplaceKind(command: id), kind != .replace {
512 let context = self.editor?.editContext()
513 sheet = .rename(kind, context.map { kind.initial(text: $0.text, caret: $0.caret, keywords: $0.tree.settings.todoKeywordNames) } ?? "")
506 } else if id == "app.toggle-markup" { 514 } else if id == "app.toggle-markup" {
507 model.showMarkup.toggle() 515 model.showMarkup.toggle()
508 } else if MobileEditor.linkCommands.contains(id) { 516 } else if MobileEditor.linkCommands.contains(id) {
@@ -1050,6 +1058,7 @@ struct CommandPalette: View {
1050 ("app.table-export.tsv", "Export Table as TSV…"), ("app.plot", "Plot Table"), 1058 ("app.table-export.tsv", "Export Table as TSV…"), ("app.plot", "Plot Table"),
1051 ("app.crypt.encrypt-entry", "Encrypt Entry…"), ("app.crypt.open-entry", "Decrypt Entry…"), ("app.crypt.decrypt-entry", "Decrypt Entry in File…"), 1059 ("app.crypt.encrypt-entry", "Encrypt Entry…"), ("app.crypt.open-entry", "Decrypt Entry…"), ("app.crypt.decrypt-entry", "Decrypt Entry in File…"),
1052 ("app.crypt.encrypt-entries", "Encrypt Tagged Entries…"), ("app.crypt.forget-passphrase", "Forget Encryption Passphrase"), 1060 ("app.crypt.encrypt-entries", "Encrypt Tagged Entries…"), ("app.crypt.forget-passphrase", "Forget Encryption Passphrase"),
1061 ("app.rename-tag", "Rename Tag…"), ("app.rename-todo-keyword", "Rename TODO Keyword…"),
1053 ("app.backlinks", "Show Backlinks"), ("app.node.find", "Find Node…"), ("app.node.insert", "Insert Node Link…"), ("app.node.graph", "Show Node Graph"), 1062 ("app.backlinks", "Show Backlinks"), ("app.node.find", "Find Node…"), ("app.node.insert", "Insert Node Link…"), ("app.node.graph", "Show Node Graph"),
1054 ("app.node.rename-from-front-matter", "Rename Note from Front Matter"), 1063 ("app.node.rename-from-front-matter", "Rename Note from Front Matter"),
1055 ("app.node.rename", "Rename Note…"), 1064 ("app.node.rename", "Rename Note…"),
Sources/OrgstarMobile/MobileEditor.swift +2 −1 · view
@@ -505,7 +505,8 @@ final class MobileEditor: NSObject, DocumentBuffer {
505 case "app.crypt.encrypt-entry": return onAppCommand != nil && OrgCrypt.heading(context.text, at: context.caret) != nil && OrgCrypt.encryptedRange(context.text, at: context.caret) == nil 505 case "app.crypt.encrypt-entry": return onAppCommand != nil && OrgCrypt.heading(context.text, at: context.caret) != nil && OrgCrypt.encryptedRange(context.text, at: context.caret) == nil
506 case "app.crypt.open-entry", "app.crypt.decrypt-entry": return onAppCommand != nil && OrgCrypt.encryptedRange(context.text, at: context.caret) != nil 506 case "app.crypt.open-entry", "app.crypt.decrypt-entry": return onAppCommand != nil && OrgCrypt.encryptedRange(context.text, at: context.caret) != nil
507 case "app.table-export", "app.table-export.tsv", "app.plot": return onAppCommand != nil && ImportTable.exportText(context.text, at: context.caret, path: "") != nil 507 case "app.table-export", "app.table-export.tsv", "app.plot": return onAppCommand != nil && ImportTable.exportText(context.text, at: context.caret, path: "") != nil
508 case "app.word-count", "app.recovery", "app.sync-conflicts", "app.attach.photo", "app.attach.camera", "app.attach.scan": return onAppCommand != nil 508 case "app.word-count", "app.recovery", "app.sync-conflicts", "app.attach.photo", "app.attach.camera", "app.attach.scan",
509 "app.rename-tag", "app.rename-todo-keyword": return onAppCommand != nil
509 case _ where id.hasPrefix(NamedMacros.commandPrefix): return true 510 case _ where id.hasPrefix(NamedMacros.commandPrefix): return true
510 case "app.refile", "app.refile.copy", "app.archive": return onAppCommand != nil && Presentation.heading(containing: context.caret, in: context.tree) != nil 511 case "app.refile", "app.refile.copy", "app.archive": return onAppCommand != nil && Presentation.heading(containing: context.caret, in: context.tree) != nil
511 case "app.export-dialog", "app.export-subtree-dialog", "app.copy-rich-text", "app.export.html-open", "app.export-body-only", "app.export.icalendar-agenda", "app.export.icalendar-combined": return onAppCommand != nil 512 case "app.export-dialog", "app.export-subtree-dialog", "app.copy-rich-text", "app.export.html-open", "app.export-body-only", "app.export.icalendar-agenda", "app.export.icalendar-combined": return onAppCommand != nil
Sources/OrgstarMobile/RenameScreen.swift added +128 · view
@@ -0,0 +1,128 @@
1#if os(iOS)
2import OrgApp
3import OrgCore
4import SwiftUI
5
6/// Rename Tag… and Rename TODO Keyword… from Commands: the old and new name and where, then
7/// every change by file and line to untick, then Rename.
8struct RenameScreen: View {
9 let kind: ReplaceKind
10 let workspace: WorkspaceModel
11 let session: DocumentSession
12 let done: (String) -> Void
13 @State private var model: ReplaceInFiles?
14 @State private var old: String
15 @State private var new = ""
16 @State private var includeConfig = true
17 /// A root's path, or empty for every folder.
18 @State private var scope = ""
19 @Environment(MobileModel.self) private var app
20 @Environment(\.dismiss) private var dismiss
21
22 init(kind: ReplaceKind, workspace: WorkspaceModel, session: DocumentSession, initial: String, done: @escaping (String) -> Void) {
23 self.kind = kind
24 self.workspace = workspace
25 self.session = session
26 self.done = done
27 _old = State(initialValue: initial)
28 }
29
30 var body: some View {
31 NavigationStack {
32 VStack(spacing: 0) {
33 Form {
34 Section {
35 HStack {
36 TextField(kind == .renameTag ? LocalizedStringKey("Tag") : LocalizedStringKey("Keyword"), text: $old)
37 .textInputAutocapitalization(.never).autocorrectionDisabled()
38 Menu {
39 ForEach(suggestions, id: \.self) { name in Button(name) { old = name } }
40 } label: {
41 Image(systemName: "chevron.down.circle")
42 }
43 .disabled(suggestions.isEmpty)
44 .accessibilityLabel(Text("Choose", comment: "Rename: menu of the existing names"))
45 }
46 TextField("New name", text: $new)
47 .textInputAutocapitalization(.never).autocorrectionDisabled()
48 Picker("In", selection: $scope) {
49 Text("All Folders").tag("")
50 ForEach(workspace.rootPaths, id: \.self) { root in
51 Text(verbatim: (root as NSString).lastPathComponent).tag(root)
52 }
53 }
54 Toggle(kind == .renameTag ? LocalizedStringKey("Also rename it in org-tag-alist in config.toml")
55 : LocalizedStringKey("Also rename it in org-todo-keywords in config.toml"), isOn: $includeConfig)
56 }
57 Section {
58 if let model, model.isSearching {
59 HStack {
60 ProgressView(value: Double(model.progress.done), total: Double(max(1, model.progress.total)))
61 Button("Stop") { model.cancel() }
62 }
63 } else {
64 Button("Find") { search() }
65 .disabled(old.isEmpty || new.isEmpty)
66 }
67 if let model, let text = summary(model) {
68 Text(text).foregroundStyle(model.problem == nil ? .secondary : .primary)
69 }
70 }
71 }
72 .frame(maxHeight: model?.files.isEmpty == false ? 330 : .infinity)
73 if let model, !model.files.isEmpty || (model.configChange != nil && model.changesConfig) {
74 ReplacePreview(model: model)
75 }
76 }
77 .navigationTitle(kind.title)
78 .navigationBarTitleDisplayMode(.inline)
79 .toolbar {
80 ToolbarItem(placement: .cancellationAction) {
81 Button("Cancel") {
82 model?.cancel()
83 dismiss()
84 }
85 }
86 ToolbarItem(placement: .confirmationAction) {
87 Button(kind.applyTitle) {
88 if let model { done(model.apply()) }
89 dismiss()
90 }
91 .disabled(model.map { $0.isSearching || ($0.tickedCount == 0 && !($0.configChange != nil && $0.changesConfig)) } ?? true)
92 }
93 }
94 .onChange(of: includeConfig) { if model?.mode != nil { search() } }
95 }
96 }
97
98 private var suggestions: [String] {
99 switch kind {
100 case .renameTag: ((try? workspace.index.tags()) ?? []).sorted { $0.localizedStandardCompare($1) == .orderedAscending }
101 default:
102 session.defaults.todoSequences.flatMap { ($0.active + $0.done).map(\.name) }.reduce(into: [String]()) { if !$0.contains($1) { $0.append($1) } }
103 }
104 }
105
106 private func summary(_ model: ReplaceInFiles) -> String? {
107 if let problem = model.problem { return problem }
108 guard model.mode != nil, !model.isSearching else { return nil }
109 if model.files.isEmpty, model.configChange == nil { return String(localized: "No Matches", comment: "Replace in Files: the search found nothing") }
110 return String(localized: "\(model.tickedCount) of \(model.changeCount) changes; files: \(model.files.count)", comment: "Replace in Files: what applying does")
111 }
112
113 private func search() {
114 let model = self.model ?? ReplaceInFiles(session: session, workspace: workspace, config: config)
115 self.model = model
116 let from = old.trimmingCharacters(in: .whitespaces), to = new.trimmingCharacters(in: .whitespaces)
117 model.start(kind == .renameTag ? .renameTag(from: from, to: to) : .renameKeyword(from: from, to: to), scope: scope.isEmpty ? nil : scope, includeConfig: includeConfig)
118 }
119
120 /// config.toml through the app's settings, which write the synced folder's file.
121 private var config: ReplaceInFiles.Config {
122 var config = ReplaceInFiles.Config.standard
123 let app = app
124 config.set = { key, value in app.set(key, to: .string(value)) }
125 return config
126 }
127}
128#endif
Sources/OrgstarMobile/VersionScreens.swift +1 · view
@@ -145,6 +145,7 @@ struct RecoverySheet: View {
145 case "external": "Disk version, replaced" 145 case "external": "Disk version, replaced"
146 case "sync-conflict": "Sync conflict copy" 146 case "sync-conflict": "Sync conflict copy"
147 case "snapshot": "Snapshot, before a save" 147 case "snapshot": "Snapshot, before a save"
148 case "replace": String(localized: "Before a change across files", comment: "Recovery version kept before Replace in Files or a rename changed the file")
148 default: label 149 default: label
149 } 150 }
150 } 151 }
Tests/OrgAppTests/ReplaceInFilesTests.swift added +192 · view
@@ -0,0 +1,192 @@
1import Foundation
2import OrgCore
3import OrgDocument
4import Testing
5@testable import OrgApp
6
7/// Replace in Files and the renames over a folder: files on disk and open buffers, unticked
8/// changes, recovery versions, config.toml, refusals and cancelling.
9@MainActor
10struct ReplaceInFilesTests {
11 let notes: Folder
12 let other: Folder
13 let recovery: Folder
14 let workspace: WorkspaceModel
15 let session: DocumentSession
16 /// config.toml's settings as `Config.set` leaves them.
17 final class ConfigBox {
18 var todoKeywords = "TODO NEXT | DONE"
19 var tagAlist = "work(w) home"
20 var writes: [String: String] = [:]
21 }
22 let config = ConfigBox()
23
24 init() async throws {
25 notes = try Folder()
26 other = try Folder()
27 recovery = try Folder()
28 workspace = try WorkspaceModel(directory: nil)
29 session = DocumentSession(recovery: FileRecoveryStore(directory: recovery.url))
30 session.saveMode = .explicit
31 }
32
33 func model() -> ReplaceInFiles {
34 let box = config
35 return ReplaceInFiles(session: session, workspace: workspace, config: ReplaceInFiles.Config(todoKeywords: box.todoKeywords, tagAlist: box.tagAlist) { key, value in
36 box.writes[key] = value
37 })
38 }
39
40 /// The indexed path of `name` in `folder`.
41 func path(_ name: String, in folder: Folder? = nil) throws -> String {
42 let root = (folder ?? notes).url.lastPathComponent
43 return try #require(workspace.files.first { $0.path.hasSuffix(root + "/" + name) }?.path)
44 }
45
46 func disk(_ path: String) throws -> String { try String(contentsOfFile: path, encoding: .utf8) }
47
48 func search(_ model: ReplaceInFiles, _ mode: ReplaceInFiles.Mode, scope: String? = nil, includeConfig: Bool = true) async {
49 model.start(mode, scope: scope, includeConfig: includeConfig)
50 await model.waitForSearch()
51 }
52
53 @Test func replacesInFilesAndOpenBuffers() async throws {
54 try notes.write("a.org", "* foo\nFoo and foo\n")
55 try notes.write("b.org", "foo\n")
56 try notes.write("c.txt", "foo\n")
57 try notes.write("d.png", "foo\n")
58 try notes.write("s.org.gpg", "foo\n")
59 try notes.write("none.org", "nothing here\n")
60 try other.write("e.org", "foo\n")
61 try await workspace.addRoot(notes.url)
62 try await workspace.addRoot(other.url)
63 let a = try path("a.org"), b = try path("b.org"), c = try path("c.txt"), e = try path("e.org", in: other)
64
65 // b.org is open with an unsaved edit, which the search sees.
66 session.open(b)
67 let doc = try #require(session.document(of: b))
68 _ = session.perform(PrecomputedEdit(EditResult(baseRevision: doc.revision, edits: [TextEdit(range: 0..<0, replacement: "typed foo\n")])), path: b, at: 0, expect: nil)
69 #expect(session.isDirty)
70
71 let model = model()
72 await search(model, .replace(TextReplace(pattern: "foo", replacement: "bar")), scope: workspace.files.first { $0.path == a }?.root)
73 #expect(model.progress.done == model.progress.total)
74 #expect(model.files.map(\.path) == [a, b, c])
75 #expect(model.files[0].changes.map(\.line) == [1, 2, 2])
76 #expect(model.files[0].changes.map(\.replacement) == ["bar", "Bar", "bar"])
77 #expect(model.files[1].changes.count == 2)
78
79 // Untick the second change in a.org.
80 model.setTicked(false, change: 1, in: a)
81 #expect(model.tickedCount == 5)
82 let summary = model.apply()
83 #expect(summary == "Files changed: 3")
84 #expect(try disk(a) == "* bar\nFoo and bar\n")
85 #expect(try disk(c) == "bar\n")
86 #expect(try disk(e) == "foo\n")
87 #expect(try disk(notes.url.appendingPathComponent("s.org.gpg").path) == "foo\n")
88
89 // The open buffer took it as one undoable change and stays unsaved; the disk is as it was.
90 #expect(session.document(of: b)?.text == "typed bar\nbar\n")
91 #expect(session.isDirty)
92 #expect(try disk(b) == "foo\n")
93 var undone = try #require(session.document(of: b))
94 _ = undone.undo()
95 #expect(undone.text == "typed foo\nfoo\n")
96
97 // A file that wasn't open has its old text in recovery.
98 let store = FileRecoveryStore(directory: recovery.url)
99 let kept = try #require(try store.versions(for: URL(fileURLWithPath: a)).first { $0.lastPathComponent.contains("-replace-") })
100 #expect(try String(contentsOf: kept, encoding: .utf8) == "* foo\nFoo and foo\n")
101 }
102
103 @Test func regexpGroupsAndUntickedFiles() async throws {
104 try notes.write("a.org", "Call 555-1234\n")
105 try notes.write("b.org", "Call 555-9999\n")
106 try await workspace.addRoot(notes.url)
107 let a = try path("a.org"), b = try path("b.org")
108 let model = model()
109 await search(model, .replace(TextReplace(pattern: "([0-9]{3})-([0-9]{4})", replacement: "(\\1) $2", isRegexp: true)))
110 model.setTicked(false, file: b)
111 model.apply()
112 #expect(try disk(a) == "Call (555) 1234\n")
113 #expect(try disk(b) == "Call 555-9999\n")
114
115 await search(model, .replace(TextReplace(pattern: "(", replacement: "", isRegexp: true)))
116 #expect(model.problem != nil && model.files.isEmpty)
117 }
118
119 @Test func aFileChangedAfterTheSearchIsLeftAlone() async throws {
120 try notes.write("a.org", "foo\n")
121 try await workspace.addRoot(notes.url)
122 let a = try path("a.org")
123 let model = model()
124 await search(model, .replace(TextReplace(pattern: "foo", replacement: "bar")))
125 try Data("foo foo\n".utf8).write(to: URL(fileURLWithPath: a))
126 let summary = model.apply()
127 #expect(summary.contains("changed after the search"))
128 #expect(try disk(a) == "foo foo\n")
129 }
130
131 @Test func cancelStopsTheSearch() async throws {
132 for i in 0..<1000 { try notes.write("f\(i).org", String(repeating: "foo bar\n", count: 400)) }
133 try await workspace.addRoot(notes.url)
134 let model = model()
135 model.start(.replace(TextReplace(pattern: "foo", replacement: "bar")), scope: nil)
136 #expect(model.isSearching)
137 model.cancel()
138 await model.waitForSearch()
139 #expect(model.wasCancelled && !model.isSearching)
140 #expect(model.files.count < 1000)
141 }
142
143 @Test func renameTagWithConfig() async throws {
144 try notes.write("a.org", "#+FILETAGS: :work:\n* Plan :work:\nwork :work: in the body\n")
145 try await workspace.addRoot(notes.url)
146 let a = try path("a.org")
147 let model = model()
148 await search(model, .renameTag(from: "work", to: "office"))
149 #expect(model.configChange?.new == "office(w) home")
150 #expect(model.files.first?.changes.map(\.line) == [1, 2])
151 model.changesConfig = false
152 model.apply()
153 #expect(config.writes.isEmpty)
154 let renamed = try disk(a)
155 #expect(renamed.hasPrefix("#+FILETAGS: :office:\n* Plan"))
156 #expect(renamed.hasSuffix(":office:\nwork :work: in the body\n"))
157
158 await search(model, .renameTag(from: "home", to: "office"))
159 model.apply()
160 #expect(config.writes == ["tagAlist": "work(w) office"])
161
162 await search(model, .renameTag(from: "office", to: "two words"))
163 #expect(model.problem != nil)
164 }
165
166 @Test func renameKeywordFollowsWhereItIsDefined() async throws {
167 // own.org defines NEXT; uses.org relies on config.toml's keywords.
168 try notes.write("own.org", "#+TODO: TODO NEXT | DONE\n* NEXT a\n")
169 try notes.write("uses.org", "* NEXT b\nNEXT in the body\n")
170 try await workspace.addRoot(notes.url)
171 session.defaults = OrgSettings.default.withTodoKeywords(config.todoKeywords)!
172 let own = try path("own.org"), uses = try path("uses.org")
173
174 let model = model()
175 await search(model, .renameKeyword(from: "NEXT", to: "WAIT"), includeConfig: false)
176 #expect(model.files.map(\.path) == [own])
177 await search(model, .renameKeyword(from: "NEXT", to: "WAIT"))
178 #expect(model.files.map(\.path) == [own, uses])
179 model.apply()
180 #expect(try disk(own) == "#+TODO: TODO WAIT | DONE\n* WAIT a\n")
181 #expect(try disk(uses) == "* WAIT b\nNEXT in the body\n")
182 #expect(config.writes == ["todoKeywords": "TODO WAIT | DONE"])
183
184 // Across done and not-done states is refused, in config.toml or in a file.
185 await search(model, .renameKeyword(from: "TODO", to: "DONE"))
186 #expect(model.problem?.contains("done state") == true && model.files.isEmpty)
187 try notes.write("types.org", "#+TODO: A | B\n* A x\n")
188 await workspace.refresh()
189 await search(model, .renameKeyword(from: "A", to: "B"))
190 #expect(model.problem?.contains("types.org") == true)
191 }
192}
Tests/OrgCoreTests/ReplaceTests.swift added +255 · view
@@ -0,0 +1,255 @@
1import Foundation
2import Testing
3@testable import OrgCore
4
5/// Replace in Files' matching and case rules, and the structural renames of tags and TODO
6/// keywords, against Emacs where Org has the behaviour.
7struct ReplaceTests {
8 static let oracle = ProcessInfo.processInfo.environment["ORGSTAR_SKIP_ORACLE"] == nil
9
10 func replaced(_ text: String, _ query: TextReplace, skipping: [Range<Int>] = []) throws -> String {
11 ProposedChange.apply(try query.changes(in: text, skipping: skipping), to: text)
12 }
13
14 /// An Emacs Lisp string literal.
15 static func lisp(_ s: String) -> String {
16 "\"" + s.replacingOccurrences(of: "\\", with: "\\\\").replacingOccurrences(of: "\"", with: "\\\"") + "\""
17 }
18
19 @Test func plainText() throws {
20 let query = TextReplace(pattern: "a.b", replacement: "$1\\1")
21 #expect(try replaced("a.b axb\n", query) == "$1\\1 axb\n")
22 }
23
24 @Test func regexpWithGroups() throws {
25 let query = TextReplace(pattern: "(\\w+)@(\\w+)", replacement: "\\2 at $1 (\\&)", isRegexp: true, caseFold: false)
26 #expect(try replaced("me@home\n", query) == "home at me (me@home)\n")
27 }
28
29 @Test func linesAnchor() throws {
30 let query = TextReplace(pattern: "^- ", replacement: "+ ", isRegexp: true)
31 #expect(try replaced("- a\n- b\nx - c\n", query) == "+ a\n+ b\nx - c\n")
32 }
33
34 @Test func caseRules() throws {
35 // case-fold-search off: only the exact case matches, and nothing is casified.
36 #expect(try replaced("foo Foo", TextReplace(pattern: "foo", replacement: "bar", caseFold: false)) == "bar Foo")
37 // An upper-case letter in the pattern turns folding off.
38 #expect(try replaced("foo Foo", TextReplace(pattern: "Foo", replacement: "bar")) == "foo bar")
39 // case-replace off: matches fold, the replacement stays as written.
40 #expect(try replaced("foo Foo FOO", TextReplace(pattern: "foo", replacement: "bar", caseReplace: false)) == "bar bar bar")
41 // A letter after a backslash isn't upper case for folding.
42 #expect(TextReplace(pattern: "\\Wfoo", replacement: "", isRegexp: true).foldsCase)
43 #expect(!TextReplace(pattern: "\\WFoo", replacement: "", isRegexp: true).foldsCase)
44 }
45
46 @Test func invalidPatterns() {
47 #expect(throws: TextReplace.InvalidPattern.empty) { try TextReplace(pattern: "", replacement: "x").regex() }
48 #expect(throws: TextReplace.InvalidPattern.invalid) { try TextReplace(pattern: "(", replacement: "x", isRegexp: true).regex() }
49 }
50
51 @Test func changesDescribeTheirLines() throws {
52 let changes = try TextReplace(pattern: "cat", replacement: "dog").changes(in: "a\nthe cat sat\non a cat\n")
53 #expect(changes.map(\.line) == [2, 3])
54 #expect(changes[0].lineText == "the cat sat")
55 #expect(changes[0].changed == 4..<7)
56 #expect(changes[1].replacement == "dog")
57 }
58
59 @Test func encryptedEntriesAreSkipped() throws {
60 let text = """
61 * Secrets :crypt:
62 -----BEGIN PGP MESSAGE-----
63
64 jA0ECQMCsecret
65 -----END PGP MESSAGE-----
66 * Open
67 secret
68 ** Child :crypt:
69 -----BEGIN PGP MESSAGE-----
70 secret
71 -----END PGP MESSAGE-----
72 * Not tagged
73 -----BEGIN PGP MESSAGE-----
74 secret
75 -----END PGP MESSAGE-----
76
77 """
78 let ranges = EncryptedText.ranges(in: text)
79 #expect(ranges.count == 2)
80 let changes = try TextReplace(pattern: "secret", replacement: "x").changes(in: text, skipping: ranges)
81 // The tagged heading's title isn't encrypted.
82 #expect(changes.map(\.line) == [1, 7, 14])
83 #expect(EncryptedText.isEncryptedFile("/a/notes.org.gpg"))
84 #expect(!EncryptedText.isEncryptedFile("/a/notes.org"))
85 }
86
87 /// The same replacements through `perform-replace` with `case-fold-search` and
88 /// `case-replace` on: (text, Emacs pattern, ICU pattern, replacement, regexp).
89 static let replaceCases: [(String, String, String, String, Bool)] = [
90 ("foo Foo FOO fOo\n", "foo", "foo", "bar", false),
91 ("Foo foo\n", "Foo", "Foo", "bar", false),
92 ("a A x\n", "a", "a", "bc", false),
93 ("foo Foo FOO\n", "foo", "foo", "Bar baz", false),
94 ("1foo 1Foo\n", "1foo", "1foo", "bar", false),
95 ("Foo bar\nFoo Bar\n", "foo bar", "foo bar", "qux quux", false),
96 ("foo-bar Foo-Bar FOO-BAR\n", "foo-\\(bar\\)", "foo-(bar)", "x-\\1", true),
97 ("John Smith\njane doe\n", "\\([a-z]+\\) \\([a-z]+\\)", "([a-z]+) ([a-z]+)", "\\2, \\1", true),
98 ("* TODO a\n* b\n", "^\\* ", "^\\* ", "- ", true),
99 ("Émile émile ÉMILE\n", "émile", "émile", "zoé", false),
100 ]
101
102 @Test(.enabled(if: oracle)) func replaceMatchesEmacs() throws {
103 for (text, emacsPattern, pattern, replacement, regexp) in Self.replaceCases {
104 let form = "(progn (goto-char (point-min)) (let ((case-fold-search t) (case-replace t)) (perform-replace \(Self.lisp(emacsPattern)) \(Self.lisp(replacement)) nil \(regexp ? "t" : "nil") nil)) (list (buffer-string)))"
105 let emacs = try EmacsOracle.evaluate(text, form)
106 let ours = try replaced(text, TextReplace(pattern: pattern, replacement: replacement, isRegexp: regexp))
107 #expect([ours] == emacs, "\(emacsPattern) -> \(replacement) in \(text)")
108 }
109 }
110
111 // MARK: - Tags
112
113 static let tagged = """
114 #+TAGS: work(w) home { @office : work errand } urgent
115 #+FILETAGS: :work:notes:
116 * Plan :work:
117 ** TODO Call the boss :work:urgent:
118 * A heading whose title is long enough to push its tags past the tag column :work:
119 * Unaligned :home:work:
120 * See [[https://example.com][the site]] :work:
121 * Coffee ☕ break :work:
122 * Untagged
123 Body text says work and :work: and is left alone.
124 #+begin_example
125 #+TAGS: work
126 #+end_example
127
128 """
129
130 func renameTag(_ text: String, _ old: String, _ new: String) -> String {
131 let tree = OrgParser.parse(text)
132 return ProposedChange.apply(TagRename.changes(in: text, tree: tree, from: old, to: new, options: .org), to: text)
133 }
134
135 @Test func tagRenameChangesOnlyTags() {
136 let renamed = renameTag(Self.tagged, "work", "office")
137 #expect(renamed.contains("#+TAGS: office(w) home { @office : office errand } urgent\n"))
138 #expect(renamed.contains("#+FILETAGS: :office:notes:\n"))
139 #expect(renamed.contains("Body text says work and :work: and is left alone."))
140 #expect(renamed.contains("#+begin_example\n#+TAGS: work\n"))
141 #expect(renamed.components(separatedBy: ":work:").count == 2)
142 // The list shows whole tag lists and words, not the realigning spaces.
143 let changes = TagRename.changes(in: Self.tagged, tree: OrgParser.parse(Self.tagged), from: "work", to: "office", options: .org)
144 let shown = changes.map { ($0.lineText as NSString).substring(with: NSRange($0.changed)) + " -> " + $0.replacement }
145 #expect(shown[0] == "work(w) home { @office : work -> office(w) home { @office : office")
146 #expect(shown[1] == ":work:notes: -> :office:notes:")
147 #expect(shown[3] == ":work:urgent: -> :office:urgent:")
148 }
149
150 @Test func tagRenameMerges() {
151 let renamed = renameTag(Self.tagged, "work", "home")
152 #expect(renamed.contains("#+TAGS: home { @office : errand } urgent\n"))
153 #expect(renamed.contains("#+FILETAGS: :home:notes:\n"))
154 #expect(renamed.contains("* Unaligned") && renamed.contains(":home:\n* See"))
155 #expect(TagRename.renamedTagAlist("a(a) b\nc", from: "a", to: "c") == "c(a) b\nc")
156 #expect(TagRename.renamedTagAlist("a b c", from: "b", to: "a") == "a c")
157 #expect(TagRename.renamedTagAlist("x y", from: "a", to: "b") == nil)
158 #expect(TagRename.renamedFileTagsValue(" a b", from: "b", to: "a") == " a")
159 #expect(TagRename.renamedFileTagsValue(" :b:a:", from: "b", to: "a") == " :a:")
160 }
161
162 /// Org's `org-set-tags` on every heading with the tag, as Rename Tag aligns them.
163 @Test(.enabled(if: oracle)) func tagRenameAlignsAsOrg() throws {
164 let headings = Self.tagged.components(separatedBy: "\n").filter { $0.hasPrefix("*") }.joined(separator: "\n") + "\n"
165 for (old, new) in [("work", "office"), ("work", "home"), ("work", "a-very-long-tag-name".replacingOccurrences(of: "-", with: "_")), ("urgent", "u")] {
166 let form = """
167 (progn (setq org-tags-column -77) (font-lock-ensure)
168 (org-map-entries (lambda () (let ((tags (org-get-tags nil t)))
169 (when (member \(Self.lisp(old)) tags)
170 (org-set-tags (delete-dups (mapcar (lambda (tg) (if (equal tg \(Self.lisp(old))) \(Self.lisp(new)) tg)) tags)))))))
171 (list (buffer-string)))
172 """
173 let emacs = try EmacsOracle.evaluate(headings, form)
174 #expect([renameTag(headings, old, new)] == emacs, "\(old) -> \(new)")
175 }
176 }
177
178 // MARK: - TODO keywords
179
180 /// A heading line with its tags ending at column 77, as `org-tags-column` -77 puts them.
181 static func aligned(_ title: String, _ tags: String) -> String {
182 title + String(repeating: " ", count: max(1, 77 - title.count - tags.count)) + tags
183 }
184
185 static let keyworded = """
186 #+TODO: TODO NEXT(n!) | DONE(d)
187 #+TYP_TODO: Fred Sara | FINISHED
188 \(aligned("* NEXT Call the boss", ":work:"))
189 \(aligned("** NEXT A longer title so that the tags move", ":work:urgent:"))
190 * TODO Write
191 NEXT time, NEXT is body text.
192 * DONE Filed
193 \(aligned("* Sara Review", ":team:"))
194
195 """
196
197 func renameKeyword(_ text: String, _ old: String, _ new: String) -> String {
198 let tree = OrgParser.parse(text)
199 return ProposedChange.apply(KeywordRename.changes(in: text, tree: tree, from: old, to: new, headings: true, options: .org), to: text)
200 }
201
202 @Test func keywordRenameChangesOnlyKeywords() {
203 let renamed = renameKeyword(Self.keyworded, "NEXT", "WAITING")
204 #expect(renamed.contains("#+TODO: TODO WAITING(n!) | DONE(d)\n"))
205 #expect(renamed.contains("NEXT time, NEXT is body text."))
206 #expect(renamed.contains("* WAITING Call the boss"))
207 #expect(OrgParser.parse(renamed).settings.todoKeywordNames.contains("WAITING"))
208 }
209
210 @Test func keywordRenameMergesAndRefuses() {
211 let merged = renameKeyword(Self.keyworded, "NEXT", "TODO")
212 #expect(merged.contains("#+TODO: TODO | DONE(d)\n"))
213 #expect(merged.contains("* TODO Call the boss"))
214 let settings = OrgParser.parse(Self.keyworded).settings
215 #expect(KeywordRename.crossesStates(settings, from: "NEXT", to: "DONE"))
216 #expect(KeywordRename.crossesStates(settings, from: "FINISHED", to: "Sara"))
217 #expect(!KeywordRename.crossesStates(settings, from: "NEXT", to: "TODO"))
218 #expect(!KeywordRename.crossesStates(settings, from: "NEXT", to: "LATER"))
219 #expect(!KeywordRename.isValidName("A B") && !KeywordRename.isValidName("A(b)") && !KeywordRename.isValidName("|"))
220 #expect(KeywordRename.renamedTodoKeywords("TODO NEXT | DONE\nA B", from: "NEXT", to: "WAIT") == "TODO WAIT | DONE\nA B")
221 }
222
223 @Test func keywordSources() {
224 let tree = OrgParser.parse(Self.keyworded)
225 #expect(KeywordRename.source(of: "NEXT", in: tree) == .file)
226 #expect(KeywordRename.source(of: "LATER", in: tree) == .none)
227 var defaults = OrgSettings.default.withTodoKeywords("TODO LATER | DONE")!
228 #expect(KeywordRename.source(of: "LATER", in: OrgParser.parse("* LATER x\n", defaults: defaults)) == .defaults)
229 defaults.setupKeywords = "#+TODO: TODO SOON | DONE\n"
230 #expect(KeywordRename.source(of: "SOON", in: OrgParser.parse("* SOON x\n", defaults: defaults)) == .setupFile)
231 // Without headings, only the keyword lines change.
232 let lines = KeywordRename.changes(in: Self.keyworded, tree: tree, from: "NEXT", to: "WAITING", headings: false, options: .org)
233 #expect(lines.map(\.line) == [1])
234 }
235
236 /// After a rename, Org reads the headings with the new keyword, and its tags stay where
237 /// `org-align-tags` puts them.
238 @Test(.enabled(if: oracle)) func keywordRenameParsesInOrg() throws {
239 for (old, new) in [("NEXT", "WAITING"), ("NEXT", "N"), ("Sara", "Alexandra"), ("TODO", "NEXT")] {
240 let renamed = renameKeyword(Self.keyworded, old, new)
241 let form = """
242 (progn (setq org-tags-column -77) (font-lock-ensure)
243 (let ((states (org-map-entries (lambda () (or (org-get-todo-state) "")))))
244 (org-align-tags t)
245 (cons (buffer-string) states)))
246 """
247 let emacs = try EmacsOracle.evaluate(renamed, form)
248 #expect(emacs.first == renamed, "\(old) -> \(new): alignment")
249 let tree = OrgParser.parse(renamed)
250 let ours = tree.root.descendants().filter { $0.kind == .heading }.map { $0.tokens.first { $0.kind == .todoKeyword }?.text ?? "" }
251 #expect(Array(emacs.dropFirst()) == ours, "\(old) -> \(new): keywords")
252 #expect(ours.contains(new))
253 }
254 }
255}
docs/manual/guide/02-the-editor.org +22 · view
@@ -477,6 +477,28 @@ In Doom, =:s/PATTERN/REPLACEMENT/= and =:%s/…/…/= with the =g= and =i= flags
477 477
478To search all your files, use the toolbar's search field; see [[file:01-files-and-folders.org][Files, folders and buffers]]. 478To search all your files, use the toolbar's search field; see [[file:01-files-and-folders.org][Files, folders and buffers]].
479 479
480* Replacing in many files
481
482Edit ▸ Find ▸ Replace in Files… (=⌥⇧⌘F=, or Replace in Files… in the command palette) replaces text in every file of one folder or of all your folders. Fill in Find and Replace with, choose the folder under In, and press Find. Selected text on one line starts as the search.
483
484- *Plain text or regular expression.* With Regular expression on, the pattern is an ICU regular expression, as in the find bar and Doom's =:s=; =^= and =$= match at the start and end of each line. In the replacement, =\1= or =$1= is the first group, =\&= or =$0= the whole match, =\\= a backslash and =\$= a dollar sign. Plain text replaces literally.
485- *Case.* As Emacs's defaults have it: with Ignore case when the search is lower case on (=case-fold-search=), a search with no upper-case letters matches any case, and one with an upper-case letter matches case exactly (a letter after a backslash in a regular expression doesn't count). With Keep each match's case on as well (=case-replace=), the replacement follows each match: =foo= replaced with =bar= turns =Foo= into =Bar= and =FOO= into =BAR=, as =query-replace= does.
486
487The list shows every match by file and line, the matched text struck through and the replacement after it. Untick a match, or a file's box to leave out the whole file, then press Replace. While the search runs, a bar shows how many files are done; Stop ends it and keeps what it found.
488
489What is searched:
490
491- Org files (=.org=, =.org_archive=) and plain text (=.txt=, =.md=, =.markdown=) in the folder. Encrypted files (=.gpg=) are left out, and so are the encrypted entries in org files: the =-----BEGIN PGP MESSAGE-----= to =-----END PGP MESSAGE-----= text under a heading with the =crypt= tag (=org-crypt-tag-matcher=), its own or inherited. The tagged heading's own line is searched.
492- An open file as it is in its buffer, unsaved changes included.
493
494How each file changes:
495
496- An open file changes in its buffer, as one edit: Edit ▸ Undo in that buffer takes back the whole replacement in that file. It is saved as any edit is, at once with automatic saving, else when you save.
497- A file that isn't open is written at once through the same save path as a buffer, so a file changed on disk meanwhile is merged or reported as a conflict. Before it is written, its text is kept in recovery, as =Before a change across files=; there is no undo for it, but File ▸ Recovery Versions… on that file shows the old text and restores it (the restore can be undone).
498- A file that changed after the search is left alone, and the echo area says so; search again.
499
500The echo area then says how many files changed. Org ▸ TODO and Tags has Rename Tag… and Rename TODO Keyword…, which work the same way but change only tags or keywords; see [[file:05-todos-and-tags.org][TODOs and tags]].
501
480* Accessibility 502* Accessibility
481 503
482The editor works with VoiceOver. VoiceOver reads the text as it is shown rather than as stored: hidden link brackets and targets, hidden emphasis markers and hidden stars are skipped, entities are read as the characters drawn for them, and narrowed table columns are read as drawn. Folded text is still read, so the whole file is available. Lines, the caret position and the selection are reported in terms of the shown text. 504The editor works with VoiceOver. VoiceOver reads the text as it is shown rather than as stored: hidden link brackets and targets, hidden emphasis markers and hidden stars are skipped, entities are read as the characters drawn for them, and narrowed table columns are read as drawn. Folded text is still read, so the whole file is available. Lines, the caret position and the selection are reported in terms of the shown text.
docs/manual/guide/05-todos-and-tags.org +14 · view
@@ -315,6 +315,20 @@ orgstar aligns tags whenever it changes a heading line: setting tags, changing t
315 315
316The Settings window offers =-77= and =0=; other values go in =config.toml=. Columns are counted as Emacs displays the line, so links count as their description and, when =org-hide-emphasis-markers= is on, emphasis markers do not count. A heading always keeps at least one space before its tags. 316The Settings window offers =-77= and =0=; other values go in =config.toml=. Columns are counted as Emacs displays the line, so links count as their description and, when =org-hide-emphasis-markers= is on, emphasis markers do not count. A heading always keeps at least one space before its tags.
317 317
318* Renaming a tag or keyword everywhere
319
320Org ▸ TODO and Tags ▸ Rename Tag… and Rename TODO Keyword… (also in the command palette, and in Commands on iPhone and iPad) rename a tag or a keyword in every org file of one folder or of all your folders. They start with the tag under the caret, or the heading's keyword. Give the new name, choose the folder, and press Find: the list shows each line that changes, as Replace in Files does (see [[file:02-the-editor.org][The editor]]), and you can untick a line or a file before pressing Rename. Each file changes in one step, an open one as an edit you can undo in its buffer, one that isn't open after its text is kept in recovery.
321
322Only structural places change, never words in the text:
323
324- *Rename Tag* changes the tag in heading tag lists, in =#+TAGS= lines (keeping a fast-selection key such as =work(w)=, and inside ={ }= and =[ ]= groups) and in =#+FILETAGS= lines. A heading whose tags changed is realigned as Set Tags aligns it (=org-set-tags=).
325- *Rename TODO Keyword* changes the keyword where it is a heading's keyword and in =#+TODO=, =#+SEQ_TODO= and =#+TYP_TODO= lines, keeping its key and logging flags (=NEXT(n!)= becomes =WAIT(n!)=). A heading with tags is realigned, as changing the state realigns it.
326- With Also rename it in config.toml on, =org-tag-alist= or =org-todo-keywords= in =config.toml= changes too, and the list shows the new value first. A keyword change in =config.toml= takes effect after you restart the app, as any change to =org-todo-keywords= does.
327- A heading's keyword changes only where the new name will be a keyword: in a file whose own =#+TODO= lines name it, in one whose =#+SETUPFILE= is among the files renamed, or, for a file that uses the default keywords, when =config.toml= changes too. Otherwise the heading would no longer have a keyword, so it is left as it is.
328- Lines inside blocks don't count as keyword lines, and the encrypted text of =crypt= entries and =.gpg= files is left alone.
329
330Renaming to a name that is already there merges the two: a heading with both tags keeps one, and in a =#+TAGS=, =#+FILETAGS= or =#+TODO= line that names both, the old name is removed rather than doubled (so =#+TODO: TODO NEXT | DONE= with =NEXT= renamed to =TODO= becomes =#+TODO: TODO | DONE=). A keyword can't be renamed to one on the other side of the =|=, a done state to a not-done one or the other way round: the search stops and says in which file, or in =config.toml=, the two states differ. A tag name must be letters, digits, =_=, =@=, =#= and =%=, and a keyword can't contain a space, a =|= or parentheses.
331
318* Progress on child tasks 332* Progress on child tasks
319 333
320A =[/]= or =[%]= cookie in a heading shows how many of its children are done: 334A =[/]= or =[%]= cookie in a heading shows how many of its children are done:
docs/manual/guide/14-ios.org +3 · view
@@ -202,6 +202,8 @@ Archive Subtree in Commands (or =C-c C-x C-s= with a hardware keyboard) archives
202 202
203Commands has the org-crypt commands; see [[file:04-outlines.org][Outlines]]. A remembered passphrase is used after Face ID, Touch ID or the device passcode. 203Commands has the org-crypt commands; see [[file:04-outlines.org][Outlines]]. A remembered passphrase is used after Face ID, Touch ID or the device passcode.
204 204
205Rename Tag… and Rename TODO Keyword… in the editor's Commands, under TODO and Tags, rename a tag or a keyword in every org file of one folder or all folders, as on the Mac: a sheet asks for the old and new name (the menu beside the first field lists the tags of your folders, or the keywords), the folder, and whether to change =config.toml= too; Find lists each line that changes, with a switch to leave it out, and Rename applies them. A change to =config.toml= goes into the synced folder's file. See [[file:05-todos-and-tags.org][TODOs and tags]].
206
205** The menu bar on iPad 207** The menu bar on iPad
206 208
207The iPad's menu bar, and the list of keys shown while =⌘= is held on a hardware keyboard, have these menus, after the Mac's and with the Mac's keys: 209The iPad's menu bar, and the list of keys shown while =⌘= is held on a hardware keyboard, have these menus, after the Mac's and with the Mac's keys:
@@ -522,6 +524,7 @@ Quick Look in the Files app shows org files as the HTML export renders them.
522- In the download version, attaching by hard link or symbolic link. 524- In the download version, attaching by hard link or symbolic link.
523- The inspector, and the buffer list and tab bar. The board and column view are there (see [[file:07-agenda.org][The agenda]] and [[file:04-outlines.org][Outlines]]). 525- The inspector, and the buffer list and tab bar. The board and column view are there (see [[file:07-agenda.org][The agenda]] and [[file:04-outlines.org][Outlines]]).
524- The global capture hotkey and the Settings window. 526- The global capture hotkey and the Settings window.
527- Replace in Files; the rename commands are on iOS.
525- Explicit saving. 528- Explicit saving.
526 529
527Commands the iOS app can't carry out show a message instead: "/Command/ isn't available on iPhone and iPad. It runs on the Mac." Only tables that need Emacs say that Emacs is needed. Commands that only appear on the Mac aren't listed in Commands. Refile… in Commands (or =C-c C-w= with a hardware keyboard) refiles the entry at the caret, choosing the target as the agenda's Refile… does. 530Commands the iOS app can't carry out show a message instead: "/Command/ isn't available on iPhone and iPad. It runs on the Mac." Only tables that need Emacs say that Emacs is needed. Commands that only appear on the Mac aren't listed in Commands. Refile… in Commands (or =C-c C-w= with a hardware keyboard) refiles the entry at the caret, choosing the target as the agenda's Refile… does.
l10n/Localizable.xcstrings +1578 −73 · view
@@ -325,6 +325,76 @@
325 } 325 }
326 } 326 }
327 }, 327 },
328 "%@ can't be a TODO keyword: it has a space, a bar or a parenthesis.": {
329 "comment": "Rename TODO Keyword",
330 "localizations": {
331 "de": {
332 "stringUnit": {
333 "state": "translated",
334 "value": "%@ kann kein TODO-Schlüsselwort sein: Es enthält ein Leerzeichen, einen Strich oder eine Klammer."
335 }
336 },
337 "es": {
338 "stringUnit": {
339 "state": "translated",
340 "value": "%@ no puede ser una palabra clave TODO: tiene un espacio, una barra o un paréntesis."
341 }
342 },
343 "fr": {
344 "stringUnit": {
345 "state": "translated",
346 "value": "%@ ne peut pas être un mot-clé TODO : il contient une espace, une barre ou une parenthèse."
347 }
348 },
349 "ja": {
350 "stringUnit": {
351 "state": "translated",
352 "value": "%@ は TODO キーワードにできません: 空白、縦棒、括弧を含んでいます。"
353 }
354 },
355 "pt-BR": {
356 "stringUnit": {
357 "state": "translated",
358 "value": "%@ não pode ser uma palavra-chave TODO: tem um espaço, uma barra ou um parêntese."
359 }
360 }
361 }
362 },
363 "%@ can't be a tag: a tag is letters, digits, _, @, # and %%.": {
364 "comment": "Rename Tag",
365 "localizations": {
366 "de": {
367 "stringUnit": {
368 "state": "translated",
369 "value": "%@ kann kein Tag sein: Ein Tag besteht aus Buchstaben, Ziffern, _, @, # und %%."
370 }
371 },
372 "es": {
373 "stringUnit": {
374 "state": "translated",
375 "value": "%@ no puede ser una etiqueta: una etiqueta tiene letras, dígitos, _, @, # y %%."
376 }
377 },
378 "fr": {
379 "stringUnit": {
380 "state": "translated",
381 "value": "%@ ne peut pas être une étiquette : une étiquette contient des lettres, des chiffres, _, @, # et %%."
382 }
383 },
384 "ja": {
385 "stringUnit": {
386 "state": "translated",
387 "value": "%@ はタグにできません: タグは文字、数字、_、@、#、%% だけです。"
388 }
389 },
390 "pt-BR": {
391 "stringUnit": {
392 "state": "translated",
393 "value": "%@ não pode ser uma etiqueta: uma etiqueta tem letras, dígitos, _, @, # e %%."
394 }
395 }
396 }
397 },
328 "%@ can't run here": { 398 "%@ can't run here": {
329 "comment": "A command that doesn't apply in column view", 399 "comment": "A command that doesn't apply in column view",
330 "localizations": { 400 "localizations": {
@@ -1890,6 +1960,76 @@
1890 } 1960 }
1891 } 1961 }
1892 }, 1962 },
1963 "%lld of %lld": {
1964 "comment": "Replace in Files: ticked changes of the file's changes",
1965 "localizations": {
1966 "de": {
1967 "stringUnit": {
1968 "state": "translated",
1969 "value": "%1$lld von %2$lld"
1970 }
1971 },
1972 "es": {
1973 "stringUnit": {
1974 "state": "translated",
1975 "value": "%1$lld de %2$lld"
1976 }
1977 },
1978 "fr": {
1979 "stringUnit": {
1980 "state": "translated",
1981 "value": "%1$lld sur %2$lld"
1982 }
1983 },
1984 "ja": {
1985 "stringUnit": {
1986 "state": "translated",
1987 "value": "%2$lld 件中 %1$lld 件"
1988 }
1989 },
1990 "pt-BR": {
1991 "stringUnit": {
1992 "state": "translated",
1993 "value": "%1$lld de %2$lld"
1994 }
1995 }
1996 }
1997 },
1998 "%lld of %lld changes; files: %lld": {
1999 "comment": "Replace in Files: what applying does",
2000 "localizations": {
2001 "de": {
2002 "stringUnit": {
2003 "state": "translated",
2004 "value": "%1$lld von %2$lld Änderungen; Dateien: %3$lld"
2005 }
2006 },
2007 "es": {
2008 "stringUnit": {
2009 "state": "translated",
2010 "value": "%1$lld de %2$lld cambios; archivos: %3$lld"
2011 }
2012 },
2013 "fr": {
2014 "stringUnit": {
2015 "state": "translated",
2016 "value": "%1$lld modifications sur %2$lld ; fichiers : %3$lld"
2017 }
2018 },
2019 "ja": {
2020 "stringUnit": {
2021 "state": "translated",
2022 "value": "%2$lld 件中 %1$lld 件の変更、ファイル: %3$lld"
2023 }
2024 },
2025 "pt-BR": {
2026 "stringUnit": {
2027 "state": "translated",
2028 "value": "%1$lld de %2$lld alterações; arquivos: %3$lld"
2029 }
2030 }
2031 }
2032 },
1893 "%lld open": { 2033 "%lld open": {
1894 "localizations": { 2034 "localizations": {
1895 "de": { 2035 "de": {
@@ -4703,6 +4843,76 @@
4703 } 4843 }
4704 } 4844 }
4705 }, 4845 },
4846 "Also rename it in org-tag-alist in config.toml": {
4847 "comment": "Rename Tag: also change the setting",
4848 "localizations": {
4849 "de": {
4850 "stringUnit": {
4851 "state": "translated",
4852 "value": "Auch in org-tag-alist in config.toml umbenennen"
4853 }
4854 },
4855 "es": {
4856 "stringUnit": {
4857 "state": "translated",
4858 "value": "Cambiarlo también en org-tag-alist de config.toml"
4859 }
4860 },
4861 "fr": {
4862 "stringUnit": {
4863 "state": "translated",
4864 "value": "Le renommer aussi dans org-tag-alist de config.toml"
4865 }
4866 },
4867 "ja": {
4868 "stringUnit": {
4869 "state": "translated",
4870 "value": "config.toml の org-tag-alist でも名前を変更"
4871 }
4872 },
4873 "pt-BR": {
4874 "stringUnit": {
4875 "state": "translated",
4876 "value": "Renomear também em org-tag-alist no config.toml"
4877 }
4878 }
4879 }
4880 },
4881 "Also rename it in org-todo-keywords in config.toml": {
4882 "comment": "Rename TODO Keyword: also change the setting",
4883 "localizations": {
4884 "de": {
4885 "stringUnit": {
4886 "state": "translated",
4887 "value": "Auch in org-todo-keywords in config.toml umbenennen"
4888 }
4889 },
4890 "es": {
4891 "stringUnit": {
4892 "state": "translated",
4893 "value": "Cambiarlo también en org-todo-keywords de config.toml"
4894 }
4895 },
4896 "fr": {
4897 "stringUnit": {
4898 "state": "translated",
4899 "value": "Le renommer aussi dans org-todo-keywords de config.toml"
4900 }
4901 },
4902 "ja": {
4903 "stringUnit": {
4904 "state": "translated",
4905 "value": "config.toml の org-todo-keywords でも名前を変更"
4906 }
4907 },
4908 "pt-BR": {
4909 "stringUnit": {
4910 "state": "translated",
4911 "value": "Renomear também em org-todo-keywords no config.toml"
4912 }
4913 }
4914 }
4915 },
4706 "An entry's APPT_WARNTIME property overrides the lead time.": { 4916 "An entry's APPT_WARNTIME property overrides the lead time.": {
4707 "localizations": { 4917 "localizations": {
4708 "de": { 4918 "de": {
@@ -5978,318 +6188,388 @@
5978 } 6188 }
5979 } 6189 }
5980 }, 6190 },
5981 "Before first headline": { 6191 "Becomes %@": {
5982 "comment": "Echo area: an entry command before the file's first heading", 6192 "comment": "Replace in Files: the line after the change, for VoiceOver",
5983 "localizations": { 6193 "localizations": {
5984 "de": { 6194 "de": {
5985 "stringUnit": { 6195 "stringUnit": {
5986 "state": "translated", 6196 "state": "translated",
5987 "value": "Vor der ersten Überschrift" 6197 "value": "Wird zu %@"
5988 } 6198 }
5989 }, 6199 },
5990 "es": { 6200 "es": {
5991 "stringUnit": { 6201 "stringUnit": {
5992 "state": "translated", 6202 "state": "translated",
5993 "value": "Antes del primer encabezado" 6203 "value": "Pasa a ser %@"
5994 } 6204 }
5995 }, 6205 },
5996 "fr": { 6206 "fr": {
5997 "stringUnit": { 6207 "stringUnit": {
5998 "state": "translated", 6208 "state": "translated",
5999 "value": "Avant le premier titre" 6209 "value": "Devient %@"
6000 } 6210 }
6001 }, 6211 },
6002 "ja": { 6212 "ja": {
6003 "stringUnit": { 6213 "stringUnit": {
6004 "state": "translated", 6214 "state": "translated",
6005 "value": "最初の見出しより前です" 6215 "value": "変更後: %@"
6006 } 6216 }
6007 }, 6217 },
6008 "pt-BR": { 6218 "pt-BR": {
6009 "stringUnit": { 6219 "stringUnit": {
6010 "state": "translated", 6220 "state": "translated",
6011 "value": "Antes do primeiro cabeçalho" 6221 "value": "Passa a ser %@"
6012 } 6222 }
6013 } 6223 }
6014 } 6224 }
6015 }, 6225 },
6016 "Beginning of Buffer": { 6226 "Before a change across files": {
6017 "comment": "Command title", 6227 "comment": "Recovery version kept before Replace in Files or a rename changed the file",
6018 "localizations": { 6228 "localizations": {
6019 "de": { 6229 "de": {
6020 "stringUnit": { 6230 "stringUnit": {
6021 "state": "translated", 6231 "state": "translated",
6022 "value": "Pufferanfang" 6232 "value": "Vor einer Änderung in mehreren Dateien"
6023 } 6233 }
6024 }, 6234 },
6025 "es": { 6235 "es": {
6026 "stringUnit": { 6236 "stringUnit": {
6027 "state": "translated", 6237 "state": "translated",
6028 "value": "Inicio del búfer" 6238 "value": "Antes de un cambio en varios archivos"
6029 } 6239 }
6030 }, 6240 },
6031 "fr": { 6241 "fr": {
6032 "stringUnit": { 6242 "stringUnit": {
6033 "state": "translated", 6243 "state": "translated",
6034 "value": "Début du tampon" 6244 "value": "Avant une modification dans plusieurs fichiers"
6035 } 6245 }
6036 }, 6246 },
6037 "ja": { 6247 "ja": {
6038 "stringUnit": { 6248 "stringUnit": {
6039 "state": "translated", 6249 "state": "translated",
6040 "value": "バッファの先頭" 6250 "value": "複数ファイルの変更前"
6041 } 6251 }
6042 }, 6252 },
6043 "pt-BR": { 6253 "pt-BR": {
6044 "stringUnit": { 6254 "stringUnit": {
6045 "state": "translated", 6255 "state": "translated",
6046 "value": "Início do Buffer" 6256 "value": "Antes de uma alteração em vários arquivos"
6047 } 6257 }
6048 } 6258 }
6049 } 6259 }
6050 }, 6260 },
6051 "Beginning of Line": { 6261 "Before first headline": {
6052 "comment": "Command title", 6262 "comment": "Echo area: an entry command before the file's first heading",
6053 "localizations": { 6263 "localizations": {
6054 "de": { 6264 "de": {
6055 "stringUnit": { 6265 "stringUnit": {
6056 "state": "translated", 6266 "state": "translated",
6057 "value": "Zeilenanfang" 6267 "value": "Vor der ersten Überschrift"
6058 } 6268 }
6059 }, 6269 },
6060 "es": { 6270 "es": {
6061 "stringUnit": { 6271 "stringUnit": {
6062 "state": "translated", 6272 "state": "translated",
6063 "value": "Inicio de línea" 6273 "value": "Antes del primer encabezado"
6064 } 6274 }
6065 }, 6275 },
6066 "fr": { 6276 "fr": {
6067 "stringUnit": { 6277 "stringUnit": {
6068 "state": "translated", 6278 "state": "translated",
6069 "value": "Début de ligne" 6279 "value": "Avant le premier titre"
6070 } 6280 }
6071 }, 6281 },
6072 "ja": { 6282 "ja": {
6073 "stringUnit": { 6283 "stringUnit": {
6074 "state": "translated", 6284 "state": "translated",
6075 "value": "行頭" 6285 "value": "最初の見出しより前です"
6076 } 6286 }
6077 }, 6287 },
6078 "pt-BR": { 6288 "pt-BR": {
6079 "stringUnit": { 6289 "stringUnit": {
6080 "state": "translated", 6290 "state": "translated",
6081 "value": "Início da Linha" 6291 "value": "Antes do primeiro cabeçalho"
6082 } 6292 }
6083 } 6293 }
6084 } 6294 }
6085 }, 6295 },
6086 "Billed monthly": { 6296 "Beginning of Buffer": {
6297 "comment": "Command title",
6087 "localizations": { 6298 "localizations": {
6088 "de": { 6299 "de": {
6089 "stringUnit": { 6300 "stringUnit": {
6090 "state": "translated", 6301 "state": "translated",
6091 "value": "Monatliche Abrechnung" 6302 "value": "Pufferanfang"
6092 } 6303 }
6093 }, 6304 },
6094 "es": { 6305 "es": {
6095 "stringUnit": { 6306 "stringUnit": {
6096 "state": "translated", 6307 "state": "translated",
6097 "value": "Facturación mensual" 6308 "value": "Inicio del búfer"
6098 } 6309 }
6099 }, 6310 },
6100 "fr": { 6311 "fr": {
6101 "stringUnit": { 6312 "stringUnit": {
6102 "state": "translated", 6313 "state": "translated",
6103 "value": "Facturé mensuellement" 6314 "value": "Début du tampon"
6104 } 6315 }
6105 }, 6316 },
6106 "ja": { 6317 "ja": {
6107 "stringUnit": { 6318 "stringUnit": {
6108 "state": "translated", 6319 "state": "translated",
6109 "value": "月払い" 6320 "value": "バッファの先頭"
6110 } 6321 }
6111 }, 6322 },
6112 "pt-BR": { 6323 "pt-BR": {
6113 "stringUnit": { 6324 "stringUnit": {
6114 "state": "translated", 6325 "state": "translated",
6115 "value": "Cobrado mensalmente" 6326 "value": "Início do Buffer"
6116 } 6327 }
6117 } 6328 }
6118 } 6329 }
6119 }, 6330 },
6120 "Blocked entries": { 6331 "Beginning of Line": {
6332 "comment": "Command title",
6121 "localizations": { 6333 "localizations": {
6122 "de": { 6334 "de": {
6123 "stringUnit": { 6335 "stringUnit": {
6124 "state": "translated", 6336 "state": "translated",
6125 "value": "Blockierte Einträge" 6337 "value": "Zeilenanfang"
6126 } 6338 }
6127 }, 6339 },
6128 "es": { 6340 "es": {
6129 "stringUnit": { 6341 "stringUnit": {
6130 "state": "translated", 6342 "state": "translated",
6131 "value": "Entradas bloqueadas" 6343 "value": "Inicio de línea"
6132 } 6344 }
6133 }, 6345 },
6134 "fr": { 6346 "fr": {
6135 "stringUnit": { 6347 "stringUnit": {
6136 "state": "translated", 6348 "state": "translated",
6137 "value": "Entrées bloquées" 6349 "value": "Début de ligne"
6138 } 6350 }
6139 }, 6351 },
6140 "ja": { 6352 "ja": {
6141 "stringUnit": { 6353 "stringUnit": {
6142 "state": "translated", 6354 "state": "translated",
6143 "value": "ブロックされたエントリ" 6355 "value": "行頭"
6144 } 6356 }
6145 }, 6357 },
6146 "pt-BR": { 6358 "pt-BR": {
6147 "stringUnit": { 6359 "stringUnit": {
6148 "state": "translated", 6360 "state": "translated",
6149 "value": "Entradas bloqueadas" 6361 "value": "Início da Linha"
6150 } 6362 }
6151 } 6363 }
6152 } 6364 }
6153 }, 6365 },
6154 "Blocks": { 6366 "Billed monthly": {
6155 "comment": "Org menu submenu",
6156 "localizations": { 6367 "localizations": {
6157 "de": { 6368 "de": {
6158 "stringUnit": { 6369 "stringUnit": {
6159 "state": "translated", 6370 "state": "translated",
6160 "value": "Blöcke" 6371 "value": "Monatliche Abrechnung"
6161 } 6372 }
6162 }, 6373 },
6163 "es": { 6374 "es": {
6164 "stringUnit": { 6375 "stringUnit": {
6165 "state": "translated", 6376 "state": "translated",
6166 "value": "Bloques" 6377 "value": "Facturación mensual"
6167 } 6378 }
6168 }, 6379 },
6169 "fr": { 6380 "fr": {
6170 "stringUnit": { 6381 "stringUnit": {
6171 "state": "translated", 6382 "state": "translated",
6172 "value": "Blocs" 6383 "value": "Facturé mensuellement"
6173 } 6384 }
6174 }, 6385 },
6175 "ja": { 6386 "ja": {
6176 "stringUnit": { 6387 "stringUnit": {
6177 "state": "translated", 6388 "state": "translated",
6178 "value": "ブロック" 6389 "value": "月払い"
6179 } 6390 }
6180 }, 6391 },
6181 "pt-BR": { 6392 "pt-BR": {
6182 "stringUnit": { 6393 "stringUnit": {
6183 "state": "translated", 6394 "state": "translated",
6184 "value": "Blocos" 6395 "value": "Cobrado mensalmente"
6185 } 6396 }
6186 } 6397 }
6187 } 6398 }
6188 }, 6399 },
6189 "Board": { 6400 "Blocked entries": {
6190 "comment": "Command title",
6191 "localizations": { 6401 "localizations": {
6192 "de": { 6402 "de": {
6193 "stringUnit": { 6403 "stringUnit": {
6194 "state": "translated", 6404 "state": "translated",
6195 "value": "Board" 6405 "value": "Blockierte Einträge"
6196 } 6406 }
6197 }, 6407 },
6198 "es": { 6408 "es": {
6199 "stringUnit": { 6409 "stringUnit": {
6200 "state": "translated", 6410 "state": "translated",
6201 "value": "Tablero" 6411 "value": "Entradas bloqueadas"
6202 } 6412 }
6203 }, 6413 },
6204 "fr": { 6414 "fr": {
6205 "stringUnit": { 6415 "stringUnit": {
6206 "state": "translated", 6416 "state": "translated",
6207 "value": "Board" 6417 "value": "Entrées bloquées"
6208 } 6418 }
6209 }, 6419 },
6210 "ja": { 6420 "ja": {
6211 "stringUnit": { 6421 "stringUnit": {
6212 "state": "translated", 6422 "state": "translated",
6213 "value": "ボード" 6423 "value": "ブロックされたエントリ"
6214 } 6424 }
6215 }, 6425 },
6216 "pt-BR": { 6426 "pt-BR": {
6217 "stringUnit": { 6427 "stringUnit": {
6218 "state": "translated", 6428 "state": "translated",
6219 "value": "Quadro" 6429 "value": "Entradas bloqueadas"
6220 } 6430 }
6221 } 6431 }
6222 } 6432 }
6223 }, 6433 },
6224 "Body Only": { 6434 "Blocks": {
6435 "comment": "Org menu submenu",
6225 "localizations": { 6436 "localizations": {
6226 "de": { 6437 "de": {
6227 "stringUnit": { 6438 "stringUnit": {
6228 "state": "translated", 6439 "state": "translated",
6229 "value": "Nur Inhalt" 6440 "value": "Blöcke"
6230 } 6441 }
6231 }, 6442 },
6232 "es": { 6443 "es": {
6233 "stringUnit": { 6444 "stringUnit": {
6234 "state": "translated", 6445 "state": "translated",
6235 "value": "Solo el cuerpo" 6446 "value": "Bloques"
6236 } 6447 }
6237 }, 6448 },
6238 "fr": { 6449 "fr": {
6239 "stringUnit": { 6450 "stringUnit": {
6240 "state": "translated", 6451 "state": "translated",
6241 "value": "Corps uniquement" 6452 "value": "Blocs"
6242 } 6453 }
6243 }, 6454 },
6244 "ja": { 6455 "ja": {
6245 "stringUnit": { 6456 "stringUnit": {
6246 "state": "translated", 6457 "state": "translated",
6247 "value": "本文のみ" 6458 "value": "ブロック"
6248 } 6459 }
6249 }, 6460 },
6250 "pt-BR": { 6461 "pt-BR": {
6251 "stringUnit": { 6462 "stringUnit": {
6252 "state": "translated", 6463 "state": "translated",
6253 "value": "Só o Corpo" 6464 "value": "Blocos"
6254 } 6465 }
6255 } 6466 }
6256 } 6467 }
6257 }, 6468 },
6258 "Body font": { 6469 "Board": {
6470 "comment": "Command title",
6259 "localizations": { 6471 "localizations": {
6260 "de": { 6472 "de": {
6261 "stringUnit": { 6473 "stringUnit": {
6262 "state": "translated", 6474 "state": "translated",
6263 "value": "Schrift für Fließtext" 6475 "value": "Board"
6264 } 6476 }
6265 }, 6477 },
6266 "es": { 6478 "es": {
6267 "stringUnit": { 6479 "stringUnit": {
6268 "state": "translated", 6480 "state": "translated",
6269 "value": "Tipo de letra del cuerpo" 6481 "value": "Tablero"
6270 } 6482 }
6271 }, 6483 },
6272 "fr": { 6484 "fr": {
6273 "stringUnit": { 6485 "stringUnit": {
6274 "state": "translated", 6486 "state": "translated",
6275 "value": "Police du texte courant" 6487 "value": "Board"
6276 } 6488 }
6277 }, 6489 },
6278 "ja": { 6490 "ja": {
6279 "stringUnit": { 6491 "stringUnit": {
6280 "state": "translated", 6492 "state": "translated",
6281 "value": "本文のフォント" 6493 "value": "ボード"
6282 } 6494 }
6283 }, 6495 },
6284 "pt-BR": { 6496 "pt-BR": {
6285 "stringUnit": { 6497 "stringUnit": {
6286 "state": "translated", 6498 "state": "translated",
6287 "value": "Fonte do corpo" 6499 "value": "Quadro"
6288 } 6500 }
6289 } 6501 }
6290 } 6502 }
6291 }, 6503 },
6292 "Body only": { 6504 "Body Only": {
6505 "localizations": {
6506 "de": {
6507 "stringUnit": {
6508 "state": "translated",
6509 "value": "Nur Inhalt"
6510 }
6511 },
6512 "es": {
6513 "stringUnit": {
6514 "state": "translated",
6515 "value": "Solo el cuerpo"
6516 }
6517 },
6518 "fr": {
6519 "stringUnit": {
6520 "state": "translated",
6521 "value": "Corps uniquement"
6522 }
6523 },
6524 "ja": {
6525 "stringUnit": {
6526 "state": "translated",
6527 "value": "本文のみ"
6528 }
6529 },
6530 "pt-BR": {
6531 "stringUnit": {
6532 "state": "translated",
6533 "value": "Só o Corpo"
6534 }
6535 }
6536 }
6537 },
6538 "Body font": {
6539 "localizations": {
6540 "de": {
6541 "stringUnit": {
6542 "state": "translated",
6543 "value": "Schrift für Fließtext"
6544 }
6545 },
6546 "es": {
6547 "stringUnit": {
6548 "state": "translated",
6549 "value": "Tipo de letra del cuerpo"
6550 }
6551 },
6552 "fr": {
6553 "stringUnit": {
6554 "state": "translated",
6555 "value": "Police du texte courant"
6556 }
6557 },
6558 "ja": {
6559 "stringUnit": {
6560 "state": "translated",
6561 "value": "本文のフォント"
6562 }
6563 },
6564 "pt-BR": {
6565 "stringUnit": {
6566 "state": "translated",
6567 "value": "Fonte do corpo"
6568 }
6569 }
6570 }
6571 },
6572 "Body only": {
6293 "localizations": { 6573 "localizations": {
6294 "de": { 6574 "de": {
6295 "stringUnit": { 6575 "stringUnit": {
@@ -7217,6 +7497,41 @@
7217 } 7497 }
7218 } 7498 }
7219 }, 7499 },
7500 "Can't rename %@ to %@: in %@, %@ is a done state and %@ isn't.": {
7501 "comment": "Rename TODO Keyword: refused",
7502 "localizations": {
7503 "de": {
7504 "stringUnit": {
7505 "state": "translated",
7506 "value": "%1$@ kann nicht in %2$@ umbenannt werden: In %3$@ ist %4$@ ein Erledigt-Zustand und %5$@ nicht."
7507 }
7508 },
7509 "es": {
7510 "stringUnit": {
7511 "state": "translated",
7512 "value": "No se puede cambiar %1$@ por %2$@: en %3$@, %4$@ es un estado terminado y %5$@ no."
7513 }
7514 },
7515 "fr": {
7516 "stringUnit": {
7517 "state": "translated",
7518 "value": "Impossible de renommer %1$@ en %2$@ : dans %3$@, %4$@ est un état terminé et %5$@ ne l'est pas."
7519 }
7520 },
7521 "ja": {
7522 "stringUnit": {
7523 "state": "translated",
7524 "value": "%1$@ を %2$@ に変更できません: %3$@ では %4$@ は完了状態ですが %5$@ はそうではありません。"
7525 }
7526 },
7527 "pt-BR": {
7528 "stringUnit": {
7529 "state": "translated",
7530 "value": "Não é possível renomear %1$@ para %2$@: em %3$@, %4$@ é um estado concluído e %5$@ não é."
7531 }
7532 }
7533 }
7534 },
7220 "Can't write %@: %@": { 7535 "Can't write %@: %@": {
7221 "comment": "Echo area: file name, then the reason", 7536 "comment": "Echo area: file name, then the reason",
7222 "localizations": { 7537 "localizations": {
@@ -16630,6 +16945,41 @@
16630 } 16945 }
16631 } 16946 }
16632 }, 16947 },
16948 "Files changed: %lld": {
16949 "comment": "Replace in Files: after applying",
16950 "localizations": {
16951 "de": {
16952 "stringUnit": {
16953 "state": "translated",
16954 "value": "Geänderte Dateien: %lld"
16955 }
16956 },
16957 "es": {
16958 "stringUnit": {
16959 "state": "translated",
16960 "value": "Archivos cambiados: %lld"
16961 }
16962 },
16963 "fr": {
16964 "stringUnit": {
16965 "state": "translated",
16966 "value": "Fichiers modifiés : %lld"
16967 }
16968 },
16969 "ja": {
16970 "stringUnit": {
16971 "state": "translated",
16972 "value": "変更したファイル: %lld"
16973 }
16974 },
16975 "pt-BR": {
16976 "stringUnit": {
16977 "state": "translated",
16978 "value": "Arquivos alterados: %lld"
16979 }
16980 }
16981 }
16982 },
16633 "Files text with one of your capture templates.": { 16983 "Files text with one of your capture templates.": {
16634 "localizations": { 16984 "localizations": {
16635 "de": { 16985 "de": {
@@ -17182,6 +17532,41 @@
17182 } 17532 }
17183 } 17533 }
17184 }, 17534 },
17535 "Find:": {
17536 "comment": "Replace in Files: the search field",
17537 "localizations": {
17538 "de": {
17539 "stringUnit": {
17540 "state": "translated",
17541 "value": "Suchen:"
17542 }
17543 },
17544 "es": {
17545 "stringUnit": {
17546 "state": "translated",
17547 "value": "Buscar:"
17548 }
17549 },
17550 "fr": {
17551 "stringUnit": {
17552 "state": "translated",
17553 "value": "Rechercher :"
17554 }
17555 },
17556 "ja": {
17557 "stringUnit": {
17558 "state": "translated",
17559 "value": "検索:"
17560 }
17561 },
17562 "pt-BR": {
17563 "stringUnit": {
17564 "state": "translated",
17565 "value": "Buscar:"
17566 }
17567 }
17568 }
17569 },
17185 "First template": { 17570 "First template": {
17186 "localizations": { 17571 "localizations": {
17187 "de": { 17572 "de": {
@@ -17868,6 +18253,41 @@
17868 } 18253 }
17869 } 18254 }
17870 }, 18255 },
18256 "Give the old and the new name.": {
18257 "comment": "Rename Tag or TODO Keyword",
18258 "localizations": {
18259 "de": {
18260 "stringUnit": {
18261 "state": "translated",
18262 "value": "Gib den alten und den neuen Namen an."
18263 }
18264 },
18265 "es": {
18266 "stringUnit": {
18267 "state": "translated",
18268 "value": "Indica el nombre antiguo y el nuevo."
18269 }
18270 },
18271 "fr": {
18272 "stringUnit": {
18273 "state": "translated",
18274 "value": "Indiquez l'ancien et le nouveau nom."
18275 }
18276 },
18277 "ja": {
18278 "stringUnit": {
18279 "state": "translated",
18280 "value": "古い名前と新しい名前を入力してください。"
18281 }
18282 },
18283 "pt-BR": {
18284 "stringUnit": {
18285 "state": "translated",
18286 "value": "Informe o nome antigo e o novo."
18287 }
18288 }
18289 }
18290 },
17871 "Go": { 18291 "Go": {
17872 "comment": "The iPad menu bar's Go menu", 18292 "comment": "The iPad menu bar's Go menu",
17873 "localizations": { 18293 "localizations": {
@@ -19176,6 +19596,41 @@
19176 } 19596 }
19177 } 19597 }
19178 }, 19598 },
19599 "Ignore case when the search is lower case": {
19600 "comment": "Replace in Files: case-fold-search",
19601 "localizations": {
19602 "de": {
19603 "stringUnit": {
19604 "state": "translated",
19605 "value": "Groß-/Kleinschreibung ignorieren, wenn die Suche kleingeschrieben ist"
19606 }
19607 },
19608 "es": {
19609 "stringUnit": {
19610 "state": "translated",
19611 "value": "Ignorar mayúsculas si la búsqueda está en minúsculas"
19612 }
19613 },
19614 "fr": {
19615 "stringUnit": {
19616 "state": "translated",
19617 "value": "Ignorer la casse si la recherche est en minuscules"
19618 }
19619 },
19620 "ja": {
19621 "stringUnit": {
19622 "state": "translated",
19623 "value": "検索語が小文字なら大文字小文字を区別しない"
19624 }
19625 },
19626 "pt-BR": {
19627 "stringUnit": {
19628 "state": "translated",
19629 "value": "Ignorar maiúsculas quando a busca estiver em minúsculas"
19630 }
19631 }
19632 }
19633 },
19179 "Import": { 19634 "Import": {
19180 "localizations": { 19635 "localizations": {
19181 "de": { 19636 "de": {
@@ -19314,6 +19769,41 @@
19314 } 19769 }
19315 } 19770 }
19316 }, 19771 },
19772 "In": {
19773 "comment": "Rename: which folder",
19774 "localizations": {
19775 "de": {
19776 "stringUnit": {
19777 "state": "translated",
19778 "value": "In"
19779 }
19780 },
19781 "es": {
19782 "stringUnit": {
19783 "state": "translated",
19784 "value": "En"
19785 }
19786 },
19787 "fr": {
19788 "stringUnit": {
19789 "state": "translated",
19790 "value": "Dans"
19791 }
19792 },
19793 "ja": {
19794 "stringUnit": {
19795 "state": "translated",
19796 "value": "対象"
19797 }
19798 },
19799 "pt-BR": {
19800 "stringUnit": {
19801 "state": "translated",
19802 "value": "Em"
19803 }
19804 }
19805 }
19806 },
19317 "In Use": { 19807 "In Use": {
19318 "localizations": { 19808 "localizations": {
19319 "de": { 19809 "de": {
@@ -19382,6 +19872,41 @@
19382 } 19872 }
19383 } 19873 }
19384 }, 19874 },
19875 "In:": {
19876 "comment": "Replace in Files: which folder",
19877 "localizations": {
19878 "de": {
19879 "stringUnit": {
19880 "state": "translated",
19881 "value": "In:"
19882 }
19883 },
19884 "es": {
19885 "stringUnit": {
19886 "state": "translated",
19887 "value": "En:"
19888 }
19889 },
19890 "fr": {
19891 "stringUnit": {
19892 "state": "translated",
19893 "value": "Dans :"
19894 }
19895 },
19896 "ja": {
19897 "stringUnit": {
19898 "state": "translated",
19899 "value": "対象:"
19900 }
19901 },
19902 "pt-BR": {
19903 "stringUnit": {
19904 "state": "translated",
19905 "value": "Em:"
19906 }
19907 }
19908 }
19909 },
19385 "Include files in subfolders": { 19910 "Include files in subfolders": {
19386 "localizations": { 19911 "localizations": {
19387 "de": { 19912 "de": {
@@ -20983,6 +21508,41 @@
20983 } 21508 }
20984 } 21509 }
20985 }, 21510 },
21511 "Keep each match's case": {
21512 "comment": "Replace in Files: case-replace",
21513 "localizations": {
21514 "de": {
21515 "stringUnit": {
21516 "state": "translated",
21517 "value": "Schreibweise jedes Treffers beibehalten"
21518 }
21519 },
21520 "es": {
21521 "stringUnit": {
21522 "state": "translated",
21523 "value": "Conservar las mayúsculas de cada coincidencia"
21524 }
21525 },
21526 "fr": {
21527 "stringUnit": {
21528 "state": "translated",
21529 "value": "Conserver la casse de chaque occurrence"
21530 }
21531 },
21532 "ja": {
21533 "stringUnit": {
21534 "state": "translated",
21535 "value": "一致ごとの大文字小文字を保つ"
21536 }
21537 },
21538 "pt-BR": {
21539 "stringUnit": {
21540 "state": "translated",
21541 "value": "Manter maiúsculas de cada ocorrência"
21542 }
21543 }
21544 }
21545 },
20986 "Keep orgstar in the menu bar": { 21546 "Keep orgstar in the menu bar": {
20987 "localizations": { 21547 "localizations": {
20988 "de": { 21548 "de": {
@@ -21154,6 +21714,41 @@
21154 } 21714 }
21155 } 21715 }
21156 }, 21716 },
21717 "Keyword": {
21718 "comment": "Rename TODO Keyword: the old name",
21719 "localizations": {
21720 "de": {
21721 "stringUnit": {
21722 "state": "translated",
21723 "value": "Schlüsselwort"
21724 }
21725 },
21726 "es": {
21727 "stringUnit": {
21728 "state": "translated",
21729 "value": "Palabra clave"
21730 }
21731 },
21732 "fr": {
21733 "stringUnit": {
21734 "state": "translated",
21735 "value": "Mot-clé"
21736 }
21737 },
21738 "ja": {
21739 "stringUnit": {
21740 "state": "translated",
21741 "value": "キーワード"
21742 }
21743 },
21744 "pt-BR": {
21745 "stringUnit": {
21746 "state": "translated",
21747 "value": "Palavra-chave"
21748 }
21749 }
21750 }
21751 },
21157 "Keyword flags such as DONE(d!) and #+STARTUP words in a file override these. org-log-reschedule and org-log-redeadline are in config.toml.": { 21752 "Keyword flags such as DONE(d!) and #+STARTUP words in a file override these. org-log-reschedule and org-log-redeadline are in config.toml.": {
21158 "localizations": { 21753 "localizations": {
21159 "de": { 21754 "de": {
@@ -21188,6 +21783,41 @@
21188 } 21783 }
21189 } 21784 }
21190 }, 21785 },
21786 "Keyword:": {
21787 "comment": "Rename TODO Keyword: the old name",
21788 "localizations": {
21789 "de": {
21790 "stringUnit": {
21791 "state": "translated",
21792 "value": "Schlüsselwort:"
21793 }
21794 },
21795 "es": {
21796 "stringUnit": {
21797 "state": "translated",
21798 "value": "Palabra clave:"
21799 }
21800 },
21801 "fr": {
21802 "stringUnit": {
21803 "state": "translated",
21804 "value": "Mot-clé :"
21805 }
21806 },
21807 "ja": {
21808 "stringUnit": {
21809 "state": "translated",
21810 "value": "キーワード:"
21811 }
21812 },
21813 "pt-BR": {
21814 "stringUnit": {
21815 "state": "translated",
21816 "value": "Palavra-chave:"
21817 }
21818 }
21819 }
21820 },
21191 "Kill Line": { 21821 "Kill Line": {
21192 "comment": "Command title", 21822 "comment": "Command title",
21193 "localizations": { 21823 "localizations": {
@@ -21882,6 +22512,41 @@
21882 } 22512 }
21883 } 22513 }
21884 }, 22514 },
22515 "Line %lld: %@": {
22516 "comment": "Replace in Files: a change, for VoiceOver",
22517 "localizations": {
22518 "de": {
22519 "stringUnit": {
22520 "state": "translated",
22521 "value": "Zeile %1$lld: %2$@"
22522 }
22523 },
22524 "es": {
22525 "stringUnit": {
22526 "state": "translated",
22527 "value": "Línea %1$lld: %2$@"
22528 }
22529 },
22530 "fr": {
22531 "stringUnit": {
22532 "state": "translated",
22533 "value": "Ligne %1$lld : %2$@"
22534 }
22535 },
22536 "ja": {
22537 "stringUnit": {
22538 "state": "translated",
22539 "value": "%1$lld 行: %2$@"
22540 }
22541 },
22542 "pt-BR": {
22543 "stringUnit": {
22544 "state": "translated",
22545 "value": "Linha %1$lld: %2$@"
22546 }
22547 }
22548 }
22549 },
21885 "Line Numbers": { 22550 "Line Numbers": {
21886 "localizations": { 22551 "localizations": {
21887 "de": { 22552 "de": {
@@ -24844,6 +25509,76 @@
24844 } 25509 }
24845 } 25510 }
24846 }, 25511 },
25512 "New name": {
25513 "comment": "Rename: the new name",
25514 "localizations": {
25515 "de": {
25516 "stringUnit": {
25517 "state": "translated",
25518 "value": "Neuer Name"
25519 }
25520 },
25521 "es": {
25522 "stringUnit": {
25523 "state": "translated",
25524 "value": "Nombre nuevo"
25525 }
25526 },
25527 "fr": {
25528 "stringUnit": {
25529 "state": "translated",
25530 "value": "Nouveau nom"
25531 }
25532 },
25533 "ja": {
25534 "stringUnit": {
25535 "state": "translated",
25536 "value": "新しい名前"
25537 }
25538 },
25539 "pt-BR": {
25540 "stringUnit": {
25541 "state": "translated",
25542 "value": "Novo nome"
25543 }
25544 }
25545 }
25546 },
25547 "New name:": {
25548 "comment": "Rename: the new name",
25549 "localizations": {
25550 "de": {
25551 "stringUnit": {
25552 "state": "translated",
25553 "value": "Neuer Name:"
25554 }
25555 },
25556 "es": {
25557 "stringUnit": {
25558 "state": "translated",
25559 "value": "Nombre nuevo:"
25560 }
25561 },
25562 "fr": {
25563 "stringUnit": {
25564 "state": "translated",
25565 "value": "Nouveau nom :"
25566 }
25567 },
25568 "ja": {
25569 "stringUnit": {
25570 "state": "translated",
25571 "value": "新しい名前:"
25572 }
25573 },
25574 "pt-BR": {
25575 "stringUnit": {
25576 "state": "translated",
25577 "value": "Novo nome:"
25578 }
25579 }
25580 }
25581 },
24847 "New tag": { 25582 "New tag": {
24848 "localizations": { 25583 "localizations": {
24849 "de": { 25584 "de": {
@@ -25878,6 +26613,41 @@
25878 } 26613 }
25879 } 26614 }
25880 }, 26615 },
26616 "No Matches": {
26617 "comment": "Replace in Files: the search found nothing",
26618 "localizations": {
26619 "de": {
26620 "stringUnit": {
26621 "state": "translated",
26622 "value": "Keine Treffer"
26623 }
26624 },
26625 "es": {
26626 "stringUnit": {
26627 "state": "translated",
26628 "value": "Sin coincidencias"
26629 }
26630 },
26631 "fr": {
26632 "stringUnit": {
26633 "state": "translated",
26634 "value": "Aucune occurrence"
26635 }
26636 },
26637 "ja": {
26638 "stringUnit": {
26639 "state": "translated",
26640 "value": "一致なし"
26641 }
26642 },
26643 "pt-BR": {
26644 "stringUnit": {
26645 "state": "translated",
26646 "value": "Nenhuma ocorrência"
26647 }
26648 }
26649 }
26650 },
25881 "No Messages": { 26651 "No Messages": {
25882 "localizations": { 26652 "localizations": {
25883 "de": { 26653 "de": {
@@ -26969,6 +27739,41 @@
26969 } 27739 }
26970 } 27740 }
26971 }, 27741 },
27742 "Not a regular expression: %@": {
27743 "comment": "Replace in Files",
27744 "localizations": {
27745 "de": {
27746 "stringUnit": {
27747 "state": "translated",
27748 "value": "Kein regulärer Ausdruck: %@"
27749 }
27750 },
27751 "es": {
27752 "stringUnit": {
27753 "state": "translated",
27754 "value": "No es una expresión regular: %@"
27755 }
27756 },
27757 "fr": {
27758 "stringUnit": {
27759 "state": "translated",
27760 "value": "Pas une expression régulière : %@"
27761 }
27762 },
27763 "ja": {
27764 "stringUnit": {
27765 "state": "translated",
27766 "value": "正規表現ではありません: %@"
27767 }
27768 },
27769 "pt-BR": {
27770 "stringUnit": {
27771 "state": "translated",
27772 "value": "Não é uma expressão regular: %@"
27773 }
27774 }
27775 }
27776 },
26972 "Not an encrypted entry": { 27777 "Not an encrypted entry": {
26973 "localizations": { 27778 "localizations": {
26974 "de": { 27779 "de": {
@@ -27690,6 +28495,41 @@
27690 } 28495 }
27691 } 28496 }
27692 }, 28497 },
28498 "Nothing to search for": {
28499 "comment": "Replace in Files: the search field is empty",
28500 "localizations": {
28501 "de": {
28502 "stringUnit": {
28503 "state": "translated",
28504 "value": "Nichts zu suchen"
28505 }
28506 },
28507 "es": {
28508 "stringUnit": {
28509 "state": "translated",
28510 "value": "Nada que buscar"
28511 }
28512 },
28513 "fr": {
28514 "stringUnit": {
28515 "state": "translated",
28516 "value": "Rien à rechercher"
28517 }
28518 },
28519 "ja": {
28520 "stringUnit": {
28521 "state": "translated",
28522 "value": "検索する語がありません"
28523 }
28524 },
28525 "pt-BR": {
28526 "stringUnit": {
28527 "state": "translated",
28528 "value": "Nada para buscar"
28529 }
28530 }
28531 }
28532 },
27693 "Notifications": { 28533 "Notifications": {
27694 "localizations": { 28534 "localizations": {
27695 "de": { 28535 "de": {
@@ -32230,6 +33070,41 @@
32230 } 33070 }
32231 } 33071 }
32232 }, 33072 },
33073 "Regular expression": {
33074 "comment": "Replace in Files",
33075 "localizations": {
33076 "de": {
33077 "stringUnit": {
33078 "state": "translated",
33079 "value": "Regulärer Ausdruck"
33080 }
33081 },
33082 "es": {
33083 "stringUnit": {
33084 "state": "translated",
33085 "value": "Expresión regular"
33086 }
33087 },
33088 "fr": {
33089 "stringUnit": {
33090 "state": "translated",
33091 "value": "Expression régulière"
33092 }
33093 },
33094 "ja": {
33095 "stringUnit": {
33096 "state": "translated",
33097 "value": "正規表現"
33098 }
33099 },
33100 "pt-BR": {
33101 "stringUnit": {
33102 "state": "translated",
33103 "value": "Expressão regular"
33104 }
33105 }
33106 }
33107 },
32233 "Relative": { 33108 "Relative": {
32234 "localizations": { 33109 "localizations": {
32235 "de": { 33110 "de": {
@@ -33222,6 +34097,146 @@
33222 } 34097 }
33223 } 34098 }
33224 }, 34099 },
34100 "Rename TODO Keyword": {
34101 "comment": "Window title",
34102 "localizations": {
34103 "de": {
34104 "stringUnit": {
34105 "state": "translated",
34106 "value": "TODO-Schlüsselwort umbenennen"
34107 }
34108 },
34109 "es": {
34110 "stringUnit": {
34111 "state": "translated",
34112 "value": "Cambiar nombre de palabra clave TODO"
34113 }
34114 },
34115 "fr": {
34116 "stringUnit": {
34117 "state": "translated",
34118 "value": "Renommer le mot-clé TODO"
34119 }
34120 },
34121 "ja": {
34122 "stringUnit": {
34123 "state": "translated",
34124 "value": "TODO キーワードの名前を変更"
34125 }
34126 },
34127 "pt-BR": {
34128 "stringUnit": {
34129 "state": "translated",
34130 "value": "Renomear Palavra-chave TODO"
34131 }
34132 }
34133 }
34134 },
34135 "Rename TODO Keyword…": {
34136 "comment": "Command title",
34137 "localizations": {
34138 "de": {
34139 "stringUnit": {
34140 "state": "translated",
34141 "value": "TODO-Schlüsselwort umbenennen …"
34142 }
34143 },
34144 "es": {
34145 "stringUnit": {
34146 "state": "translated",
34147 "value": "Cambiar nombre de palabra clave TODO…"
34148 }
34149 },
34150 "fr": {
34151 "stringUnit": {
34152 "state": "translated",
34153 "value": "Renommer le mot-clé TODO…"
34154 }
34155 },
34156 "ja": {
34157 "stringUnit": {
34158 "state": "translated",
34159 "value": "TODO キーワードの名前を変更…"
34160 }
34161 },
34162 "pt-BR": {
34163 "stringUnit": {
34164 "state": "translated",
34165 "value": "Renomear Palavra-chave TODO…"
34166 }
34167 }
34168 }
34169 },
34170 "Rename Tag": {
34171 "comment": "Window title",
34172 "localizations": {
34173 "de": {
34174 "stringUnit": {
34175 "state": "translated",
34176 "value": "Tag umbenennen"
34177 }
34178 },
34179 "es": {
34180 "stringUnit": {
34181 "state": "translated",
34182 "value": "Cambiar nombre de etiqueta"
34183 }
34184 },
34185 "fr": {
34186 "stringUnit": {
34187 "state": "translated",
34188 "value": "Renommer l'étiquette"
34189 }
34190 },
34191 "ja": {
34192 "stringUnit": {
34193 "state": "translated",
34194 "value": "タグの名前を変更"
34195 }
34196 },
34197 "pt-BR": {
34198 "stringUnit": {
34199 "state": "translated",
34200 "value": "Renomear Etiqueta"
34201 }
34202 }
34203 }
34204 },
34205 "Rename Tag…": {
34206 "comment": "Command title",
34207 "localizations": {
34208 "de": {
34209 "stringUnit": {
34210 "state": "translated",
34211 "value": "Tag umbenennen …"
34212 }
34213 },
34214 "es": {
34215 "stringUnit": {
34216 "state": "translated",
34217 "value": "Cambiar nombre de etiqueta…"
34218 }
34219 },
34220 "fr": {
34221 "stringUnit": {
34222 "state": "translated",
34223 "value": "Renommer l'étiquette…"
34224 }
34225 },
34226 "ja": {
34227 "stringUnit": {
34228 "state": "translated",
34229 "value": "タグの名前を変更…"
34230 }
34231 },
34232 "pt-BR": {
34233 "stringUnit": {
34234 "state": "translated",
34235 "value": "Renomear Etiqueta…"
34236 }
34237 }
34238 }
34239 },
33225 "Rename…": { 34240 "Rename…": {
33226 "localizations": { 34241 "localizations": {
33227 "de": { 34242 "de": {
@@ -33360,6 +34375,146 @@
33360 } 34375 }
33361 } 34376 }
33362 }, 34377 },
34378 "Replace": {
34379 "comment": "Replace in Files: applies the ticked changes",
34380 "localizations": {
34381 "de": {
34382 "stringUnit": {
34383 "state": "translated",
34384 "value": "Ersetzen"
34385 }
34386 },
34387 "es": {
34388 "stringUnit": {
34389 "state": "translated",
34390 "value": "Reemplazar"
34391 }
34392 },
34393 "fr": {
34394 "stringUnit": {
34395 "state": "translated",
34396 "value": "Remplacer"
34397 }
34398 },
34399 "ja": {
34400 "stringUnit": {
34401 "state": "translated",
34402 "value": "置換"
34403 }
34404 },
34405 "pt-BR": {
34406 "stringUnit": {
34407 "state": "translated",
34408 "value": "Substituir"
34409 }
34410 }
34411 }
34412 },
34413 "Replace in Files": {
34414 "comment": "Window title",
34415 "localizations": {
34416 "de": {
34417 "stringUnit": {
34418 "state": "translated",
34419 "value": "In Dateien ersetzen"
34420 }
34421 },
34422 "es": {
34423 "stringUnit": {
34424 "state": "translated",
34425 "value": "Reemplazar en archivos"
34426 }
34427 },
34428 "fr": {
34429 "stringUnit": {
34430 "state": "translated",
34431 "value": "Remplacer dans les fichiers"
34432 }
34433 },
34434 "ja": {
34435 "stringUnit": {
34436 "state": "translated",
34437 "value": "ファイル内で置換"
34438 }
34439 },
34440 "pt-BR": {
34441 "stringUnit": {
34442 "state": "translated",
34443 "value": "Substituir em Arquivos"
34444 }
34445 }
34446 }
34447 },
34448 "Replace in Files…": {
34449 "comment": "Command title",
34450 "localizations": {
34451 "de": {
34452 "stringUnit": {
34453 "state": "translated",
34454 "value": "In Dateien ersetzen …"
34455 }
34456 },
34457 "es": {
34458 "stringUnit": {
34459 "state": "translated",
34460 "value": "Reemplazar en archivos…"
34461 }
34462 },
34463 "fr": {
34464 "stringUnit": {
34465 "state": "translated",
34466 "value": "Remplacer dans les fichiers…"
34467 }
34468 },
34469 "ja": {
34470 "stringUnit": {
34471 "state": "translated",
34472 "value": "ファイル内で置換…"
34473 }
34474 },
34475 "pt-BR": {
34476 "stringUnit": {
34477 "state": "translated",
34478 "value": "Substituir em Arquivos…"
34479 }
34480 }
34481 }
34482 },
34483 "Replace with:": {
34484 "comment": "Replace in Files: the replacement field",
34485 "localizations": {
34486 "de": {
34487 "stringUnit": {
34488 "state": "translated",
34489 "value": "Ersetzen durch:"
34490 }
34491 },
34492 "es": {
34493 "stringUnit": {
34494 "state": "translated",
34495 "value": "Reemplazar por:"
34496 }
34497 },
34498 "fr": {
34499 "stringUnit": {
34500 "state": "translated",
34501 "value": "Remplacer par :"
34502 }
34503 },
34504 "ja": {
34505 "stringUnit": {
34506 "state": "translated",
34507 "value": "置換後:"
34508 }
34509 },
34510 "pt-BR": {
34511 "stringUnit": {
34512 "state": "translated",
34513 "value": "Substituir por:"
34514 }
34515 }
34516 }
34517 },
33363 "Report": { 34518 "Report": {
33364 "localizations": { 34519 "localizations": {
33365 "de": { 34520 "de": {
@@ -35002,75 +36157,110 @@
35002 "pt-BR": { 36157 "pt-BR": {
35003 "stringUnit": { 36158 "stringUnit": {
35004 "state": "translated", 36159 "state": "translated",
35005 "value": "Buscar nas Notas" 36160 "value": "Buscar nas Notas"
36161 }
36162 }
36163 }
36164 },
36165 "Search notes": {
36166 "localizations": {
36167 "de": {
36168 "stringUnit": {
36169 "state": "translated",
36170 "value": "Notizen durchsuchen"
36171 }
36172 },
36173 "es": {
36174 "stringUnit": {
36175 "state": "translated",
36176 "value": "Buscar en notas"
36177 }
36178 },
36179 "fr": {
36180 "stringUnit": {
36181 "state": "translated",
36182 "value": "Rechercher dans les notes"
36183 }
36184 },
36185 "ja": {
36186 "stringUnit": {
36187 "state": "translated",
36188 "value": "メモを検索"
36189 }
36190 },
36191 "pt-BR": {
36192 "stringUnit": {
36193 "state": "translated",
36194 "value": "Buscar nas notas"
35006 } 36195 }
35007 } 36196 }
35008 } 36197 }
35009 }, 36198 },
35010 "Search notes": { 36199 "Search: a phrase, or +word -word {regexp}; * for headlines, ! for TODO entries": {
35011 "localizations": { 36200 "localizations": {
35012 "de": { 36201 "de": {
35013 "stringUnit": { 36202 "stringUnit": {
35014 "state": "translated", 36203 "state": "translated",
35015 "value": "Notizen durchsuchen" 36204 "value": "Suche: ein Ausdruck oder +Wort -Wort {Regexp}; * für Überschriften, ! für TODO-Einträge"
35016 } 36205 }
35017 }, 36206 },
35018 "es": { 36207 "es": {
35019 "stringUnit": { 36208 "stringUnit": {
35020 "state": "translated", 36209 "state": "translated",
35021 "value": "Buscar en notas" 36210 "value": "Buscar: una frase, o +palabra -palabra {regexp}; * para encabezados, ! para entradas TODO"
35022 } 36211 }
35023 }, 36212 },
35024 "fr": { 36213 "fr": {
35025 "stringUnit": { 36214 "stringUnit": {
35026 "state": "translated", 36215 "state": "translated",
35027 "value": "Rechercher dans les notes" 36216 "value": "Rechercher : une expression, ou +mot -mot {regexp} ; * pour les titres, ! pour les entrées TODO"
35028 } 36217 }
35029 }, 36218 },
35030 "ja": { 36219 "ja": {
35031 "stringUnit": { 36220 "stringUnit": {
35032 "state": "translated", 36221 "state": "translated",
35033 "value": "メモを検索" 36222 "value": "検索:フレーズ、または +単語 -単語 {正規表現}。* で見出し、! でTODOエントリ"
35034 } 36223 }
35035 }, 36224 },
35036 "pt-BR": { 36225 "pt-BR": {
35037 "stringUnit": { 36226 "stringUnit": {
35038 "state": "translated", 36227 "state": "translated",
35039 "value": "Buscar nas notas" 36228 "value": "Buscar: uma frase, ou +palavra -palavra {regexp}; * para cabeçalhos, ! para entradas TODO"
35040 } 36229 }
35041 } 36230 }
35042 } 36231 }
35043 }, 36232 },
35044 "Search: a phrase, or +word -word {regexp}; * for headlines, ! for TODO entries": { 36233 "Searched %lld of %lld files": {
36234 "comment": "Replace in Files: progress",
35045 "localizations": { 36235 "localizations": {
35046 "de": { 36236 "de": {
35047 "stringUnit": { 36237 "stringUnit": {
35048 "state": "translated", 36238 "state": "translated",
35049 "value": "Suche: ein Ausdruck oder +Wort -Wort {Regexp}; * für Überschriften, ! für TODO-Einträge" 36239 "value": "%1$lld von %2$lld Dateien durchsucht"
35050 } 36240 }
35051 }, 36241 },
35052 "es": { 36242 "es": {
35053 "stringUnit": { 36243 "stringUnit": {
35054 "state": "translated", 36244 "state": "translated",
35055 "value": "Buscar: una frase, o +palabra -palabra {regexp}; * para encabezados, ! para entradas TODO" 36245 "value": "Buscados %1$lld de %2$lld archivos"
35056 } 36246 }
35057 }, 36247 },
35058 "fr": { 36248 "fr": {
35059 "stringUnit": { 36249 "stringUnit": {
35060 "state": "translated", 36250 "state": "translated",
35061 "value": "Rechercher : une expression, ou +mot -mot {regexp} ; * pour les titres, ! pour les entrées TODO" 36251 "value": "%1$lld fichiers sur %2$lld parcourus"
35062 } 36252 }
35063 }, 36253 },
35064 "ja": { 36254 "ja": {
35065 "stringUnit": { 36255 "stringUnit": {
35066 "state": "translated", 36256 "state": "translated",
35067 "value": "検索:フレーズ、または +単語 -単語 {正規表現}。* で見出し、! でTODOエントリ" 36257 "value": "%2$lld 件中 %1$lld 件のファイルを検索済み"
35068 } 36258 }
35069 }, 36259 },
35070 "pt-BR": { 36260 "pt-BR": {
35071 "stringUnit": { 36261 "stringUnit": {
35072 "state": "translated", 36262 "state": "translated",
35073 "value": "Buscar: uma frase, ou +palavra -palavra {regexp}; * para cabeçalhos, ! para entradas TODO" 36263 "value": "%1$lld de %2$lld arquivos pesquisados"
35074 } 36264 }
35075 } 36265 }
35076 } 36266 }
@@ -38492,6 +39682,41 @@
38492 } 39682 }
38493 } 39683 }
38494 }, 39684 },
39685 "Stop": {
39686 "comment": "Replace in Files: stops the search",
39687 "localizations": {
39688 "de": {
39689 "stringUnit": {
39690 "state": "translated",
39691 "value": "Stopp"
39692 }
39693 },
39694 "es": {
39695 "stringUnit": {
39696 "state": "translated",
39697 "value": "Detener"
39698 }
39699 },
39700 "fr": {
39701 "stringUnit": {
39702 "state": "translated",
39703 "value": "Arrêter"
39704 }
39705 },
39706 "ja": {
39707 "stringUnit": {
39708 "state": "translated",
39709 "value": "停止"
39710 }
39711 },
39712 "pt-BR": {
39713 "stringUnit": {
39714 "state": "translated",
39715 "value": "Parar"
39716 }
39717 }
39718 }
39719 },
38495 "Stop Macro or Run Last Macro": { 39720 "Stop Macro or Run Last Macro": {
38496 "comment": "Command title", 39721 "comment": "Command title",
38497 "localizations": { 39722 "localizations": {
@@ -38665,6 +39890,41 @@
38665 } 39890 }
38666 } 39891 }
38667 }, 39892 },
39893 "Stopped": {
39894 "comment": "Replace in Files: the search was stopped",
39895 "localizations": {
39896 "de": {
39897 "stringUnit": {
39898 "state": "translated",
39899 "value": "Angehalten"
39900 }
39901 },
39902 "es": {
39903 "stringUnit": {
39904 "state": "translated",
39905 "value": "Detenida"
39906 }
39907 },
39908 "fr": {
39909 "stringUnit": {
39910 "state": "translated",
39911 "value": "Arrêtée"
39912 }
39913 },
39914 "ja": {
39915 "stringUnit": {
39916 "state": "translated",
39917 "value": "停止しました"
39918 }
39919 },
39920 "pt-BR": {
39921 "stringUnit": {
39922 "state": "translated",
39923 "value": "Interrompida"
39924 }
39925 }
39926 }
39927 },
38668 "Stops the running clock.": { 39928 "Stops the running clock.": {
38669 "localizations": { 39929 "localizations": {
38670 "de": { 39930 "de": {
@@ -39458,6 +40718,41 @@
39458 } 40718 }
39459 } 40719 }
39460 }, 40720 },
40721 "Tag": {
40722 "comment": "Rename Tag: the old name",
40723 "localizations": {
40724 "de": {
40725 "stringUnit": {
40726 "state": "translated",
40727 "value": "Tag"
40728 }
40729 },
40730 "es": {
40731 "stringUnit": {
40732 "state": "translated",
40733 "value": "Etiqueta"
40734 }
40735 },
40736 "fr": {
40737 "stringUnit": {
40738 "state": "translated",
40739 "value": "Étiquette"
40740 }
40741 },
40742 "ja": {
40743 "stringUnit": {
40744 "state": "translated",
40745 "value": "タグ"
40746 }
40747 },
40748 "pt-BR": {
40749 "stringUnit": {
40750 "state": "translated",
40751 "value": "Etiqueta"
40752 }
40753 }
40754 }
40755 },
39461 "Tag filter (+tag-tag):": { 40756 "Tag filter (+tag-tag):": {
39462 "localizations": { 40757 "localizations": {
39463 "de": { 40758 "de": {
@@ -40891,6 +42186,41 @@
40891 } 42186 }
40892 } 42187 }
40893 }, 42188 },
42189 "The new name is the old one.": {
42190 "comment": "Rename Tag or TODO Keyword",
42191 "localizations": {
42192 "de": {
42193 "stringUnit": {
42194 "state": "translated",
42195 "value": "Der neue Name ist der alte."
42196 }
42197 },
42198 "es": {
42199 "stringUnit": {
42200 "state": "translated",
42201 "value": "El nombre nuevo es el antiguo."
42202 }
42203 },
42204 "fr": {
42205 "stringUnit": {
42206 "state": "translated",
42207 "value": "Le nouveau nom est l'ancien."
42208 }
42209 },
42210 "ja": {
42211 "stringUnit": {
42212 "state": "translated",
42213 "value": "新しい名前が古い名前と同じです。"
42214 }
42215 },
42216 "pt-BR": {
42217 "stringUnit": {
42218 "state": "translated",
42219 "value": "O novo nome é o antigo."
42220 }
42221 }
42222 }
42223 },
40894 "The next agenda entry, or how many are open today.": { 42224 "The next agenda entry, or how many are open today.": {
40895 "localizations": { 42225 "localizations": {
40896 "de": { 42226 "de": {
@@ -43584,6 +44914,41 @@
43584 } 44914 }
43585 } 44915 }
43586 }, 44916 },
44917 "Was \"%@\"": {
44918 "comment": "Rename: the config.toml setting before the change",
44919 "localizations": {
44920 "de": {
44921 "stringUnit": {
44922 "state": "translated",
44923 "value": "Vorher „%@“"
44924 }
44925 },
44926 "es": {
44927 "stringUnit": {
44928 "state": "translated",
44929 "value": "Antes «%@»"
44930 }
44931 },
44932 "fr": {
44933 "stringUnit": {
44934 "state": "translated",
44935 "value": "Avant « %@ »"
44936 }
44937 },
44938 "ja": {
44939 "stringUnit": {
44940 "state": "translated",
44941 "value": "変更前「%@」"
44942 }
44943 },
44944 "pt-BR": {
44945 "stringUnit": {
44946 "state": "translated",
44947 "value": "Antes \"%@\""
44948 }
44949 }
44950 }
44951 },
43587 "Website": { 44952 "Website": {
43588 "localizations": { 44953 "localizations": {
43589 "de": { 44954 "de": {
@@ -44817,6 +46182,41 @@
44817 "[%@]": { 46182 "[%@]": {
44818 "shouldTranslate": false 46183 "shouldTranslate": false
44819 }, 46184 },
46185 "\\1 or $1 for a group": {
46186 "comment": "Replace in Files: placeholder of the replacement field",
46187 "localizations": {
46188 "de": {
46189 "stringUnit": {
46190 "state": "translated",
46191 "value": "\\1 oder $1 für eine Gruppe"
46192 }
46193 },
46194 "es": {
46195 "stringUnit": {
46196 "state": "translated",
46197 "value": "\\1 o $1 para un grupo"
46198 }
46199 },
46200 "fr": {
46201 "stringUnit": {
46202 "state": "translated",
46203 "value": "\\1 ou $1 pour un groupe"
46204 }
46205 },
46206 "ja": {
46207 "stringUnit": {
46208 "state": "translated",
46209 "value": "グループは \\1 または $1"
46210 }
46211 },
46212 "pt-BR": {
46213 "stringUnit": {
46214 "state": "translated",
46215 "value": "\\1 ou $1 para um grupo"
46216 }
46217 }
46218 }
46219 },
44820 "a closure as a list": { 46220 "a closure as a list": {
44821 "localizations": { 46221 "localizations": {
44822 "de": { 46222 "de": {
@@ -45069,6 +46469,76 @@
45069 } 46469 }
45070 } 46470 }
45071 }, 46471 },
46472 "case-fold-search: a search with an upper-case letter matches case exactly": {
46473 "comment": "Replace in Files: help",
46474 "localizations": {
46475 "de": {
46476 "stringUnit": {
46477 "state": "translated",
46478 "value": "case-fold-search: Eine Suche mit einem Großbuchstaben beachtet die Schreibweise genau"
46479 }
46480 },
46481 "es": {
46482 "stringUnit": {
46483 "state": "translated",
46484 "value": "case-fold-search: una búsqueda con una mayúscula distingue mayúsculas"
46485 }
46486 },
46487 "fr": {
46488 "stringUnit": {
46489 "state": "translated",
46490 "value": "case-fold-search : une recherche avec une majuscule respecte la casse"
46491 }
46492 },
46493 "ja": {
46494 "stringUnit": {
46495 "state": "translated",
46496 "value": "case-fold-search: 大文字を含む検索は大文字小文字を区別します"
46497 }
46498 },
46499 "pt-BR": {
46500 "stringUnit": {
46501 "state": "translated",
46502 "value": "case-fold-search: uma busca com letra maiúscula diferencia maiúsculas"
46503 }
46504 }
46505 }
46506 },
46507 "case-replace: FOO becomes BAR and Foo becomes Bar": {
46508 "comment": "Replace in Files: help",
46509 "localizations": {
46510 "de": {
46511 "stringUnit": {
46512 "state": "translated",
46513 "value": "case-replace: Aus FOO wird BAR und aus Foo wird Bar"
46514 }
46515 },
46516 "es": {
46517 "stringUnit": {
46518 "state": "translated",
46519 "value": "case-replace: FOO pasa a BAR y Foo pasa a Bar"
46520 }
46521 },
46522 "fr": {
46523 "stringUnit": {
46524 "state": "translated",
46525 "value": "case-replace : FOO devient BAR et Foo devient Bar"
46526 }
46527 },
46528 "ja": {
46529 "stringUnit": {
46530 "state": "translated",
46531 "value": "case-replace: FOO は BAR に、Foo は Bar になります"
46532 }
46533 },
46534 "pt-BR": {
46535 "stringUnit": {
46536 "state": "translated",
46537 "value": "case-replace: FOO vira BAR e Foo vira Bar"
46538 }
46539 }
46540 }
46541 },
45072 "chained comparison": { 46542 "chained comparison": {
45073 "localizations": { 46543 "localizations": {
45074 "de": { 46544 "de": {
@@ -45419,6 +46889,41 @@
45419 "config.toml": { 46889 "config.toml": {
45420 "shouldTranslate": false 46890 "shouldTranslate": false
45421 }, 46891 },
46892 "config.toml changed": {
46893 "comment": "Replace in Files: after applying",
46894 "localizations": {
46895 "de": {
46896 "stringUnit": {
46897 "state": "translated",
46898 "value": "config.toml geändert"
46899 }
46900 },
46901 "es": {
46902 "stringUnit": {
46903 "state": "translated",
46904 "value": "config.toml cambiado"
46905 }
46906 },
46907 "fr": {
46908 "stringUnit": {
46909 "state": "translated",
46910 "value": "config.toml modifié"
46911 }
46912 },
46913 "ja": {
46914 "stringUnit": {
46915 "state": "translated",
46916 "value": "config.toml を変更しました"
46917 }
46918 },
46919 "pt-BR": {
46920 "stringUnit": {
46921 "state": "translated",
46922 "value": "config.toml alterado"
46923 }
46924 }
46925 }
46926 },
45422 "constants that refer to themselves": { 46927 "constants that refer to themselves": {
45423 "localizations": { 46928 "localizations": {
45424 "de": { 46929 "de": {
Keyboard shortcuts

Global

⌘K
Command palette & jump
/
Focus search
?
Show this help
g d
Dashboard
g e
Explore repositories
g n
Notifications

Repository & editor

t
Find file in repository
y
Copy immutable SHA permalink
g c
Code tab
g i
Issues tab
g m
Merge requests tab
g b
Builds tab
⌘↵
Submit active form