mirror of
https://github.com/anomalyco/hex.git
synced 2026-11-28 13:02:21 +01:00
Ryan asked for a dot when typing websites. Apple's keyboard gives a `.webSearch` field (Safari's address bar) a `.` between the space bar and return; Hex routed those fields to its plain text row, so it had none. - KeyboardFieldRouting routes .webSearch to a new KeyboardFieldKind .webSearch. The enum moves to KeyboardFieldKind.swift with takesWords (text and web search) and keysRightOfSpace(width:), which replaces the three copies of the URL/email keys switch (joined, split, docked iPad). - Upright on an iPhone the row stands on Apple's columns: 123 to z's edge, space from x, a letter-wide `.` 7.25 pitches in and a return 1.75 pitches wide, as Apple's measures (iPhone 17 Pro, iOS 26.5 and 27.2). Turned and on the Duo it takes the URL/email row. A docked iPad keeps its text row, as Apple's does (iPad mini, iOS 27.2). - Every word check that read `field == .text` (autocorrect, swipe, suggestions, text replacements, smart punctuation, Learn how I type, Adaptive touch, the emoji key and shortcodes) now reads field.takesWords, so a web search field types words exactly as before. - Comma and period keys and Dvorak punctuation stay off in web search, as in URL and email fields, so there is never a second `.`. - Holding `.` still offers `. …`; Apple's domain menu (.us .edu .com .net .org) is left for a follow-up. - ios/docs/keyboard.md: a Web search fields section, and the comma and period, Dvorak and emoji notes. Verified: full HEXMobile suite on an iPhone 17 Pro iOS 27.2 simulator (Mac Studio), 946 tests, 0 failures. New cases: the route; the row's keys and widths on six phone widths and against Apple's 402 pt measurements; the docked iPad row unchanged; the comma and period experiment adding no second dot; the Dvorak and comma loops with web search; swipe, autocorrect and suggestions identical to a text field; Adaptive touch learning there. Release simulator build in Safari: the row lands on Apple's keys to the pixel, and typing google.com on Hex's keys gave "google.com". code-shape: KeyboardLayout.swift 1,499 -> 1,481 lines; --check still fails only on FullKeyboardView.swift (1,537 lines, over already on dev from #2457, untouched here).
30 lines
1.3 KiB
Swift
30 lines
1.3 KiB
Swift
import CoreGraphics
|
|
|
|
/// The kind of text field, as far as the key rows care.
|
|
nonisolated enum KeyboardFieldKind: Equatable, Sendable {
|
|
case text
|
|
/// Adds `.` and `/` right of space.
|
|
case url
|
|
/// Adds `@` and `.` right of space, matching Apple's iOS 26 email layout.
|
|
case email
|
|
/// A `.webSearch` field (Safari's address bar): text, with Apple's `.` right of space.
|
|
case webSearch
|
|
}
|
|
|
|
nonisolated extension KeyboardFieldKind {
|
|
/// Fields typed in words, where autocorrect, swipe, suggestions, smart punctuation, emoji
|
|
/// and Learn how I type work as the field's traits allow: text, and web search, whose only
|
|
/// difference is its `.` key. URL and email fields type addresses.
|
|
var takesWords: Bool { self == .text || self == .webSearch }
|
|
|
|
/// The keys right of the space bar, each `width` wide: Apple's `.` and `/` in a URL field,
|
|
/// `@` and `.` in an email field, and `.` in a web search field.
|
|
func keysRightOfSpace(width: CGFloat) -> [(KeyKind, CGFloat, String)] {
|
|
switch self {
|
|
case .text: []
|
|
case .url: [(.character("."), width, "."), (.character("/"), width, "/")]
|
|
case .email: [(.character("@"), width, "@"), (.character("."), width, ".")]
|
|
case .webSearch: [(.character("."), width, ".")]
|
|
}
|
|
}
|
|
}
|