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

TextGrid - Random Errors when running the application #5356

Open
2 tasks done
halsten-dev opened this issue Jan 3, 2025 · 4 comments
Open
2 tasks done

TextGrid - Random Errors when running the application #5356

halsten-dev opened this issue Jan 3, 2025 · 4 comments
Labels
unverified A bug that has been reported but not verified

Comments

@halsten-dev
Copy link

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

I'm trying to work with TextGrid to craft an editor. But I sometimes getting this error at the start of the app. I just need to restart the app for it to disappear. It seems to only appear if I close the app abruptly with the stop button from Goland.

Any idea what's going on ? I'm running Linux.

How to reproduce

  1. Having a widget using a TextGrid.
  2. Close the app abruptly (Ctrl+C in term or Stop in Goland)
  3. Rerun the app
  4. It'll happens sometimes

Screenshots

No response

Example code

type Editor struct {
	widget.BaseWidget

	Grid *widget.TextGrid

	CurrentRow int
	CurrentCol int
}

func NewEditor() *Editor {
	editor := &Editor{}

	editor.Grid = widget.NewTextGrid()

	editor.CurrentRow = 0
	editor.CurrentCol = lineStartCol

	editor.Grid.ShowLineNumbers = false
	editor.Grid.ShowWhitespace = false

	editor.ExtendBaseWidget(editor)

	return editor
}

func (e *Editor) CreateRenderer() fyne.WidgetRenderer {
	return widget.NewSimpleRenderer(e.Grid)
}

Fyne version

2.5.3

Go compiler version

1.23.1

Operating system and version

Linux 6.11.11-1-MANJARO (Wayland)

Additional Information

More docs around TextGrid would be greatly appreciated ;)

@halsten-dev halsten-dev added the unverified A bug that has been reported but not verified label Jan 3, 2025
@Jacalz
Copy link
Member

Jacalz commented Jan 3, 2025

Can you please provide a fully runnable code example and also specify what error you are getting? That makes it a lot easier for us to test.

@halsten-dev
Copy link
Author

Hi,

Of course, here it is with another kind of possible random error. Hope it helps.

error2.txt
demoeditor.zip

I just want to say that's it's a lot of effort to use those TextGrid. I looked in detail of what you guys did for the Fyne terminal, which is amazing by the way.

Maybe at looking at this little piece of code, you could give me some advice and even giving some insight on the why TextGrid are capable to resize the window size when growing in size ? It's blowing my mind.
Actually, just try to manually resize the window in this simple demo. It's slow as hell. I don't understand why I must say.

Thanks for you precious help.

@andydotxyz
Copy link
Member

For an editor I would recommend using the Entry widget (probably with monospaced style set).

Any widget will cause the window to expand if their min size is larger than the window allows.

@halsten-dev
Copy link
Author

halsten-dev commented Jan 5, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
unverified A bug that has been reported but not verified
Projects
None yet
Development

No branches or pull requests

3 participants