Skip to content
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

Replacement character for C0 control characters is measured wrong #5257

Open
2 tasks done
pjanx opened this issue Nov 12, 2024 · 1 comment
Open
2 tasks done

Replacement character for C0 control characters is measured wrong #5257

pjanx opened this issue Nov 12, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@pjanx
Copy link

pjanx commented Nov 12, 2024

Checklist

  • I have searched the issue tracker for open issues that relate to the same problem, before opening a new one.
  • This issue only relates to a single bug. I will open new issues for any other problems.

Describe the bug

C0 replacement characters are rendered differently than their size is measured for cursor rendering.
Independent of platform.

How to reproduce

  • Run the example code
  • Select the Entry, whose cursor is already at the end
  • Move the cursor to the left using your keyboard and observe

Screenshots

replacement-bug

Example code

package main

import (
	"net"

	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/dialog"
	"fyne.io/fyne/v2/driver/mobile"
	"fyne.io/fyne/v2/widget"
)

func main() {
	a := app.New()
	w := a.NewWindow("Bugs")
	w.Resize(fyne.NewSize(640, 480))
	w.SetContent(widget.NewMultiLineEntry())

	connectAddress := widget.NewEntry()
	connectAddress.SetPlaceHolder("host:port")
	connectAddress.Validator = func(text string) error {
		_, _, err := net.SplitHostPort(text)
		return err
	}
	connectAddress.SetText(string([]byte{3, 2, 1, 65, 66, 67, ':', '1'}))
	connectAddress.TypedKey(&fyne.KeyEvent{Name: fyne.KeyPageDown})

	var wConnect *dialog.FormDialog
	wConnect = dialog.NewForm("Connect to relay", "Connect", "Exit",
		[]*widget.FormItem{
			{Text: "Address:", Widget: connectAddress},
		}, func(ok bool) {
			if ok {
			} else if _, ok := a.Driver().(mobile.Driver); ok {
				wConnect.Show()
			} else {
				a.Quit()
			}
		}, w)
	wConnect.Show()
	w.ShowAndRun()
}

Fyne version

2.5.2

Go compiler version

1.23.2

Operating system and version

Linux

Additional Information

No response

@pjanx pjanx added the unverified A bug that has been reported but not verified label Nov 12, 2024
@andydotxyz andydotxyz added bug Something isn't working and removed unverified A bug that has been reported but not verified labels Nov 15, 2024
@andydotxyz andydotxyz added this to the E fixes (v2.5.x) milestone Nov 15, 2024
@andydotxyz
Copy link
Member

I think that actually the measurement for cursor is correct and the advancing in render is wrong because they should be better spaced out than in the screenshot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants