Completion: opens by itself, fuzzy, words, index !483

merged merged by cmc on 2026-11-26 05:35 UTC · krz/orgstar:m4-completion into main

4 files changed, +15 −41

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

Layout: unified · split

Changed files (4)
Sources/OrgstarMobile/EditorScreen.swift +3 · view
@@ -385,6 +385,8 @@ struct EditorScreen: View {
385385 bind(editor)
386386 editor.focus(view)
387387 }
388 // A kept editor missed settings changed while it was off screen.
389 editor.options = editorOptions
388390 self.editor = editor
389391 textView = view
390392 if let offset { editor.reveal(offset) }
@@ -1027,6 +1029,7 @@ struct CommandPalette: View {
10271029 ("org.snippet.next-field", "Next Snippet Field"), ("org.snippet.previous-field", "Previous Snippet Field"),
10281030 ("app.recovery", "Recovery Versions…"), ("app.sync-conflicts", "Resolve Sync Conflicts…"),
10291031 ("org.toggle-inline-images", "Show or Hide Inline Images"), ("org.toggle-inline-images-linked", "Show or Hide Inline Images, Including Described Links"), ("org.latex-preview", "Show or Hide LaTeX Previews"), ("editor.toggle-truncate-lines", "Truncate or Wrap Long Lines"), ("editor.toggle-auto-fill", "Turn Auto Fill On or Off"),
1032 ("editor.complete", "Complete at Point"), ("editor.dabbrev-expand", "Expand Word"), ("editor.dabbrev-completion", "Complete Word"),
10301033 ("edit.isearch-forward", "Incremental Search"), ("edit.isearch-backward", "Incremental Search Backward"),
10311034 ("org.table.toggle-column-width", "Shrink or Expand Table Column"), ("org.table.shrink", "Shrink Table Columns with Widths"),
10321035 ("org.table.expand", "Expand Table Columns"),
Sources/OrgstarMobile/MobileEditor+Completion.swift +11 −6 · view
@@ -34,8 +34,9 @@ final class CompletionListView: UIView {
3434
3535 func key(_ chord: KeyChord) -> CompletionList.Action { list.key(chord) }
3636
37 /// Lays the rows out with their top left at `point`, kept inside `bounds`.
38 func show(at point: CGPoint, within bounds: CGRect, font: UIFont) {
37 /// Lays the rows out under `caret`, or above it when there isn't room below, kept inside
38 /// `bounds`: the part of the text view not under the keyboard and the key bar.
39 func show(under caret: CGRect, within bounds: CGRect, font: UIFont) {
3940 stack.arrangedSubviews.forEach { $0.removeFromSuperview() }
4041 var width: CGFloat = 80
4142 for index in list.visible(rows: Self.rows) {
@@ -55,8 +56,10 @@ final class CompletionListView: UIView {
5556 }
5657 width = min(width, bounds.width - 16)
5758 let height = stack.systemLayoutSizeFitting(UIView.layoutFittingCompressedSize).height
58 let x = min(max(bounds.minX + 8, point.x), bounds.maxX - width - 8)
59 frame = CGRect(x: x, y: point.y + 2, width: width, height: height)
59 let x = min(max(bounds.minX + 8, caret.minX), bounds.maxX - width - 8)
60 let below = caret.maxY + 2
61 let y = below + height <= bounds.maxY || caret.minY - 2 - height < bounds.minY ? below : caret.minY - 2 - height
62 frame = CGRect(x: x, y: y, width: width, height: height)
6063 stack.frame = CGRect(origin: .zero, size: frame.size)
6164 }
6265
@@ -139,8 +142,10 @@ extension MobileEditor {
139142 }
140143 guard let position = textView.position(from: textView.beginningOfDocument, offset: completion.range.lowerBound) else { return }
141144 let caret = textView.caretRect(for: position)
142 let visible = CGRect(origin: textView.contentOffset, size: textView.bounds.size)
143 view.show(at: CGPoint(x: caret.minX, y: caret.maxY), within: visible, font: theme.font)
145 let insets = textView.adjustedContentInset
146 let visible = CGRect(x: textView.contentOffset.x, y: textView.contentOffset.y + insets.top,
147 width: textView.bounds.width, height: textView.bounds.height - insets.top - insets.bottom)
148 view.show(under: caret, within: visible, font: theme.font)
144149 }
145150
146151 func closeCompletion() {
Sources/OrgstarMobile/SettingsScreen.swift +1 −1 · view
@@ -155,7 +155,7 @@ struct SettingsScreen: View {
155155 } header: {
156156 Text("Completion")
157157 } footer: {
158 Text("With a hardware keyboard. Doom's keys open the list by itself and match letters in order, as Doom's corfu does; the Emacs and Mac keys do neither unless set here.")
158 Text("Doom's keys open the list by itself and match letters in order, as Doom's corfu does; the Emacs and Mac keys do neither unless set here. Expand Word completes the word before the caret from your files whatever is set.")
159159 }
160160 calendarSection
161161 reminderSection
l10n/Localizable.xcstrings −34 · view
@@ -43958,40 +43958,6 @@
4395843958 }
4395943959 }
4396043960 },
43961 "With a hardware keyboard. Doom's keys open the list by itself and match letters in order, as Doom's corfu does; the Emacs and Mac keys do neither unless set here.": {
43962 "localizations": {
43963 "de": {
43964 "stringUnit": {
43965 "state": "translated",
43966 "value": "Mit einer Hardwaretastatur. Die Doom-Tasten öffnen die Liste von selbst und finden Buchstaben in Reihenfolge, wie Dooms corfu; die Emacs- und Mac-Tasten tun beides nicht, außer es ist hier eingestellt."
43967 }
43968 },
43969 "es": {
43970 "stringUnit": {
43971 "state": "translated",
43972 "value": "Con un teclado físico. Las teclas de Doom abren la lista solas y buscan letras en orden, como corfu en Doom; las teclas de Emacs y Mac no hacen ninguna de las dos cosas salvo que se ajuste aquí."
43973 }
43974 },
43975 "fr": {
43976 "stringUnit": {
43977 "state": "translated",
43978 "value": "Avec un clavier physique. Les touches Doom ouvrent la liste d'elles-mêmes et cherchent les lettres dans l'ordre, comme corfu dans Doom ; les touches Emacs et Mac ne font ni l'un ni l'autre sauf si c'est réglé ici."
43979 }
43980 },
43981 "ja": {
43982 "stringUnit": {
43983 "state": "translated",
43984 "value": "ハードウェアキーボード使用時。Doomのキーでは、Doomのcorfuのようにリストが自動で開き、文字の順序で一致します。EmacsとMacのキーでは、ここで設定しない限りどちらも行いません。"
43985 }
43986 },
43987 "pt-BR": {
43988 "stringUnit": {
43989 "state": "translated",
43990 "value": "Com um teclado físico. As teclas do Doom abrem a lista sozinhas e buscam letras em ordem, como o corfu do Doom; as teclas do Emacs e do Mac não fazem nenhum dos dois, a menos que configurado aqui."
43991 }
43992 }
43993 }
43994 },
4399543961 "Word Count": {
4399643962 "localizations": {
4399743963 "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