fix(examples): restore focus after removing an editor - #1793
Open
dajiaohuang wants to merge 1 commit into
Open
Conversation
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.
CONTRIBUTING.md.Fixes #1792.
When Ctrl+W removes the focused last editor, the example moves
m.focusto asurviving textarea but leaves that textarea blurred. Characters are ignored
until another Tab/Shift+Tab restores focus.
Focus the surviving textarea when clamping the index and retain the command
returned by
Focus(). Removing an unfocused last editor does not restart ormove the existing focus. No dependency, public API, or CI change.
The regression test covers two, three, and six editors, including removal with
first/middle/last focus. It checks the unique focused editor and that existing
content is preserved while the next character is accepted through
model.Update.Validation:
non-last controls pass.
go test -count=10 -run '^TestRemoveEditorPreservesFocus$' ./split-editorsfrom
examples/passes (Windows Go 1.26.3).go test ./...in the examples module passes (examples without tests compile).go test -race -count=4 -cpu=1,4 ./...passes (WSL Linux Go 1.26.6).golangci-lint runandgit diff --cached --checkchecked before submission.Separate pre-existing limitation observed during the audit: the untouched
tutorialsmodule requiresgo.modupdates forgo test -mod=readonly ./....This patch does not modify or claim to repair that module. No live terminal or
networked example was launched for this regression.