Follow-up to the held mid-sentence space (14ed855d). Two regressions it
introduced: after "brown" was replaced with "black" and space tapped in "The
quick brown fox", the strip still offered completions of the finished word
(blackberry, blacks), and picking one replaced "black"; and a space held on
the 123 page left the keys on 123, where a typed space goes back to ABC.
- The strip now reads the text before the cursor with the held space added
(stripBefore), so it offers next-word predictions as at a typed space,
with the same capitalization rule.
- Picking from the strip while a space is held types that space first, so
the pick goes in after it ("black women fox"), never in the finished word's
place; the space after the pick is held again before " fox". A revert pick
is untouched (the strip offers it only after delete takes the held space).
- The space bar's held space counts as a space for the keys' page:
layerState.didInsert(" ") then rebuildLayoutIfNeeded, so 123 returns to
ABC. A picked suggestion's held space keeps today's page behaviour.
- FullKeyboardEngine.swift stays at 1,500 lines: insertPicked now logs the
suggestion context itself, and layerState and rebuildLayoutIfNeeded lose
private so the SmartSpace file can use them.
Verified on an iOS 27.2 simulator with the Hex keyboard (KBHost field,
"brown" selected): "black" then space reads "The quick black fox jumps" and
the strip shows and / women / hair (next words, as origin/dev showed at a
typed space); picking "women" reads "The quick black women fox jumps" and the
strip moves on (in / and / who). 123, "7", space reads "The quick 7 fox
jumps" with the letters page back. "blsck", space, delete keeps "black fox"
and offers the revert; tapping it reads "blsck fox". xcodebuild
test-without-building -only-testing FullKeyboardEngineTests and
TypingLogTests: 124 tests, 0 failures, including a new
testAHeldSpaceOffersTheNextWordAndGoesBackToLetters case.