[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [konsole] src: Ignore control characters in the text part of Xpe "ESC]" sequences
From:       Kurt Hindenburg <null () kde ! org>
Date:       2018-05-24 12:34:47
Message-ID: E1fLpSB-0004kM-B5 () code ! kde ! org
[Download RAW message or body]

Git commit d547d1d177bd0582df95a5d50dc3b37e0636748e by Kurt Hindenburg, on behalf of Ahmad Samir.
Committed on 24/05/2018 at 12:34.
Pushed by hindenburg into branch 'master'.

Ignore control characters in the text part of Xpe "ESC]" sequences

Summary:
Ignore control characters in the text part of Xpe (OSC, Operating System
Control) of the form "ESC]Pn;Pt\a" escape sequences; this matches what
XTerm docs say.

If userTitle is an empty string, set the window title to a blank space
when showWindowTitleOnTitleBar is enabled; basically if the user sets
the title to an empty string, leave it as-is.

BUG: 315581
FIXED-IN: 18.08

Test Plan:
- unset PROMPT_COMMAND, in case the shell is configured to set the
   window title via that variable
- Make sure "Show window title on the title bar" is enabled
- Execute:
$ /usr/bin/echo -e 'j\e]2;\n\aj'
- The window title is changed to the tab title text; and the output
    looks like this:
j
j

- Apply the diff, build, and try again, the window title should be
   set to an empty string (really a blank space), and the output
   should look like:
jj

Reviewers: #konsole, hindenburg

Reviewed By: #konsole, hindenburg

Subscribers: konsole-devel, #konsole

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D13078

M  +6    -3    src/MainWindow.cpp
M  +6    -0    src/Vt102Emulation.cpp

https://commits.kde.org/konsole/d547d1d177bd0582df95a5d50dc3b37e0636748e

diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp
index dd662422..21395552 100644
--- a/src/MainWindow.cpp
+++ b/src/MainWindow.cpp
@@ -287,9 +287,12 @@ void MainWindow::updateWindowCaption()
     // use tab title as caption by default
     QString caption = title;
 
-    // use window title as caption only when enabled and it is not empty
-    if (KonsoleSettings::showWindowTitleOnTitleBar() && !userTitle.isEmpty()) {
-        caption = userTitle;
+    // use window title as caption when this setting is enabled
+    // if the userTitle is empty, use a blank space (using an empty string
+    // removes the dash — before the application name; leaving the dash
+    // looks better)
+    if (KonsoleSettings::showWindowTitleOnTitleBar()) {
+        !userTitle.isEmpty() ? caption = userTitle : caption = QStringLiteral(" ");
     }
 
     if (KonsoleSettings::showAppNameOnTitleBar()) {
diff --git a/src/Vt102Emulation.cpp b/src/Vt102Emulation.cpp
index c8419554..8207ec7a 100644
--- a/src/Vt102Emulation.cpp
+++ b/src/Vt102Emulation.cpp
@@ -360,6 +360,12 @@ void Vt102Emulation::receiveChar(uint cc)
 
   if (ces(CTL))
   {
+    // ignore control characters in the text part of Xpe (aka OSC) "ESC]"
+    // escape sequences; this matches what XTERM docs say
+    if (Xpe) {
+        return;
+    }
+
     // DEC HACK ALERT! Control Characters are allowed *within* esc sequences in VT100
     // This means, they do neither a resetTokenizer() nor a pushToToken(). Some of them, do
     // of course. Guess this originates from a weakly layered handling of the X-on
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic