Skip to content

Fix selectable label highlight offset when alignment is changed #5795

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

termlt
Copy link

@termlt termlt commented Jun 22, 2025

Description:

Fixes the offset issue with the selectable label highlight when the label text alignment is changed.


Screenshot of the issue:

image


Test application to replicate the issue:

package main

import (
	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/widget"
)

func main() {
	a := app.New()
	w := a.NewWindow("Test")
	w.Resize(fyne.NewSize(700, 600))

	test := widget.NewLabel("Test")
	test.Alignment = fyne.TextAlignCenter
	test.Selectable = true

	w.SetContent(test)

	w.ShowAndRun()
}

Checklist:

  • Tests included.
  • Lint and formatter run with no errors.
  • Tests all pass.

Copy link
Member

@andydotxyz andydotxyz left a comment

Choose a reason for hiding this comment

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

Fantastic thanks for fixing this up.

However I think it only works for a single line label / selection.
The complete fix probably needs to iterate each line in a selection instead of just all selections in a single move operation.

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.

2 participants