fyne
fyne copied to clipboard
Paste multiline text into a multilineEntry sometimes ignores newlines
Checklist
- [X] I have searched the issue tracker for open issues that relate to the same problem, before opening a new one.
- [X] 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:
Result:
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
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.
I wonder, is your file formatted with CLRF (Windows style) line endings?
Sorry - of course: fyne.io/fyne/v2 v2.4.4
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.
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?
UTF-8 LF at the moment.
How often does this happen? "sometimes" is hard to know if we can or cannot replicate locally sorry.
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.