You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cursor style ownership across terminal handoffs
#1862
I'm working on an inline picker, which launches from shell key bindings, that has a requirement to be compatible with terminal cursor style. With Bubble Tea v2's hardware cursor, opening the picker changes the cursor's shape and blink state. Returning to the terminal default on exit can leave Fish displaying a block cursor in insert mode until it repaints the mode.
#1559 already proposes querying the existing style with DECRQSS and restoring it afterward. I'd like to discuss how that should work across ReleaseTerminal, RestoreTerminal, and ExecProcess, and whether an app can use hardware positioning while leaving shape and blink alone.
Position, visibility, and color would still apply. Shape and blink would remain whatever the terminal currently uses. Turning on PreserveStyle after an explicit style change would leave that current style in place.
The restoration baseline needs a clearer definition. Suppose an app changes the cursor, restores the host style before running a child process, then resumes with preserve enabled. If the child leaves a different style behind, I would expect the resumed app to keep it. For an app that resumes with an explicit style, should cleanup restore the original baseline or capture a new one each time it takes control again?
I have an experimental implementation on my fork, at revision 9fc7c21. The combined diff includes capture, the proposed flag, and reader/ticker lifecycle fixes.
That revision passed local race tests, builds of all examples, and golangci-lint v2.9. Further tests found two cases that still fail:
After explicit styling has been restored at handoff, a later preserve-only interval restores the old snapshot.
An app that starts in preserve mode cannot capture its first explicit style baseline after ExecProcess.
I'd like to agree on the expected behavior before changing those paths further.
An earlier revision was tested with Fish and Nushell on Kitty, Ghostty, and Alacritty. That matrix has not been repeated for the hardening revision, and GitHub CI has not been verified for this commit.
Capture also has limits. Unsupported terminals or replies not received before release require a fallback. DECRQSS has no request IDs, so overlapping queries cannot be reliably matched. The available style is the one present at handoff; ble.sh, for example, applies its external-command style before launch.
Would this preserve behavior fit tea.Cursor, and which restoration baseline should apply across release/resume?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I'm working on an inline picker, which launches from shell key bindings, that has a requirement to be compatible with terminal cursor style. With Bubble Tea v2's hardware cursor, opening the picker changes the cursor's shape and blink state. Returning to the terminal default on exit can leave Fish displaying a block cursor in insert mode until it repaints the mode.
#1559 already proposes querying the existing style with DECRQSS and restoring it afterward. I'd like to discuss how that should work across
ReleaseTerminal,RestoreTerminal, andExecProcess, and whether an app can use hardware positioning while leaving shape and blink alone.One possible API is:
Position, visibility, and color would still apply. Shape and blink would remain whatever the terminal currently uses. Turning on
PreserveStyleafter an explicit style change would leave that current style in place.The restoration baseline needs a clearer definition. Suppose an app changes the cursor, restores the host style before running a child process, then resumes with preserve enabled. If the child leaves a different style behind, I would expect the resumed app to keep it. For an app that resumes with an explicit style, should cleanup restore the original baseline or capture a new one each time it takes control again?
I have an experimental implementation on my fork, at revision
9fc7c21. The combined diff includes capture, the proposed flag, and reader/ticker lifecycle fixes.That revision passed local race tests, builds of all examples, and golangci-lint v2.9. Further tests found two cases that still fail:
ExecProcess.I'd like to agree on the expected behavior before changing those paths further.
An earlier revision was tested with Fish and Nushell on Kitty, Ghostty, and Alacritty. That matrix has not been repeated for the hardening revision, and GitHub CI has not been verified for this commit.
Capture also has limits. Unsupported terminals or replies not received before release require a fallback. DECRQSS has no request IDs, so overlapping queries cannot be reliably matched. The available style is the one present at handoff; ble.sh, for example, applies its external-command style before launch.
Would this preserve behavior fit
tea.Cursor, and which restoration baseline should apply across release/resume?All reactions