Skip to content

Add ClearSelection method to Entry and Label#6379

Open
uttam12331 wants to merge 2 commits into
fyne-io:developfrom
uttam12331:feat/6375-clear-selection
Open

Add ClearSelection method to Entry and Label#6379
uttam12331 wants to merge 2 commits into
fyne-io:developfrom
uttam12331:feat/6375-clear-selection

Conversation

@uttam12331

Copy link
Copy Markdown

Fixes #6375.

Adds a ClearSelection() method to widget.Entry and widget.Label so callers can programmatically cancel an active text selection without needing knowledge of the internal selection state (the workaround previously was re-calling SetText with the same text).

  • Entry.ClearSelection() and Label.ClearSelection() clear an active selection and refresh; both are no-ops when nothing is selected (or, for Label, when it isn't Selectable).
  • Added tests TestEntry_ClearSelection and TestLabel_ClearSelection covering the selection-then-clear path and the no-op case.

Verified locally with go test ./widget/ (both tests pass), gofmt, and go vet ./widget/.

@andydotxyz andydotxyz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this, but since needs to target the next release as we don't add API in point releases.
The feature window is missed on 2.8 so please update to 2.9

@sdassow sdassow added the after-release For when an ongoing release is finished. label Jun 27, 2026
@uttam12331

Copy link
Copy Markdown
Author

Thanks for the review! Updated the Since: tags on both Entry.ClearSelection and Label.ClearSelection to 2.9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

after-release For when an ongoing release is finished.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ClearSelection method

3 participants