summary refs log tree commit diff
path: root/src/timeline/InputBar.cpp
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2023-01-31 18:22:12 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2023-01-31 18:22:12 +0100
commit0c3d46795b589d9dfb2e6caa7f94db77fd5371bd (patch)
tree4d3bdc9cee84be37f51465e49ec38a9055452dd0 /src/timeline/InputBar.cpp
parentUncoditionally request keyframes (diff)
downloadnheko-0c3d46795b589d9dfb2e6caa7f94db77fd5371bd.tar.xz
Make single newlines cause a <br> by default
This should match what people expect from a chat application much
better. The biggest reason not to do this, is because some people might
paste markdown documents. For those people there is now a /cmark
command, which disables most of our extensions to cmark, including the
newline behaviour. There is a long discussion on the Fediverse and on
Github linked below.

Mastodon https://fosstodon.org/@deepbluev7/109771668066978726
fixes #757
Diffstat (limited to 'src/timeline/InputBar.cpp')
-rw-r--r--src/timeline/InputBar.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/timeline/InputBar.cpp b/src/timeline/InputBar.cpp

index b6355418..94944337 100644 --- a/src/timeline/InputBar.cpp +++ b/src/timeline/InputBar.cpp
@@ -465,6 +465,14 @@ InputBar::message(const QString &msg, MarkdownOverride useMarkdown, bool rainbow text.formatted_body = ""; else text.format = "org.matrix.custom.html"; + } else if (useMarkdown == MarkdownOverride::CMARK) { + // disable all markdown extensions + text.formatted_body = utils::markdownToHtml(msg, rainbowify, true).toStdString(); + // keep everything as it was + text.body = msg.trimmed().toStdString(); + + // always send formatted + text.format = "org.matrix.custom.html"; } text.relations = generateRelations(); @@ -802,6 +810,8 @@ InputBar::command(const QString &command, QString args) cache::dropOutboundMegolmSession(room->roomId().toStdString()); } else if (command == QLatin1String("md")) { message(args, MarkdownOverride::ON); + } else if (command == QLatin1String("cmark")) { + message(args, MarkdownOverride::CMARK); } else if (command == QLatin1String("plain")) { message(args, MarkdownOverride::OFF); } else if (command == QLatin1String("rainbow")) {