telegramdesktop / tdesktop

Telegram Desktop messaging app
https://desktop.telegram.org/
Other
26.26k stars 5.22k forks source link

Option for message formatting (-- to ‏‎−, >> to », << to «) #522

Closed ghost closed 6 years ago

ghost commented 9 years ago

Hi. I want to report a bug in the telegram desktop version. (Linux) The problem of the character: Dash. Or (-) When two characters Dash, taken together, the result rather than the (--) becomes a long line. (‏‎−) But when the two characters together Dash, the text first, this problem does not exist. For example: http://s4.picofile.com/file/8173777318/snapshot.png

CyberMew commented 9 years ago

What's the problem that's causing this issue to not be fixed within a short period?

auchri commented 9 years ago

Because it's not an issue for some people

It's a feature, not a bug

ciuff commented 9 years ago

maybe make it an option? enable/disable auto formatting

auchri commented 9 years ago

Yes, that's why I added the enhancement label

Mindstormer619 commented 9 years ago

:+1: This is a REAL pain when sharing something like a couple lines of code. Especially when the code is too little to use a pastebin, but then there go all your cout<<"Hello world"; statements.

auchri commented 9 years ago

Also don't remove multiple spaces

xenogenesi commented 9 years ago

+1

why not using a modifier for the replaced text? Like alt+-

Best would be to have a way to escape the text to send, untouched (without Emojis or replace at all)

Please leave the original text as it is, is really a pain passing command lines between Mac and Linux (try using it with a terminal noob and then call it a feature again), I think is just this code in historywidget.cpp:

QString HistoryWidget::prepareMessage(QString result) {
    result = result.replace('\t', qsl(" "));

    result = result.replace(" --", QString::fromUtf8(" \xe2\x80\x94"));
    result = result.replace("-- ", QString::fromUtf8("\xe2\x80\x94 "));
    result = result.replace("<<", QString::fromUtf8("\xc2\xab"));
    result = result.replace(">>", QString::fromUtf8("\xc2\xbb"));

    return (cReplaceEmojis() ? replaceEmojis(result) : result).trimmed();
}

(btw, nice app, keep up the good work)

ralesk commented 9 years ago

Those four lines should just be dropped. Those who want to use those characters will enter them (character map, keyboard layout, whatever other means).

ghost commented 9 years ago

Updates? This is really frustrating, especially for IT guys like us!!!

nvx commented 9 years ago

This is an issue for me as well.

auchri commented 9 years ago

@Mindstormer619 you can now surround your statements with `, for example `cout<<"Hello world";`

image

Mindstormer619 commented 8 years ago

Yes of course. Thanks a lot for this :smile:

nvx commented 8 years ago

Not sure why the 4x +1's in quick succession, but didn't this get fixed already? Single backtick quoting for inline quoting, or triple backtick for block quoting.

neongreen commented 8 years ago

@nvx: single backticks are for stuff like code, bash commands, etc (and it shows, correspondingly, in monospace font and a different color). While this covers most (but not all) cases where -- or >> is used, it'd still be nice if it was possible to turn autoreplacement off completely for people who never use it (because we have ‘—’ and ‘«»’s on our keyboards, or for some other reason).

Generally, I don't see why not add customisation options for everything that people request to have an option for. If devs are worried that too many options would harm usability for people who don't want to customise everything, they could just put rarely used options on some separate page (like µTorrent, Firefox, Chrome, etc all have done with the concept of customisation flags).

akomba commented 8 years ago

This is easily the most annoying "feature" of telegram. Please get this fixed or make it optional. Thank you. I love the rest.

edmundlaugasson commented 8 years ago

In 0.9.40 still not fixed :(

Lithas commented 8 years ago

I agree, the '--' syntax is really useful for a lot of things (for example, our chats use a bot that implements per-user karma by scanning for "user++" or "user--" comments. There are workarounds, but none of them are intuitive or easy to use.

aix27249 commented 8 years ago

+1 to fix this ASAP. It is really, really frustrating, especially when you forget about this 'feature'.

Even if someone is using this, please make this optional. p.s. Such auto-replacements are not performed in any other Telegram client (such as mobile), so I don't see any use-case to have it enabled by default.

stek29 commented 8 years ago

@Noiwex Maybe your coworker would use ``` next time?

keeakita commented 8 years ago

Using backticks isn't a valid workaround for display names. I'd like to put two literal < in my name, but it always gets converted.

Innomen commented 7 years ago

So apparently they've "fixed" this by spreading the bug (no, it's not a feature when it lacks an off switch, simply apply this logic to the light in your bedroom) to additional clients. (Android at least.)

Might be the last straw for me. Might be time to switch apps altogether if this one is just gonna turn into the incredimail/myspace of IM solutions.

lindhe commented 7 years ago

Also, I don't think it makes sense that -- becomes — (aka. em-dash). It would make more sense to convert it into – (aka. en-dash) and have --- become — as in LaTeX.

In English, em-dash is much more common than en-dash, but in Swedish en-dash is the standard. So it's really useful to be able to write both (especially for me on Linux, where unicode input does not work because of QT or something like that).

ralesk commented 7 years ago

@lindhe I would say to be able to type –, or ” for that matter, is the task of your keyboard layout, not some application (and no other application, apparently, Telegram Desktop is unique in mangling these characters in messages).

joshsleeper commented 7 years ago

@john-preston @auchri This issue is easy to fix, has no real negative consequences of fixing it, and has been active for way too long. Telegram is first and foremost a chat application, not a tool for writing technical documents or prose.

Please just remove those four cases of forced autoformatting (in all clients) and be done with it.

lindhe commented 7 years ago

@ralesk Not quite true. All applications using Markdown does this (Github, Reddit and Slack comes to mind). I like markdown, since not everything can be written very nicely only using the keyboard (especially bold and italics, but also having different types of dashes is useful and rare to find on keyboards). I just wish Telegram was more consistent with it.

One would expect the usual unicode input thing (ibus?) to work properly, but that is not Telegrams fault: #1033

Lithas commented 7 years ago

I would probably be willing to give up my decrement if I got native bold and italics. Without getting the other benefits of markdown, however, this really makes no sense to me.

ralesk commented 7 years ago

@lindhe I haven't had Slack change my -- or my " into anything it shouldn't be. Markdown is an entirely separate issue, but it does interfere with *doing things in asterisks* which, since we lack /me is all we have — just something to keep in mind there. I do agree that supporting it the same way is important, and as such the first Markdown rollout in Telegram was a pain and a mess.

I don't think GitHub changes these either, even outside of verbatims -- if anything these should remain as they were, and I haven't employed anything "strange" in the source of the message either. (Preview said dashdash and ASCII quotes)

ralesk commented 7 years ago

(To go on a tangent with the Markdown thing: if there's a reason I like BBCode is that it's so obvious and extensible, and does not interfere with random things by accident (interpreting rogue asterisks and dashes as formatting); too bad it went out of fashion)

Reloecc commented 7 years ago

I would like to join all the people here: may we get rid of it, please? If needed, keep it for mac users only.. they deserve it.

tarstars commented 7 years ago

+1

This feature is really annoying when sending some code snippet. Please, provide a way to disable it.

eddex commented 7 years ago

I wrote a telegram bot that runs brainfuck code. It's common to have code like <<<+++>>>--- etc. The bot can't be used with the Telegram desktop app because of this "feature". I have to convert the characters back to normal on my server, which would not be necessary if the text would just be sent as is. As many mentioned before, I think it would be useful to have a setting to turn this "feature" on/off.

lindhe commented 7 years ago

@eddex For that rather specific use case, maybe having it it code style (using surrounding backticks `) would suffice?

ctrlbru commented 7 years ago

Really frustating when you paste command lines or plsql snippets, should be an option.

proea commented 7 years ago

@auchri

https://github.com/telegramdesktop/tdesktop/issues/522#issuecomment-154837695 it does not work for multiline text

ralesk commented 7 years ago

@proea triple ` works for multiline.

ralesk commented 7 years ago

That said the preformatted characters is exactly something nobody wants.

stek29 commented 7 years ago

@ralesk I do.

proea commented 7 years ago

@ralesk Thanks

``````` (9) changes automatically to it makes impossible to write triple in the body 33

ralesk commented 7 years ago

@stek29 Curious. What's your reason for it? Pretty much everyone I've talked to via Telegram is annoyed by the random text replacement.

(EDIT: oh, I just realised the ambiguity of "preformatted" — yes, I want and use the monospace font feature to paste code blocks; no I don't think we should have to use code blocks to avoid getting random characters replaced on the whim of the developer)

@proea Yes, that's the limitation of the markdownish syntax being used. Raise it in a separate bug. But I don't think it's common to want to type triple grave inside a code block.

stek29 commented 7 years ago

@ralesk Because I use -- as a lot :)

auchri commented 7 years ago

@stek29 I think you are the only one 😉

lindhe commented 7 years ago

@stek29 In all other applications, I can write — by typing unicode 2014 (on Gnome (Linux) that is Ctrl+Shift+u2014, and I know there is some kombination to do it in Windows too). It's just bizarre that Telegram can't do it.

In LaTeX and most flavours of markdown, em-dash is --- while -- is en-dash. So it's still stupid that Telegram has it this way.

And, as already mentioned, there is no way to revert the change. I don't know how many times I have had scripts fail because someone pasted it in Telegram.

proea commented 7 years ago

@lindhe I agree with you!

ralesk commented 7 years ago

@lindhe This is a Qt application. The CtrlShiftU thing is a Gtk-only feature, sadly not adopted by X11 or as far as I'm aware, Wayland, and Qt believe that it should be the job of something lower down (again X11 or Wayland) and they refuse to implement it :D (not sure to smile or cry tbh)

lindhe commented 7 years ago

I'm aware. 😿 😭 😭

Walkman100 commented 7 years ago

@ralesk Ctrl+Shift+u, 2014, Enter works for me in Telegram Desktop.

edmundlaugasson commented 7 years ago

@Walkman100 Ctrl+Shift+u 2014 Enter does not work for me. Using Telegram Desktop 1.1.19. When to create dash using mentioned shortcut keys in some text editor and then copy to Telegram - then there are seen those dashes but when to copy such command from message directly to command-line and press enter then you will get errors because these dashes are not correct ones. You can try e.g. with command sudo dpkg --configure -a

lindhe commented 7 years ago

@Walkman100 What version of Telegram are you using? What OS are you running and what package did you install?

Walkman100 commented 7 years ago

Telegram Desktop v1.1.19, not installed from a package (what?), Linux Mint 17.3 Rosa, Qt: 4.8.6, KDE Development Platform: 4.14.2, Plasma Desktop Shell: 4.11.11

@edmundlaugasson Don't get me wrong, I am completely in favour of dropping this "feature" completely, I know how painful it is

ralesk commented 7 years ago

hahahaha FOUND IT

You know what enables CtrlShiftU in Qt/KDE applications? iBus. I quit it and the feature disappeared.