fix: don't drop cursor when a trailing space is typed at end of paragraph - #319
Merged
NellowTCS merged 3 commits intoAug 18, 2026
Merged
Conversation
…raph Fixes TailsmanDesign#262. reflowParagraphCore() correctly excludes a trailing space from the wrapped line (matching normal word-wrap behaviour) and skips over it as the "space between wrapped words". But when that space is the very last character typed, with no following word yet, there's nothing left to write a following line for - so the cursor position (absoluteCursor) was left unresolved with no line to land on. The next keystroke then inserted straight onto the end of the now-shorter line (cursor_pos was stale, past the line's actual length), gluing the next word onto the previous one with no space - exactly the "althoughthe" symptom reported on the issue. Generalised the existing empty-paragraph handling (previously gated on currWriteIdx == startLine) to any case where the cursor was never placed, creating or reusing a line for it either way. Drafted with an AI assistant, reviewed and tested manually.
NellowTCS
previously approved these changes
Aug 17, 2026
NellowTCS
left a comment
Member
There was a problem hiding this comment.
One tiny note, but apart from that it works great on device!
NellowTCS
approved these changes
Aug 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #262.
What and why
reflowParagraphCore()correctly excludes a trailing space from the wrapped line (matching normal word-wrap behaviour) and skips over it as the "space between wrapped words." But when that space is the very last character typed, with no following word yet, there's nothing left to write a following line for — so the cursor position (absoluteCursor) was left unresolved with no line to land on.The next keystroke then inserted straight onto the end of the now-shorter line (
cursor_poswas stale, past the line's actual length), gluing the next word onto the previous one with no space — exactly the "althoughthe" symptom NellowTCS described on the issue.Generalised the existing empty-paragraph handling (previously gated on
currWriteIdx == startLine) to any case where the cursor was never placed, creating or reusing a line for it either way.How I tested it
Full
PM_PRODUCTIONbuild succeeds cleanly (RAM 35.5%, Flash 76.6% — no meaningful size regression). No local unit-test harness exists for this project. I don't have a way to exercise the runtime typing behaviour myself on real hardware — would appreciate a hardware test before merge, same as the pattern that worked well on the earlier #297/#301 exchange.AI-assisted contribution
Drafted with an AI assistant, reviewed and tested manually.