Skip to content

Fixed switching edit mode while a prompt was running sometimes landing on the wrong mode - #180

Merged
oleg68 merged 1 commit into
nbplugins:mainfrom
oleg68:bugfix/edit-mode-switch-glitch-during-prompt
Oct 2, 2026
Merged

oleg68 merged 1 commit into
nbplugins:mainfrom
oleg68:bugfix/edit-mode-switch-glitch-during-prompt

Conversation

@oleg68

@oleg68 oleg68 commented Oct 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • While a prompt was running, switching the edit mode (e.g. to Auto Mode) could cycle through several modes and settle on the wrong one, because a single screen-poll read of the footer line could be corrupted by Claude's Ink renderer mid-redraw.
  • Applied the same confirm-twice debounce already used for choice-menu detection (cbb745b, f4f4660) to edit-mode detection: a newly detected mode is only applied (continuous sync) or treated as a confirmed transition (explicit Shift+Tab switch loop) once the same mode is seen on two consecutive polls.

Test plan

  • Added unit tests reproducing the glitch (single differing poll must not flip the mode) for both the continuous pollScreenState() sync and waitForConcreteModeChange()
  • Added unit tests confirming the same mode on two consecutive polls is applied
  • mvn test passes
  • mvn package succeeds
  • Manually verified: switched edit mode while a prompt was running across several repetitions; mode now consistently settles on the one selected

🤖 Generated with Claude Code

…g on the wrong mode

Claude's Ink renderer repaints its footer via cursor-movement escape
sequences, which can transiently corrupt a single screen-poll read of
the edit-mode line. Both the continuous screen->model sync and the
explicit Shift+Tab switch loop trusted a single poll's reading, so a
one-off glitch frame could apply or be mistaken for a real mode
transition.

Applied the same confirm-twice debounce already used for choice-menu
detection: a newly detected mode is only applied/treated as a
confirmed transition once the same mode is seen on two consecutive
polls.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@oleg68
oleg68 merged commit be20aa6 into nbplugins:main Oct 2, 2026
3 checks passed
@oleg68
oleg68 deleted the bugfix/edit-mode-switch-glitch-during-prompt branch October 2, 2026 18:32
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