Skip to content

Fix/narrow prompt and ctrlw#266

Open
aricy wants to merge 4 commits into
chzyer:mainfrom
aricy:fix/narrow-prompt-and-ctrlw
Open

Fix/narrow prompt and ctrlw#266
aricy wants to merge 4 commits into
chzyer:mainfrom
aricy:fix/narrow-prompt-and-ctrlw

Conversation

@aricy

@aricy aricy commented Jul 5, 2026

Copy link
Copy Markdown

No description provided.

wang bin and others added 4 commits December 24, 2025 10:12
… 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant