feat(keyboard): add Notes skill and system-style typing
Add save-to-Notes export and direct map handoff while aligning multi-touch typing, period shortcuts, return actions, and navigation visuals with system behavior.
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
// PeriodShortcut.swift
|
||||
// OSGKeyboard · Shared
|
||||
//
|
||||
// iOS "." Shortcut: a second Space shortly after a Space that follows a
|
||||
// word character becomes ". " and arms sentence Shift.
|
||||
|
||||
import Foundation
|
||||
|
||||
public enum PeriodShortcut: Sendable {
|
||||
/// Window for the second Space tap. Slow consecutive spaces stay spaces.
|
||||
public static let doubleTapInterval: TimeInterval = 0.45
|
||||
|
||||
/// Whether `precedingText` (already including the first space) can take
|
||||
/// the shortcut: `…X ` where X is a letter or number, not a terminator.
|
||||
public static func shouldReplacePreviousSpace(precedingText: String) -> Bool {
|
||||
guard precedingText.last == " " else { return false }
|
||||
guard let previous = precedingText.dropLast().last else { return false }
|
||||
if previous.isWhitespace || previous.isNewline { return false }
|
||||
return previous.isLetter || previous.isNumber
|
||||
}
|
||||
|
||||
/// After inserting a space, arm only when that space followed a word char.
|
||||
public static func shouldArm(afterSpaceFollowing precedingBeforeSpace: String) -> Bool {
|
||||
guard let last = precedingBeforeSpace.last else { return false }
|
||||
if last.isWhitespace || last.isNewline { return false }
|
||||
return last.isLetter || last.isNumber
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user