fix(tui): check for selected text instead of any selection in dialog escape handler#16779
Merged
Hona merged 3 commits intoanomalyco:devfrom Mar 17, 2026
Merged
Conversation
…escape handler renderer.getSelection() returns a non-null Selection object from a simple click on selectable text (no drag needed). This blocks Escape from dismissing dialogs opened via mouse click. Use getSelectedText() to only block Escape when there is actual text selected, matching the pattern already used in session/index.tsx.
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
Member
|
/review |
Contributor
|
lgtm |
ConanXu-math
pushed a commit
to ConanXu-math/opencode
that referenced
this pull request
Mar 17, 2026
e6qu
pushed a commit
to e6qu/frankencode
that referenced
this pull request
Mar 18, 2026
…B7 #16779) Check getSelectedText() instead of just getSelection() so escape correctly closes dialogs when a selection object exists but has no text. Upstream: anomalyco/opencode#16779 (a64f604)
5 tasks
e6qu
added a commit
to e6qu/frankencode
that referenced
this pull request
Mar 18, 2026
* fix(vcs): fix inverted HEAD filter in watcher (backport B8 #17829) The file watcher was ignoring HEAD changes instead of filtering non-HEAD changes, so branch switches were never detected. Upstream: anomalyco/opencode#17829 (e5cbecf) Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com> * fix(core): detect context_length_exceeded in API call errors (backport B1 #17748) Parse response body for error code so providers returning context_length_exceeded are correctly classified as context overflow. Upstream: anomalyco/opencode#17748 (e718db6) * fix(util): log ZodError issues on schema validation failure (backport B5) Print the specific validation issues alongside the stack trace to make debugging schema mismatches easier. * fix(tui): check for selected text in dialog escape handler (backport B7 #16779) Check getSelectedText() instead of just getSelection() so escape correctly closes dialogs when a selection object exists but has no text. Upstream: anomalyco/opencode#16779 (a64f604) * fix(ui): wrap question option descriptions instead of truncating (backport B6 #17782) Replace overflow:hidden/text-overflow:ellipsis with overflow-wrap:anywhere so long descriptions are visible. Remove the now-redundant data-custom override. Upstream: anomalyco/opencode#17782 (51fcd04) * fix(opencode): apply message transforms during compaction (backport B2 #17823) Run Plugin.trigger("experimental.chat.messages.transform") on a structuredClone of messages before passing them to the compaction model. Upstream: anomalyco/opencode#17823 (4cb2996) * fix(opencode): forward session permission ruleset to LLM stream (backport B3 #17064) Add permission field to StreamInput and merge it with agent permissions when computing disabled tools. Forward session.permission from prompt.ts. Upstream: anomalyco/opencode#17064 (c2ca149) * fix(opencode): add prompt schema validation debug logs (backport B4 #17812) Log info and part schema validation failures before persisting to help diagnose data corruption issues. Upstream: anomalyco/opencode#17812 (fee3c19) --------- Co-authored-by: Kit Langton <kit.langton@gmail.com> Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com> Co-authored-by: Johannes Loher <johannes.loher@tngtech.com> Co-authored-by: Adrian Mârza <adi11235 at gmail dot com> Co-authored-by: Kyle Altendorf <sda@fstab.net> Co-authored-by: Shoubhit Dash <shoubhit2005@gmail.com> Co-authored-by: DS <78942835+Tarquinen@users.noreply.github.com> Co-authored-by: Jason Quense <monastic.panic@gmail.com>
3 tasks
AvatarGanymede
pushed a commit
to AvatarGanymede/opencode-dev
that referenced
this pull request
Mar 19, 2026
demostanis
pushed a commit
to demostanis/opencode
that referenced
this pull request
Mar 19, 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.
Issue for this PR
Closes #16778. May also fix #15202 and #14590.
Type of change
What does this PR do?
PR #13315 added a selection guard to the dialog escape handler at
dialog.tsx:73that checksrenderer.getSelection(). When clicking on selectable text (e.g. a user message), opentui creates aSelectionobject onmouseDowneven for a simple click with no drag. This empty selection lingers after the dialog opens onmouseUp, sogetSelection()returns a non-null object with no actual text — blocking Escape indefinitely.One-line fix:
renderer.getSelection()→renderer.getSelection()?.getSelectedText(), so Escape is only blocked when there is actual selected text. This matches the existing pattern at:session/index.tsx:1133session/index.tsx:1672session/index.tsx:1742How did you verify your code works?
Manually tested: opened Message Actions dialog by clicking a user message, pressed Escape — dialog now dismisses immediately without needing to click or type first.
Screenshots / recordings
No UI changes — keyboard behavior only.
Checklist