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

Message edit: triple click on a word should select the line, not the whole message #28805

Open
kolayne opened this issue Dec 27, 2024 · 5 comments · May be fixed by desktop-app/lib_ui#253
Open
Labels

Comments

@kolayne
Copy link

kolayne commented Dec 27, 2024

Steps to reproduce

  1. Start editing a message that contains multiple lines
  2. In the edit area, triple click a word

Expected behaviour

The line that contains the word is selected (just like it happens when I triple click a word when writing a new message or when I triple click a word in a message in the chat view)

Actual behaviour

The whole message is selected

Operating system

Ubuntu 22.04, i3 version 4.20.1 // Arch Linux, i3 version 4.24

Version of Telegram Desktop

5.9 // 5.9.2 beta

Installation source

Static binary from official website

Crash ID

No response

Logs

No response

@kolayne kolayne added the bug label Dec 27, 2024
@kolayne
Copy link
Author

kolayne commented Dec 27, 2024

If I triple-click the first word "Line" when composing a new message, this happens:
image

If I triple-click the first word "Line" when editing a message, this happens:
image

@kolayne
Copy link
Author

kolayne commented Dec 29, 2024

It seems that Telegram Desktop assumes that the whole edited message is a single line/"paragraph". When, however, you add a new line while editing a message, the behavior for that line is as expected (triple-clicking the new line only selects that line)

@kolayne
Copy link
Author

kolayne commented Dec 29, 2024

Found it. These lines from desktop-app/lib_ui@1d82347 are responsible for the problem (commenting them out fixes the issue). That appears very surprising: is that the intended behavior?

Anyway, should I reopen the issue in lib_ui?

kolayne added a commit to kolayne/lib_ui that referenced this issue Dec 29, 2024
In `InputField::PrepareForInsert`, avoid replacing all line break
characters with `kSoftLine` (aka `QChar::LineSeparator`) because that
makes the selection behavior inconsistent (different for typed text and
restored text, e.g., from a draft). Instead, only soften line breaks
inside formatting tags.

Should fix telegramdesktop/tdesktop#28805
@john-preston
Copy link
Member

@kolayne Only with soft breaks the wysiwyg multiline blockquote editing works unfortunately. It could be possible to inspect whether the currently made change will end up in a blockquote or code block and use soft blocks only for them, but this was not done yet.

@kolayne
Copy link
Author

kolayne commented Dec 30, 2024

@john-preston, that's what I did, I believe!

I've also double checked that with my fix (desktop-app/lib_ui#253) editing blockquotes and code blocks works, as well as exiting those blocks by inserting triple newline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants