From 7fc674b566e6bfc7efb48daa70abd84fb9dd0415 Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Fri, 3 Mar 2023 16:40:11 +0100 Subject: [PATCH] Terminal: Fix "nano" titlebar QTextLayout ignores trailing spaces, and does not draw their background color. Converting them to Nbsp fixes this. Change-Id: I19a363bcb4792c613eb9c59f7caaa40fa631b937 Reviewed-by: Cristian Adam --- src/plugins/terminal/celllayout.cpp | 2 ++ src/plugins/terminal/terminalwidget.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/plugins/terminal/celllayout.cpp b/src/plugins/terminal/celllayout.cpp index 45b7ca07835..a2628eccb05 100644 --- a/src/plugins/terminal/celllayout.cpp +++ b/src/plugins/terminal/celllayout.cpp @@ -101,6 +101,8 @@ void createTextLayout(QTextLayout &textLayout, if (cell->chars[0] != 0xFFFFFFFF) { QString ch = QString::fromUcs4(cell->chars); + if (ch == ' ') + ch = QChar::Nbsp; if (ch.size() > 0) { layoutText += ch; } else { diff --git a/src/plugins/terminal/terminalwidget.cpp b/src/plugins/terminal/terminalwidget.cpp index 7c76fa76084..8325f2839c7 100644 --- a/src/plugins/terminal/terminalwidget.cpp +++ b/src/plugins/terminal/terminalwidget.cpp @@ -390,6 +390,8 @@ void TerminalWidget::copyToClipboard() const .trimmed()); } + selectedText.replace(QChar::Nbsp, QChar::Space); + setClipboardAndSelection(selectedText); } }