Fix/narrow prompt and ctrlw#266
Open
aricy wants to merge 4 commits into
Open
Conversation
… ctrl+w over-deletion Three fixes to the interactive redraw math: - SplitByLine: count the terminal rows a prompt occupies when it is wider than the screen (start >= screenWidth). Previously the prompt collapsed to row 0, so idxLine under-counted and clean() erased too few rows on redraw, making a narrow-terminal prompt repeat on every keystroke. - RuneBuffer.printed guard: the first Refresh() of an input line calls clean() before print(), so nothing has been drawn above the cursor yet. A wide prompt makes idxLine > 0 even for an empty buffer; moving up would erase unrelated output printed before the prompt. Only rows previously drawn by print() may be reclaimed. Reset on commit. - BackEscapeWord (ctrl+w): kill exactly one word to the left of the cursor, preserving text to the right. The old code cleared the whole buffer whenever the word began at index 0 or the cursor sat just after a word-break such as '*', deleting everything after the cursor too. Adds utils_test.go covering SplitByLine row counts.
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.
No description provided.