Completion: opens by itself, fuzzy, words, index !483
4 files changed, +15 −41
Changed files (4)
Sources/OrgstarMobile/EditorScreen.swift +3 · view
| @@ -385,6 +385,8 @@ struct EditorScreen: View { | |||
| 385 | bind(editor) | 385 | bind(editor) |
| 386 | editor.focus(view) | 386 | editor.focus(view) |
| 387 | } | 387 | } |
| 388 | // A kept editor missed settings changed while it was off screen. | ||
| 389 | editor.options = editorOptions | ||
| 388 | self.editor = editor | 390 | self.editor = editor |
| 389 | textView = view | 391 | textView = view |
| 390 | if let offset { editor.reveal(offset) } | 392 | if let offset { editor.reveal(offset) } |
| @@ -1027,6 +1029,7 @@ struct CommandPalette: View { | |||
| 1027 | ("org.snippet.next-field", "Next Snippet Field"), ("org.snippet.previous-field", "Previous Snippet Field"), | 1029 | ("org.snippet.next-field", "Next Snippet Field"), ("org.snippet.previous-field", "Previous Snippet Field"), |
| 1028 | ("app.recovery", "Recovery Versions…"), ("app.sync-conflicts", "Resolve Sync Conflicts…"), | 1030 | ("app.recovery", "Recovery Versions…"), ("app.sync-conflicts", "Resolve Sync Conflicts…"), |
| 1029 | ("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"), | 1031 | ("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"), | ||
| 1030 | ("edit.isearch-forward", "Incremental Search"), ("edit.isearch-backward", "Incremental Search Backward"), | 1033 | ("edit.isearch-forward", "Incremental Search"), ("edit.isearch-backward", "Incremental Search Backward"), |
| 1031 | ("org.table.toggle-column-width", "Shrink or Expand Table Column"), ("org.table.shrink", "Shrink Table Columns with Widths"), | 1034 | ("org.table.toggle-column-width", "Shrink or Expand Table Column"), ("org.table.shrink", "Shrink Table Columns with Widths"), |
| 1032 | ("org.table.expand", "Expand Table Columns"), | 1035 | ("org.table.expand", "Expand Table Columns"), |
Sources/OrgstarMobile/MobileEditor+Completion.swift +11 −6 · view
| @@ -34,8 +34,9 @@ final class CompletionListView: UIView { | |||
| 34 | 34 | ||
| 35 | func key(_ chord: KeyChord) -> CompletionList.Action { list.key(chord) } | 35 | func key(_ chord: KeyChord) -> CompletionList.Action { list.key(chord) } |
| 36 | 36 | ||
| 37 | /// Lays the rows out with their top left at `point`, kept inside `bounds`. | 37 | /// Lays the rows out under `caret`, or above it when there isn't room below, kept inside |
| 38 | func show(at point: CGPoint, within bounds: CGRect, font: UIFont) { | 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) { | ||
| 39 | stack.arrangedSubviews.forEach { $0.removeFromSuperview() } | 40 | stack.arrangedSubviews.forEach { $0.removeFromSuperview() } |
| 40 | var width: CGFloat = 80 | 41 | var width: CGFloat = 80 |
| 41 | for index in list.visible(rows: Self.rows) { | 42 | for index in list.visible(rows: Self.rows) { |
| @@ -55,8 +56,10 @@ final class CompletionListView: UIView { | |||
| 55 | } | 56 | } |
| 56 | width = min(width, bounds.width - 16) | 57 | width = min(width, bounds.width - 16) |
| 57 | let height = stack.systemLayoutSizeFitting(UIView.layoutFittingCompressedSize).height | 58 | let height = stack.systemLayoutSizeFitting(UIView.layoutFittingCompressedSize).height |
| 58 | let x = min(max(bounds.minX + 8, point.x), bounds.maxX - width - 8) | 59 | let x = min(max(bounds.minX + 8, caret.minX), bounds.maxX - width - 8) |
| 59 | frame = CGRect(x: x, y: point.y + 2, width: width, height: height) | 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) | ||
| 60 | stack.frame = CGRect(origin: .zero, size: frame.size) | 63 | stack.frame = CGRect(origin: .zero, size: frame.size) |
| 61 | } | 64 | } |
| 62 | 65 | ||
| @@ -139,8 +142,10 @@ extension MobileEditor { | |||
| 139 | } | 142 | } |
| 140 | guard let position = textView.position(from: textView.beginningOfDocument, offset: completion.range.lowerBound) else { return } | 143 | guard let position = textView.position(from: textView.beginningOfDocument, offset: completion.range.lowerBound) else { return } |
| 141 | let caret = textView.caretRect(for: position) | 144 | let caret = textView.caretRect(for: position) |
| 142 | let visible = CGRect(origin: textView.contentOffset, size: textView.bounds.size) | 145 | let insets = textView.adjustedContentInset |
| 143 | view.show(at: CGPoint(x: caret.minX, y: caret.maxY), within: visible, font: theme.font) | 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) | ||
| 144 | } | 149 | } |
| 145 | 150 | ||
| 146 | func closeCompletion() { | 151 | func closeCompletion() { |
Sources/OrgstarMobile/SettingsScreen.swift +1 −1 · view
| @@ -155,7 +155,7 @@ struct SettingsScreen: View { | |||
| 155 | } header: { | 155 | } header: { |
| 156 | Text("Completion") | 156 | Text("Completion") |
| 157 | } footer: { | 157 | } 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.") |
| 159 | } | 159 | } |
| 160 | calendarSection | 160 | calendarSection |
| 161 | reminderSection | 161 | reminderSection |
l10n/Localizable.xcstrings −34 · view
| @@ -43958,40 +43958,6 @@ | |||
| 43958 | } | 43958 | } |
| 43959 | } | 43959 | } |
| 43960 | }, | 43960 | }, |
| 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 | }, | ||
| 43995 | "Word Count": { | 43961 | "Word Count": { |
| 43996 | "localizations": { | 43962 | "localizations": { |
| 43997 | "de": { | 43963 | "de": { |