feat(keyboard): ship AI hint carousel, home library cards, and clipboard polish
Rotate AI idle suggestions with optional remote packs, move history/dictionary onto self-sizing Home preview cards, harden clipboard capture/prompting, and simplify keyboard chrome by dropping most liquid-glass shadows.
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
// TranscriptOverlapUtilities.swift
|
||||
// OSGKeyboard · Shared
|
||||
//
|
||||
// Shared normalization and raw-prefix mapping for transcript overlap checks.
|
||||
|
||||
import Foundation
|
||||
|
||||
enum TranscriptOverlapUtilities {
|
||||
static func normalized(_ text: String) -> String {
|
||||
text.unicodeScalars.filter {
|
||||
!CharacterSet.whitespacesAndNewlines.contains($0)
|
||||
&& !CharacterSet.punctuationCharacters.contains($0)
|
||||
}.map { Character($0) }.reduce(into: "") { $0.append($1) }
|
||||
}
|
||||
|
||||
static func rawDropCount(in text: String, normalizedPrefixLength: Int) -> Int {
|
||||
var normalizedCount = 0
|
||||
var rawIndex = text.startIndex
|
||||
while rawIndex < text.endIndex, normalizedCount < normalizedPrefixLength {
|
||||
let character = text[rawIndex]
|
||||
if !character.isWhitespace, !character.isPunctuation {
|
||||
normalizedCount += 1
|
||||
}
|
||||
rawIndex = text.index(after: rawIndex)
|
||||
}
|
||||
return text.distance(from: text.startIndex, to: rawIndex)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user