threema-ch / threema-web

The Threema Web application.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Linux line ending gets duplicated when copying with Wayland

rugk opened this issue · comments

commented

Bug Description

Steps to Reproduce (for bugs)

  1. Copy:
an example
second paragraph
  1. Paste into message box. You get:
an example
second paragraph

fine.
3. Ctrl+A + Copy that text again.
4. Paste somewhere else or in the same message box (Ctrl+V). You get:

an example

second paragraph

Potential Solution

It's likely due to how linefeed character conversion is handled…

Your Environment

  • Threema Web version: 2.3.0-gh (new issue with that version, AFAIK)
  • Browser name and version: Firefox 71
  • Computer operating system and version: Linux/Fedora (GNOME)

Background info

(potentially useful for usability improvements/UX stuff)

Why am I even doing this? (Copy & pasting in the compose box in the same chat?)
I do know it autosaves chats when switching and usually notice that.

However, I did it here, because in the same chat the topic was switched while I was writing ("composing") a message and thus I wanted to quickly reply to that new message, keeping my old "draft message". So to avoid to loose the message I copy it and keep it in my clipboard; write the reply, send it and finally paste the old message again to continue writing.

I do exactly the same in the Android app (also copy all and paste later).

This just FYI, maybe the clipboard and as I do it is already the best way to solve this problem, maybe it is not. 🤔

I cannot reproduce this issue on 2.3.0, neither with Firefox (70) nor with Chrome (78).

Can you reproduce the issue if you copy the text above from GitHub?

Does it also happen if you manually enter 2 lines of text, then copy&paste that text?

commented

I can reproduce it.

I can reproduce it.

You've earned yourself an assignment 😄

I updated to FF 71, but still can't reproduce it.

@rugk do you use Wayland?

It seems to be a Firefox bug, since the newline is also there if you paste into a text editor.

@rugk Does it also happen in Chrom(e|ium)?

commented

Yes Wayland, Chrome/ium not tested.

Ok, I strongly suspect a bug in Firefox, potentially related to Wayland (since the clipboard is something that's handled differently in X and Wayland). I fear there's not much we can do about it. We do not intercept copying in any way.

commented

Hmm, it worked before and has definitively been introduced with the Threema Web update to v2.3.0 🤔

It also happens in no other web application (e.g. in GitHub here). 🤔

So there must be something.

Perhaps try git bisect?

Hmm, it worked before and has definitively been introduced with the Threema Web update to v2.3.0

You can compare with older versions here: https://web.threema.ch/archive/ The current compose area was introduced in 2.2.0, so it doesn't make sense to test older versions.

It might be caused by the fact that we set white-space: pre-wrap in Threema which GitHub does not use.

Can you confirm that the additional newline is already present when copying (e.g. by pasting the text into a text editor) and that it's not added by pasting?

commented

Can you confirm that the additional newline is already present when copying (e.g. by pasting the text into a text editor) and that it's not added by pasting?

I tested it again and no, not really…

STR:

  1. paste "text\ntext"
  2. copy into text editor -> it's not there (still "text\ntext")
  3. paste the copied text again into Threema Web (still looks okay)
  4. copy again into text editor -> "text\n\ntext"

So it seems to be added by pasting (but only on the second try??), actually…


Also checked the HTML source code. During the STRs in this comment, it always stays one single <br> between the lines and is also displayed correctly in the web version. 🤔

commented

It might be caused by the fact that we set white-space: pre-wrap in Threema which GitHub does not use.

Indeed, if I disable white-space: pre-wrap;, it does work.

commented

But it is not the cause, because if I set white-space: pre-wrap; in GitHub, it is not reproducible.


I can also reproduce this on https://threema-ch.github.io/compose-area/.

commented

Okay, confirmed to be unreproducible with Xorg.

Reported at

Thanks for the reports! Since I now have a new laptop that can also run Wayland (thanks to absence of an Nvidia graphics card), I can confirm that the bug is reproducible, but only when running Firefox with Wayland support (MOZ_ENABLE_WAYLAND=1), not when using XWayland.