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

Paste multiline text into a multilineEntry sometimes ignores newlines #4706

Open
2 tasks done
MikeHawkesCapventis opened this issue Mar 7, 2024 · 8 comments
Open
2 tasks done
Labels
unverified A bug that has been reported but not verified

Comments

@MikeHawkesCapventis
Copy link

MikeHawkesCapventis commented Mar 7, 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

Create a NewMultilineEntry, textStyle monospace, wrapping off, tabWidth of 2. Copy a few lines of code from something like Vim, VSC etc., paste and the code arrives as a single line with all newlines ignored.

How to reproduce

	// Create entry form.
	input := widget.NewMultiLineEntry()
	input.TextStyle.Monospace = true
	input.TextStyle.TabWidth = 2
	input.Wrapping = fyne.TextWrapOff
	input.SetPlaceHolder("Enter script here...")

Sometimes it accepts a paste, sometimes it doesn't.

Screenshots

Visual studio code file text:
Screenshot 2024-03-07 at 09 13 27

Result:
Screenshot 2024-03-07 at 09 13 15

Example code

	// Create entry form.
	input := widget.NewMultiLineEntry()
	input.TextStyle.Monospace = true
	input.TextStyle.TabWidth = 2
	input.Wrapping = fyne.TextWrapOff
	input.SetPlaceHolder("Enter script here...")

Fyne version

v2 2.4.4

Go compiler version

go1.22.1 darwin/amd64

Operating system and version

MacOs Sonoma 14.3.1 (23D60)

Additional Information

No response

@MikeHawkesCapventis MikeHawkesCapventis added the unverified A bug that has been reported but not verified label Mar 7, 2024
@Jacalz
Copy link
Member

Jacalz commented Mar 7, 2024

Can you add a text snippet here that we can copy to replicate with?

@latest pulled today

Would you mind specifying the exact version for future’s sake? The latest version will be wrong as soon as we release a new one.

@Jacalz
Copy link
Member

Jacalz commented Mar 7, 2024

I wonder, is your file formatted with CLRF (Windows style) line endings?

@MikeHawkesCapventis
Copy link
Author

Sorry - of course: fyne.io/fyne/v2 v2.4.4

@MikeHawkesCapventis
Copy link
Author

MikeHawkesCapventis commented Mar 7, 2024

Not as far as I can tell on the Windows-style text. I used sed to create a CR/LF pair to try that - it gave a double-space view in VSC but the same result (single line) in the multiline. I've tried pasting from Vim vs VSC, from Notes, from raw terminal (cat the file copy/paste). It's intermittent and I can't quite work out what triggers it to work, but once it does work, it seems reasonably consistent - restart the app, and it's pot-luck as to whether paste works properly or not.

@Jacalz
Copy link
Member

Jacalz commented Mar 7, 2024

Vscode has a setting to change line ending for at down in the bottom right, I think. Can you double check what it is set to?

@MikeHawkesCapventis
Copy link
Author

UTF-8 LF at the moment.

@andydotxyz
Copy link
Member

How often does this happen? "sometimes" is hard to know if we can or cannot replicate locally sorry.

@MikeHawkesCapventis
Copy link
Author

Often ... very often. I'm building on an Apple MacBook Pro and running on an assortment of machines. It's fails more often than it succeeds. Weirdly, if it works, then it works for most of the time the app runs, but next time you start the app, it's back to failing more often than it runs. I've tried cut/pasting from all kinds of different source apps (terminal, VSCode, Notes, Word), and the source makes no difference.

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