From 8e21a1b8b31a95859b000d1ca22affba29511974 Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Thu, 25 Jun 2020 16:17:42 -0400 Subject: [PATCH] fix: word wrap + breaklines --- src/app/chat/views/message_format.nim | 3 ++- src/app/chat/views/message_list.nim | 2 +- ui/app/AppLayouts/Chat/ChatColumn/Message.qml | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/app/chat/views/message_format.nim b/src/app/chat/views/message_format.nim index e508a8279b..759a5e5603 100644 --- a/src/app/chat/views/message_format.nim +++ b/src/app/chat/views/message_format.nim @@ -34,6 +34,7 @@ proc renderBlock(self: ChatMessageList, message: Message): string = of "blockquote": # TODO: extract this from the theme somehow var color = if message.isCurrentUser: "#FFFFFF" else: "#666666" - result = result & fmt("▍ ") & pMsg.literal[1 .. ^1] & "" + result = result & fmt("▍ ") & pMsg.literal & "" of "codeblock": result = "
" & pMsg.literal & "
" + result = result.replace("\n", "
") \ No newline at end of file diff --git a/src/app/chat/views/message_list.nim b/src/app/chat/views/message_list.nim index 62e4272811..349fcfcab8 100644 --- a/src/app/chat/views/message_list.nim +++ b/src/app/chat/views/message_list.nim @@ -5,7 +5,7 @@ import ../../../status/chat import ../../../status/chat/[message,stickers] import ../../../status/profile/profile import ../../../status/ens -import strformat +import strformat, strutils type ChatMessageRoles {.pure.} = enum diff --git a/ui/app/AppLayouts/Chat/ChatColumn/Message.qml b/ui/app/AppLayouts/Chat/ChatColumn/Message.qml index 4efe316df8..9d784b0f6a 100644 --- a/ui/app/AppLayouts/Chat/ChatColumn/Message.qml +++ b/ui/app/AppLayouts/Chat/ChatColumn/Message.qml @@ -242,7 +242,7 @@ Item { anchors.right: message.length > 52 ? parent.right : undefined anchors.rightMargin: message.length > 52 ? parent.chatHorizontalPadding : 0 horizontalAlignment: !isCurrentUser ? Text.AlignLeft : Text.AlignRight - wrapMode: Text.WrapAnywhere + wrapMode: Text.Wrap anchors.top: parent.top anchors.topMargin: chatBox.chatVerticalPadding font.pixelSize: 15