Package: release.debian.org
Severity: normal
User: release.debian....@packages.debian.org
Usertags: unblock

Dear release team,

A couple of weeks back I cherry picked some upstream fixes for konsole, the 
package was uploaded to experimental first and then to unstable as a way get 
more testers, recently I've updated konsole further, improving one of the 
patches and updating the manpage, the full list of changes against the version 
in stretch follows:

 + upstream_render_text_at_primary_fonts_baseline.patch (Closes: 858584)
   This fixes the font rendering when a glyph is being replaced (for example
   using the powerline glyphs), otherwise the glyph might be shown out of
   place, and moved around on redraw.

 + Add-nofork-as-compatibility-alias-for-separate.patch
   Upstream description:

    Subject: Add --nofork as compatibility alias for --separate

    In previous incarnations of kuniqueapplication it used to inject a common
    command option --nofork which is meant to bypass single-instance behavior.
    Given that konsole can and is being invoked from scripts they may well want
    to ensure that the fork they created is the actual instance of konsole.
    i.e. to monitor return values and life time

    Presently, since the options are divergent between konsole4 and konsole5,
    scripts are either incompatible with older konsoles or with newer konsoles.
    To make life easier for everyone add a compat alias --nofork, which
    behaves exactly like separate.

    (this unbreaks steam, which is a notable recent offender of falling into
     this particular trap)

    REVIEW: 129647
    CHANGELOG: Added compatibility command option `--nofork` for 
single-instance behavior

  + Add patch: Update-release-date-scripting-and-command-line-help.patch.
    Cherry-Picked from "Update release/date, scripting and command line
    help" (792eda5).
    Update manpage. KDE#373905

 + Fix-build.patch

 syntax error in the preprocessor causing an incomplete build.

 + TerminalDisplay-Abort-painting-invalid-rect.patch

 Reflect in Kate Konsole part see https://git.reviewboard.kde.org/r/129903/

 + Screen-Fix-potential-crash-when-ExtendedCharTable-tries-t.patch

 + Handle-surrogate-utf16-characters.patch

   Upstream description:

    Subject: Handle surrogate utf16 characters

    For our own sanity we (falsely) assume that all surrogate characters are
    double width, otherwise we have to go back and reflow the line.

    This makes it work better with emojis in vim at least.

 + Fix-word-boundaries-with-combining-characters.patch

   Upstream description:

    Subject: Fix word boundaries with combining characters

    Without this it doesn't correctly detect word boundaries e. g. in
    arabic.
  Inverts the logic.

 + Don-t-include-newlines-in-selection-if-trimming-is-on.patch

   Fix triple click behaviour.

 + Limit-ourselves-to-3-combining-characters.patch

   Upstream description:

    Subject: Limit ourselves to 3 combining characters

    This seems to be the limit in all the test files I've been trying.
    Without this we get an issue with too many combining characters where
    Konsole will eventually just hang.

 + Allow-ANSI-string-terminator-to-work.patch

   Upstream description:
    Treat "\e]0;<title>\e\\" (set window title) the same way
    it interprets "\e]0;<title>\007".

    It seems that Konsole does not recognize the standard string terminator
    sequence "\e\\" (ESC \). Everything works fine if I use "\007" (BEL).

    <http://invisible-island.net/xterm/xterm.faq.html#how2_title>

  + Add patch: Correct-ANSI-string-terminator.patch.
    Cherry-picked from "Correct ANSI string terminator" (7a41b73)
    Fixes Allow-ANSI-string-terminator-to-work.patch, \e is 033 which is 27
    decimal.

 + Fix-opening-of-new-tabs-with-multiple-processes.patch

   Upstream description:
    Subject: Fix opening of new tabs with multiple processes

    Make sure we re-use the process if the user wants a new tab.

   Fixes KDE#373440

  + Add patch: Add-check-for-valid-container-possible-crash-fix.patch.
    Cherry-picked from "Add check for valid container (possible crash fix)"
    (a2b6a81)
    Related to KDE#375540

konsole 4:16.12.0-4 is currently in unstable and has built in all the release 
architectures. I'm attaching the full debdiff between the version 4:16.12.0-1 
currently in stretch and the 4:16.12.0-4 version.

Happy hacking,

Please unblock package konsole

unblock konsole/4:16.12.0-4

-- System Information:
Debian Release: 9.0
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'testing-debug'), (500, 
'testing'), (500, 'stable'), (50, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386, armhf

Kernel: Linux 4.9.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Init: systemd (via /run/systemd/system)
diff -Nru konsole-16.12.0/debian/changelog konsole-16.12.0/debian/changelog
--- konsole-16.12.0/debian/changelog    2016-12-23 18:48:09.000000000 +0100
+++ konsole-16.12.0/debian/changelog    2017-05-11 15:08:52.000000000 +0200
@@ -1,3 +1,45 @@
+konsole (4:16.12.0-4) unstable; urgency=medium
+
+  * Add patch: Update-release-date-scripting-and-command-line-help.patch.
+    Cherry-Picked from "Update release/date, scripting and command line
+    help" (792eda5).
+    Update manpage. KDE#373905
+  * Add patch: Add-check-for-valid-container-possible-crash-fix.patch.
+    Cherry-picked from "Add check for valid container (possible crash fix)"
+    (a2b6a81)
+    Related to KDE#375540
+  * Add patch: Correct-ANSI-string-terminator.patch.
+    Cherry-picked from "Correct ANSI string terminator" (7a41b73)
+    Fixes Allow-ANSI-string-terminator-to-work.patch, \e is 033 which is 27
+    decimal.
+
+ -- Maximiliano Curia <m...@debian.org>  Thu, 11 May 2017 15:08:52 +0200
+
+konsole (4:16.12.0-3) unstable; urgency=medium
+
+  * Release to unstable
+
+ -- Maximiliano Curia <m...@debian.org>  Thu, 30 Mar 2017 17:33:10 +0200
+
+konsole (4:16.12.0-2) experimental; urgency=medium
+
+  * Add new upstream patch:
+    upstream_render_text_at_primary_fonts_baseline.patch (Closes: 858584)
+  * Add upstream patch: Add-nofork-as-compatibility-alias-for-separate.patch
+  * Add upstream patch: Fix-build.patch
+  * Add upstream patch: TerminalDisplay-Abort-painting-invalid-rect.patch
+  * Add upstream patch:
+    Screen-Fix-potential-crash-when-ExtendedCharTable-tries-t.patch
+  * Add upstream patch: Handle-surrogate-utf16-characters.patch
+  * Add upstream patch: Fix-word-boundaries-with-combining-characters.patch
+  * Add upstream patch:
+    Don-t-include-newlines-in-selection-if-trimming-is-on.patch
+  * Add upstream patch: Limit-ourselves-to-3-combining-characters.patch
+  * Add upstream patch: Allow-ANSI-string-terminator-to-work.patch
+  * Add upstream patch: Fix-opening-of-new-tabs-with-multiple-processes.patch
+
+ -- Maximiliano Curia <m...@debian.org>  Mon, 27 Mar 2017 14:17:37 +0200
+
 konsole (4:16.12.0-1) unstable; urgency=medium
 
   [ Maximiliano Curia ]
diff -Nru 
konsole-16.12.0/debian/patches/Add-check-for-valid-container-possible-crash-fix.patch
 
konsole-16.12.0/debian/patches/Add-check-for-valid-container-possible-crash-fix.patch
--- 
konsole-16.12.0/debian/patches/Add-check-for-valid-container-possible-crash-fix.patch
       1970-01-01 01:00:00.000000000 +0100
+++ 
konsole-16.12.0/debian/patches/Add-check-for-valid-container-possible-crash-fix.patch
       2017-05-11 15:08:52.000000000 +0200
@@ -0,0 +1,26 @@
+From: Kurt Hindenburg <kurt.hindenb...@gmail.com>
+Date: Fri, 21 Apr 2017 21:40:32 -0400
+Subject: Add check for valid container (possible crash fix)
+
+Possible fix for crashes from ambiguous shortcuts.  I have been unable
+to duplicate the crashes.
+
+CCBUG: 375540
+---
+ src/ViewManager.cpp | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/src/ViewManager.cpp b/src/ViewManager.cpp
+index c187e646..50d650d1 100644
+--- a/src/ViewManager.cpp
++++ b/src/ViewManager.cpp
+@@ -905,6 +905,9 @@ void ViewManager::saveSessions(KConfigGroup& group)
+     // first: sessions in the active container, preserving the order
+     ViewContainer* container = _viewSplitter->activeContainer();
+     Q_ASSERT(container);
++    if (container == nullptr) {
++        return;
++    }
+     TerminalDisplay* activeview = 
qobject_cast<TerminalDisplay*>(container->activeView());
+ 
+     QListIterator<QWidget*> viewIter(container->views());
diff -Nru 
konsole-16.12.0/debian/patches/Add-nofork-as-compatibility-alias-for-separate.patch
 
konsole-16.12.0/debian/patches/Add-nofork-as-compatibility-alias-for-separate.patch
--- 
konsole-16.12.0/debian/patches/Add-nofork-as-compatibility-alias-for-separate.patch
 1970-01-01 01:00:00.000000000 +0100
+++ 
konsole-16.12.0/debian/patches/Add-nofork-as-compatibility-alias-for-separate.patch
 2017-05-11 15:08:52.000000000 +0200
@@ -0,0 +1,55 @@
+From: Harald Sitter <sit...@kde.org>
+Date: Mon, 19 Dec 2016 09:09:03 +0100
+Subject: Add --nofork as compatibility alias for --separate
+
+In previous incarnations of kuniqueapplication it used to inject a common
+command option --nofork which is meant to bypass single-instance behavior.
+Given that konsole can and is being invoked from scripts they may well want
+to ensure that the fork they created is the actual instance of konsole.
+i.e. to monitor return values and life time
+
+Presently, since the options are divergent between konsole4 and konsole5,
+scripts are either incompatible with older konsoles or with newer konsoles.
+To make life easier for everyone add a compat alias --nofork, which
+behaves exactly like separate.
+
+(this unbreaks steam, which is a notable recent offender of falling into
+ this particular trap)
+
+REVIEW: 129647
+CHANGELOG: Added compatibility command option `--nofork` for single-instance 
behavior
+---
+ src/Application.cpp | 3 ++-
+ src/main.cpp        | 5 ++++-
+ 2 files changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/src/Application.cpp b/src/Application.cpp
+index 12ffe230..f165f1b5 100644
+--- a/src/Application.cpp
++++ b/src/Application.cpp
+@@ -74,7 +74,8 @@ void 
Application::populateCommandLineParser(QCommandLineParser *parser)
+     parser->addOption(QCommandLineOption(QStringList() << 
QStringLiteral("background-mode"),
+                                         i18nc("@info:shell", "Start Konsole 
in the background and bring to the front"
+                                               " when Ctrl+Shift+F12 (by 
default) is pressed")));
+-    parser->addOption(QCommandLineOption(QStringList() << 
QStringLiteral("separate"), i18n("Run in a separate process")));
++    // --nofork is a compatibility alias for separate
++    parser->addOption(QCommandLineOption(QStringList() << 
QStringLiteral("separate") << QStringLiteral("nofork"), i18n("Run in a separate 
process")));
+     parser->addOption(QCommandLineOption(QStringList() << 
QStringLiteral("show-menubar"), i18nc("@info:shell", "Show the menubar, 
overriding the default setting")));
+     parser->addOption(QCommandLineOption(QStringList() << 
QStringLiteral("hide-menubar"), i18nc("@info:shell", "Hide the menubar, 
overriding the default setting")));
+     parser->addOption(QCommandLineOption(QStringList() << 
QStringLiteral("show-tabbar"), i18nc("@info:shell", "Show the tabbar, 
overriding the default setting")));
+diff --git a/src/main.cpp b/src/main.cpp
+index e77597ad..fb53560e 100644
+--- a/src/main.cpp
++++ b/src/main.cpp
+@@ -232,7 +232,10 @@ bool shouldUseNewProcess(int argc, char *argv[])
+     }
+ 
+     // if users have explictly requested starting a new process
+-    if (arguments.contains(QStringLiteral("--separate"))) {
++    // Support --nofork to retain argument compatibility with older
++    // versions.
++    if (arguments.contains(QStringLiteral("--separate")) ||
++        arguments.contains(QStringLiteral("--nofork"))) {
+         return true;
+     }
+ 
diff -Nru 
konsole-16.12.0/debian/patches/Allow-ANSI-string-terminator-to-work.patch 
konsole-16.12.0/debian/patches/Allow-ANSI-string-terminator-to-work.patch
--- konsole-16.12.0/debian/patches/Allow-ANSI-string-terminator-to-work.patch   
1970-01-01 01:00:00.000000000 +0100
+++ konsole-16.12.0/debian/patches/Allow-ANSI-string-terminator-to-work.patch   
2017-05-11 15:08:52.000000000 +0200
@@ -0,0 +1,34 @@
+From: Kurt Hindenburg <kurt.hindenb...@gmail.com>
+Date: Sat, 28 Jan 2017 10:22:52 -0500
+Subject: Allow ANSI string terminator to work
+
+Treat "\e]0;<title>\e\\" (set window title) the same way
+it interprets "\e]0;<title>\007".
+
+It seems that Konsole does not recognize the standard string terminator
+sequence "\e\\" (ESC \). Everything works fine if I use "\007" (BEL).
+
+<http://invisible-island.net/xterm/xterm.faq.html#how2_title>
+
+Thanks to Aniketh Girish anikethgireesh gmail com and Martin Sandsmark
+martin sandsmark kde org for patch/review
+
+BUG:231405
+REVIEW:129895
+---
+ src/Vt102Emulation.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/Vt102Emulation.cpp b/src/Vt102Emulation.cpp
+index a0c73cef..1bde8469 100644
+--- a/src/Vt102Emulation.cpp
++++ b/src/Vt102Emulation.cpp
+@@ -280,7 +280,7 @@ void Vt102Emulation::initTokenizer()
+ #define epe( )     (p >=  3  && s[2] == '!')
+ #define egt( )     (p >=  3  && s[2] == '>')
+ #define Xpe        (tokenBufferPos >= 2 && tokenBuffer[1] == ']')
+-#define Xte        (Xpe      && cc ==  7 )
++#define Xte        (Xpe      && (cc ==  7 || cc == 33))
+ #define ces(C)     (cc < 256 && (charClass[cc] & (C)) == (C) && !Xte)
+ 
+ #define CNTL(c) ((c)-'@')
diff -Nru konsole-16.12.0/debian/patches/Correct-ANSI-string-terminator.patch 
konsole-16.12.0/debian/patches/Correct-ANSI-string-terminator.patch
--- konsole-16.12.0/debian/patches/Correct-ANSI-string-terminator.patch 
1970-01-01 01:00:00.000000000 +0100
+++ konsole-16.12.0/debian/patches/Correct-ANSI-string-terminator.patch 
2017-05-11 15:08:52.000000000 +0200
@@ -0,0 +1,28 @@
+From: Kurt Hindenburg <kurt.hindenb...@gmail.com>
+Date: Mon, 24 Apr 2017 23:28:01 -0400
+Subject: Correct ANSI string terminator
+
+Use the correct decimal value 27
+
+In bash, PS1="\e]0;<title>\e\\" or PS1="\e]0;<title>\033"
+
+BUG: 231405
+
+Differential Revision: https://phabricator.kde.org/D5576
+---
+ src/Vt102Emulation.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/Vt102Emulation.cpp b/src/Vt102Emulation.cpp
+index 1bde8469..cac34ec3 100644
+--- a/src/Vt102Emulation.cpp
++++ b/src/Vt102Emulation.cpp
+@@ -280,7 +280,7 @@ void Vt102Emulation::initTokenizer()
+ #define epe( )     (p >=  3  && s[2] == '!')
+ #define egt( )     (p >=  3  && s[2] == '>')
+ #define Xpe        (tokenBufferPos >= 2 && tokenBuffer[1] == ']')
+-#define Xte        (Xpe      && (cc ==  7 || cc == 33))
++#define Xte        (Xpe      && (cc ==  7 || cc == 27))
+ #define ces(C)     (cc < 256 && (charClass[cc] & (C)) == (C) && !Xte)
+ 
+ #define CNTL(c) ((c)-'@')
diff -Nru 
konsole-16.12.0/debian/patches/Don-t-include-newlines-in-selection-if-trimming-is-on.patch
 
konsole-16.12.0/debian/patches/Don-t-include-newlines-in-selection-if-trimming-is-on.patch
--- 
konsole-16.12.0/debian/patches/Don-t-include-newlines-in-selection-if-trimming-is-on.patch
  1970-01-01 01:00:00.000000000 +0100
+++ 
konsole-16.12.0/debian/patches/Don-t-include-newlines-in-selection-if-trimming-is-on.patch
  2017-05-11 15:08:52.000000000 +0200
@@ -0,0 +1,33 @@
+From: "Martin T. H. Sandsmark" <martin.sandsm...@kde.org>
+Date: Sun, 15 Jan 2017 14:14:10 +0100
+Subject: Don't include newlines in selection if trimming is on
+
+BUG: 199381
+REVIEW: 129837
+---
+ src/Screen.cpp | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/src/Screen.cpp b/src/Screen.cpp
+index 5438e83b..0b3124a5 100644
+--- a/src/Screen.cpp
++++ b/src/Screen.cpp
+@@ -1185,7 +1185,8 @@ void Screen::writeToStream(TerminalCharacterDecoder* 
decoder,
+         // this makes it possible to 'select' a trailing new line character 
after
+         // the text on a line.
+         if (y == bottom &&
+-                copied < count) {
++                copied < count &&
++                !trimTrailingSpaces) {
+             Character newLineChar('\n');
+             decoder->decodeLine(&newLineChar, 1, 0);
+         }
+@@ -1257,7 +1258,7 @@ int Screen::copyLineToStream(int line ,
+             // ignore trailing white space at the end of the line
+             for (int i = length-1; i >= 0; i--)
+             {
+-                if (data[i].character == ' ')
++                if (QChar(data[i].character).isSpace())
+                     length--;
+                 else
+                     break;
diff -Nru konsole-16.12.0/debian/patches/Fix-build.patch 
konsole-16.12.0/debian/patches/Fix-build.patch
--- konsole-16.12.0/debian/patches/Fix-build.patch      1970-01-01 
01:00:00.000000000 +0100
+++ konsole-16.12.0/debian/patches/Fix-build.patch      2017-05-11 
15:08:52.000000000 +0200
@@ -0,0 +1,23 @@
+From: Aleix Pol <aleix...@kde.org>
+Date: Wed, 18 Jan 2017 12:15:00 +0100
+Subject: Fix build
+
+frameworks/konsole/src/Session.cpp:839:5: warning: 'not' is not defined,
+evaluates to 0 [-Wundef]
+---
+ src/Session.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/Session.cpp b/src/Session.cpp
+index d63c8a0c..482ee0b6 100644
+--- a/src/Session.cpp
++++ b/src/Session.cpp
+@@ -836,7 +836,7 @@ void Session::sendTextToTerminal(const QString& text, 
const QChar& eol) const
+ // Only D-Bus calls this function (via SendText or runCommand)
+ void Session::sendText(const QString& text) const
+ {
+-#if not defined(REMOVE_SENDTEXT_RUNCOMMAND_DBUS_METHODS)
++#if !defined(REMOVE_SENDTEXT_RUNCOMMAND_DBUS_METHODS)
+     if (show_disallow_certain_dbus_methods_message) {
+ 
+         KNotification::event(KNotification::Warning, "Konsole D-Bus Warning",
diff -Nru 
konsole-16.12.0/debian/patches/Fix-opening-of-new-tabs-with-multiple-processes.patch
 
konsole-16.12.0/debian/patches/Fix-opening-of-new-tabs-with-multiple-processes.patch
--- 
konsole-16.12.0/debian/patches/Fix-opening-of-new-tabs-with-multiple-processes.patch
        1970-01-01 01:00:00.000000000 +0100
+++ 
konsole-16.12.0/debian/patches/Fix-opening-of-new-tabs-with-multiple-processes.patch
        2017-05-11 15:08:52.000000000 +0200
@@ -0,0 +1,27 @@
+From: "Martin T. H. Sandsmark" <martin.sandsm...@kde.org>
+Date: Wed, 25 Jan 2017 22:25:48 +0100
+Subject: Fix opening of new tabs with multiple processes
+
+Make sure we re-use the process if the user wants a new tab.
+
+BUG: 373440
+REVIEW: 129886
+---
+ src/main.cpp | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/main.cpp b/src/main.cpp
+index fb53560e..db3b83bf 100644
+--- a/src/main.cpp
++++ b/src/main.cpp
+@@ -121,8 +121,8 @@ extern "C" int Q_DECL_EXPORT kdemain(int argc, char* 
argv[])
+     parser->process(args);
+     about.processCommandLine(parser.data());
+ 
+-    // Enable user to force multiple instances
+-    if (!Konsole::KonsoleSettings::useSingleInstance()) {
++    // Enable user to force multiple instances, unless a new tab is requested
++    if (!Konsole::KonsoleSettings::useSingleInstance() && 
!parser->isSet(QStringLiteral("new-tab"))) {
+         startupOption = KDBusService::Multiple;
+     }
+ 
diff -Nru 
konsole-16.12.0/debian/patches/Fix-word-boundaries-with-combining-characters.patch
 
konsole-16.12.0/debian/patches/Fix-word-boundaries-with-combining-characters.patch
--- 
konsole-16.12.0/debian/patches/Fix-word-boundaries-with-combining-characters.patch
  1970-01-01 01:00:00.000000000 +0100
+++ 
konsole-16.12.0/debian/patches/Fix-word-boundaries-with-combining-characters.patch
  2017-05-11 15:08:52.000000000 +0200
@@ -0,0 +1,32 @@
+From: "Martin T. H. Sandsmark" <martin.sandsm...@kde.org>
+Date: Sun, 15 Jan 2017 16:38:55 +0100
+Subject: Fix word boundaries with combining characters
+
+Without this it doesn't correctly detect word boundaries e. g. in
+arabic.
+
+REVIEW: 129840
+---
+ src/TerminalDisplay.cpp | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/src/TerminalDisplay.cpp b/src/TerminalDisplay.cpp
+index f8263499..74be5858 100644
+--- a/src/TerminalDisplay.cpp
++++ b/src/TerminalDisplay.cpp
+@@ -2794,10 +2794,11 @@ QChar TerminalDisplay::charClass(const Character& ch) 
const
+             const QString s = QString::fromUtf16(chars, extendedCharLength);
+             if (_wordCharacters.contains(s, Qt::CaseInsensitive))
+                 return 'a';
+-            bool allLetterOrNumber = true;
+-            for (int i = 0; allLetterOrNumber && i < s.size(); ++i)
+-                allLetterOrNumber = s.at(i).isLetterOrNumber();
+-            return allLetterOrNumber ? 'a' : s.at(0);
++            bool letterOrNumber = false;
++            for (int i = 0; !letterOrNumber && i < s.size(); ++i) {
++                letterOrNumber = s.at(i).isLetterOrNumber();
++            }
++            return letterOrNumber ? 'a' : s.at(0);
+         }
+         return 0;
+     } else {
diff -Nru 
konsole-16.12.0/debian/patches/Handle-surrogate-utf16-characters.patch 
konsole-16.12.0/debian/patches/Handle-surrogate-utf16-characters.patch
--- konsole-16.12.0/debian/patches/Handle-surrogate-utf16-characters.patch      
1970-01-01 01:00:00.000000000 +0100
+++ konsole-16.12.0/debian/patches/Handle-surrogate-utf16-characters.patch      
2017-05-11 15:08:52.000000000 +0200
@@ -0,0 +1,48 @@
+From: "Martin T. H. Sandsmark" <martin.sandsm...@kde.org>
+Date: Sun, 15 Jan 2017 16:48:24 +0100
+Subject: Handle surrogate utf16 characters
+
+For our own sanity we (falsely) assume that all surrogate characters are
+double width, otherwise we have to go back and reflow the line.
+
+This makes it work better with emojis in vim at least.
+
+REVIEW: 129841
+---
+ src/Screen.cpp          | 2 +-
+ src/konsole_wcwidth.cpp | 8 +++++++-
+ 2 files changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/src/Screen.cpp b/src/Screen.cpp
+index d674017b..5438e83b 100644
+--- a/src/Screen.cpp
++++ b/src/Screen.cpp
+@@ -636,7 +636,7 @@ void Screen::displayCharacter(unsigned short c)
+         return;
+     } else if (w == 0) {
+         const QChar::Category category = QChar(c).category();
+-        if (category != QChar::Mark_NonSpacing && category != 
QChar::Letter_Other) {
++        if (category != QChar::Mark_NonSpacing && category != 
QChar::Letter_Other && !QChar::isLowSurrogate(c)) {
+             return;
+         }
+         // Find previous "real character" to try to combine with
+diff --git a/src/konsole_wcwidth.cpp b/src/konsole_wcwidth.cpp
+index 39c23076..212bc1b5 100644
+--- a/src/konsole_wcwidth.cpp
++++ b/src/konsole_wcwidth.cpp
+@@ -186,8 +186,14 @@ int KONSOLEPRIVATE_EXPORT konsole_wcwidth(quint16 oucs)
+     };
+ 
+     /* test for 8-bit control characters */
+-    if (ucs == 0)
++    if (ucs == 0 || QChar::isLowSurrogate(ucs))
+         return 0;
++
++    /* Always assume double width, otherwise we have to go back and move 
characters */
++    if (QChar::isHighSurrogate(ucs)) {
++        return 2;
++    }
++
+     if (ucs < 32 || (ucs >= 0x7f && ucs < 0xa0))
+         return -1;
+ 
diff -Nru 
konsole-16.12.0/debian/patches/Limit-ourselves-to-3-combining-characters.patch 
konsole-16.12.0/debian/patches/Limit-ourselves-to-3-combining-characters.patch
--- 
konsole-16.12.0/debian/patches/Limit-ourselves-to-3-combining-characters.patch  
    1970-01-01 01:00:00.000000000 +0100
+++ 
konsole-16.12.0/debian/patches/Limit-ourselves-to-3-combining-characters.patch  
    2017-05-11 15:08:52.000000000 +0200
@@ -0,0 +1,49 @@
+From: "Martin T. H. Sandsmark" <martin.sandsm...@kde.org>
+Date: Sun, 22 Jan 2017 21:00:24 +0100
+Subject: Limit ourselves to 3 combining characters
+
+This seems to be the limit in all the test files I've been trying.
+Without this we get an issue with too many combining characters where
+Konsole will eventually just hang.
+
+REVIEW: 129874
+---
+ src/Screen.cpp     |  2 +-
+ tests/combining.py | 15 +++++++++++++++
+ 2 files changed, 16 insertions(+), 1 deletion(-)
+ create mode 100644 tests/combining.py
+
+diff --git a/src/Screen.cpp b/src/Screen.cpp
+index 0b3124a5..b3d513fe 100644
+--- a/src/Screen.cpp
++++ b/src/Screen.cpp
+@@ -668,7 +668,7 @@ void Screen::displayCharacter(unsigned short c)
+             ushort extendedCharLength;
+             const ushort* oldChars = 
ExtendedCharTable::instance.lookupExtendedChar(currentChar.character, 
extendedCharLength);
+             Q_ASSERT(oldChars);
+-            if (oldChars) {
++            if (oldChars && extendedCharLength < 3) {
+                 Q_ASSERT(extendedCharLength > 1);
+                 Q_ASSERT(extendedCharLength < 65535);
+                 ushort* chars = new ushort[extendedCharLength + 1];
+diff --git a/tests/combining.py b/tests/combining.py
+new file mode 100644
+index 00000000..fb2afc68
+--- /dev/null
++++ b/tests/combining.py
+@@ -0,0 +1,15 @@
++#!/usr/bin/env python3
++
++'''
++Generates an endless amount of combining characters
++'''
++
++import random
++import string
++
++combs = 
list("\u0300\u0301\u0302\u0303\u0304\u0305\u0306\u0307\u0308\u0309\u030A\u030B\u030C\u030D\u030E\u030F")
++
++while True:
++    random.shuffle(combs)
++    print(random.choice(string.ascii_letters)+"".join(combs), end="", 
flush=True)
++
diff -Nru 
konsole-16.12.0/debian/patches/Pre-process-the-e-custom-command-argument.patch 
konsole-16.12.0/debian/patches/Pre-process-the-e-custom-command-argument.patch
--- 
konsole-16.12.0/debian/patches/Pre-process-the-e-custom-command-argument.patch  
    2016-12-23 18:48:09.000000000 +0100
+++ 
konsole-16.12.0/debian/patches/Pre-process-the-e-custom-command-argument.patch  
    2017-05-11 15:08:52.000000000 +0200
@@ -11,7 +11,7 @@
  3 files changed, 35 insertions(+), 16 deletions(-)
 
 diff --git a/src/Application.cpp b/src/Application.cpp
-index 5b352ec..12ffe23 100644
+index 5b352ec9..12ffe230 100644
 --- a/src/Application.cpp
 +++ b/src/Application.cpp
 @@ -45,7 +45,7 @@
@@ -85,7 +85,7 @@
      QCommandLineParser *parser = new QCommandLineParser;
      populateCommandLineParser(parser);
 diff --git a/src/Application.h b/src/Application.h
-index 8987d78..8ec7ab6 100644
+index 8987d789..8ec7ab6a 100644
 --- a/src/Application.h
 +++ b/src/Application.h
 @@ -50,9 +50,10 @@ class Application : public QObject
@@ -109,7 +109,7 @@
  }
  #endif  // APPLICATION_H
 diff --git a/src/main.cpp b/src/main.cpp
-index 26d3da9..e77597a 100644
+index 26d3da99..e77597ad 100644
 --- a/src/main.cpp
 +++ b/src/main.cpp
 @@ -112,9 +112,13 @@ extern "C" int Q_DECL_EXPORT kdemain(int argc, char* 
argv[])
diff -Nru 
konsole-16.12.0/debian/patches/Screen-Fix-potential-crash-when-ExtendedCharTable-tries-t.patch
 
konsole-16.12.0/debian/patches/Screen-Fix-potential-crash-when-ExtendedCharTable-tries-t.patch
--- 
konsole-16.12.0/debian/patches/Screen-Fix-potential-crash-when-ExtendedCharTable-tries-t.patch
      1970-01-01 01:00:00.000000000 +0100
+++ 
konsole-16.12.0/debian/patches/Screen-Fix-potential-crash-when-ExtendedCharTable-tries-t.patch
      2017-05-11 15:08:52.000000000 +0200
@@ -0,0 +1,21 @@
+From: "Martin T. H. Sandsmark" <martin.sandsm...@kde.org>
+Date: Sun, 22 Jan 2017 18:20:54 +0100
+Subject: Screen: Fix potential crash when ExtendedCharTable tries to clean
+
+---
+ src/Screen.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/Screen.h b/src/Screen.h
+index aaa282eb..443d0ecf 100644
+--- a/src/Screen.h
++++ b/src/Screen.h
+@@ -580,7 +580,7 @@ public:
+         QSet<ushort> result;
+         for (int i = 0; i < _lines; ++i) {
+             const ImageLine& il = _screenLines[i];
+-            for (int j = 0; j < _columns; ++j) {
++            for (int j = 0; j < il.length(); ++j) {
+                 if (il[j].rendition & RE_EXTENDED_CHAR) {
+                     result << il[j].character;
+                 }
diff -Nru konsole-16.12.0/debian/patches/series 
konsole-16.12.0/debian/patches/series
--- konsole-16.12.0/debian/patches/series       2016-12-23 18:48:09.000000000 
+0100
+++ konsole-16.12.0/debian/patches/series       2017-05-11 15:08:52.000000000 
+0200
@@ -1 +1,15 @@
 Pre-process-the-e-custom-command-argument.patch
+upstream_render_text_at_primary_fonts_baseline.patch
+Add-nofork-as-compatibility-alias-for-separate.patch
+Fix-build.patch
+TerminalDisplay-Abort-painting-invalid-rect.patch
+Screen-Fix-potential-crash-when-ExtendedCharTable-tries-t.patch
+Handle-surrogate-utf16-characters.patch
+Fix-word-boundaries-with-combining-characters.patch
+Don-t-include-newlines-in-selection-if-trimming-is-on.patch
+Limit-ourselves-to-3-combining-characters.patch
+Fix-opening-of-new-tabs-with-multiple-processes.patch
+Allow-ANSI-string-terminator-to-work.patch
+Update-release-date-scripting-and-command-line-help.patch
+Add-check-for-valid-container-possible-crash-fix.patch
+Correct-ANSI-string-terminator.patch
diff -Nru 
konsole-16.12.0/debian/patches/TerminalDisplay-Abort-painting-invalid-rect.patch
 
konsole-16.12.0/debian/patches/TerminalDisplay-Abort-painting-invalid-rect.patch
--- 
konsole-16.12.0/debian/patches/TerminalDisplay-Abort-painting-invalid-rect.patch
    1970-01-01 01:00:00.000000000 +0100
+++ 
konsole-16.12.0/debian/patches/TerminalDisplay-Abort-painting-invalid-rect.patch
    2017-05-11 15:08:52.000000000 +0200
@@ -0,0 +1,25 @@
+From: Anthony Fieroni <bvb...@abv.bg>
+Date: Mon, 6 Feb 2017 21:20:00 +0200
+Subject: [TerminalDisplay] Abort painting invalid rect
+
+REVIEW: 129914
+
+Signed-off-by: Anthony Fieroni <bvb...@abv.bg>
+---
+ src/TerminalDisplay.cpp | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/TerminalDisplay.cpp b/src/TerminalDisplay.cpp
+index 1d70d7c2..f8263499 100644
+--- a/src/TerminalDisplay.cpp
++++ b/src/TerminalDisplay.cpp
+@@ -1749,7 +1749,8 @@ void TerminalDisplay::updateCursor()
+ 
+ void TerminalDisplay::resizeEvent(QResizeEvent*)
+ {
+-    updateImageSize();
++    if (contentsRect().isValid())
++        updateImageSize();
+ }
+ 
+ void TerminalDisplay::propagateSize()
diff -Nru 
konsole-16.12.0/debian/patches/Update-release-date-scripting-and-command-line-help.patch
 
konsole-16.12.0/debian/patches/Update-release-date-scripting-and-command-line-help.patch
--- 
konsole-16.12.0/debian/patches/Update-release-date-scripting-and-command-line-help.patch
    1970-01-01 01:00:00.000000000 +0100
+++ 
konsole-16.12.0/debian/patches/Update-release-date-scripting-and-command-line-help.patch
    2017-05-11 15:08:52.000000000 +0200
@@ -0,0 +1,112 @@
+From: Kurt Hindenburg <kurt.hindenb...@gmail.com>
+Date: Sat, 28 Jan 2017 12:43:26 -0500
+Subject: Update release/date, scripting and command line help
+
+Add more info about using dbus with Konsole's envirnomental variables
+and re-add --nofork help
+
+BUG: 373905
+---
+ doc/manual/index.docbook | 55 ++++++++++++++++++++++++++++++++++++++----------
+ 1 file changed, 44 insertions(+), 11 deletions(-)
+
+diff --git a/doc/manual/index.docbook b/doc/manual/index.docbook
+index 964a6bb7..d9fc5d1e 100644
+--- a/doc/manual/index.docbook
++++ b/doc/manual/index.docbook
+@@ -38,14 +38,14 @@
+ <holder>&Jonathan.Singer;</holder>
+ </copyright>
+ <copyright>
+-    
<year>2005</year><year>2008</year><year>2009</year><year>2010</year><year>2011</year><year>2014</year><year>2016</year>
++    
<year>2005</year><year>2008</year><year>2009</year><year>2010</year><year>2011</year><year>2014</year><year>2016</year><year>2017</year>
+ <holder>&Kurt.Hindenburg;</holder>
+ </copyright>
+ 
+ <legalnotice>&FDLNotice;</legalnotice>
+ 
+-<date>2016-07-09</date>
+-<releaseinfo>Applications 16.08</releaseinfo>
++<date>2017-01-28</date>
++<releaseinfo>Applications 17.04</releaseinfo>
+ 
+ <abstract><para>&konsole; is &kde;'s terminal emulator.</para></abstract>
+ 
+@@ -1137,6 +1137,7 @@ Empty lines or lines with <userinput>#</userinput> at 
the beginning are ignored,
+ 
+ <varlistentry>
+ <term><option>--separate</option></term>
++<term><option>--nofork</option></term>
+ <listitem><para><action>Run</action> the new instance of &konsole; in a 
separate process.
+ </para></listitem>
+ </varlistentry>
+@@ -1254,17 +1255,54 @@ will display methods for controlling window 1.
+ <listitem><para>
+ <prompt>&percnt;</prompt>
+ <command>qdbus</command>
++<option>org.kde.konsole $KONSOLE_DBUS_WINDOW</option>
++will display methods for controlling the current window.
++</para></listitem>
++
++<listitem><para>
++<prompt>&percnt;</prompt>
++<command>qdbus</command>
+ <option>org.kde.konsole /Sessions/1</option>
+ will display methods for controlling session 1.
+ </para></listitem>
+ 
++<listitem><para>
++<prompt>&percnt;</prompt>
++<command>qdbus</command>
++<option>org.kde.konsole $KONSOLE_DBUS_SESSION</option>
++will display methods for controlling the current session.
++</para></listitem>
++
++<listitem><para>
++<prompt>&percnt;</prompt>
++<command>qdbus</command>
++<option>$KONSOLE_DBUS_SERVICE $KONSOLE_DBUS_SESSION</option>
++will display methods for controlling the current &konsole;'s session.
++</para></listitem>
++
+ </itemizedlist>
+ </para>
+ 
+ <para>
+-If you start &konsole; from a terminal you may need to change
+-<option>org.kde.konsole</option> to
+-<option>org.kde.konsole-`pidof -s konsole`</option>.
++If any of the above commands outputs:
++Service 'org.kde.konsole' does not exist, change
++<option>org.kde.konsole</option> to one of the following:
++
++<itemizedlist>
++
++<listitem><para>
++<option>org.kde.konsole-`pidof -s konsole`</option>
++(will select first pid)
++</para></listitem>
++<listitem><para>
++<option>$KONSOLE_DBUS_SERVICE</option>
++(this can be used from the current &konsole;)
++</para></listitem>
++<listitem><para>
++<option>select one from the output of 'qdbus | grep konsole'</option>
++</para></listitem>
++
++</itemizedlist>
+ </para>
+ 
+ <para>
+@@ -1413,11 +1451,6 @@ CommonDirNames=name1,name2,name3...
+ <title>Common Issues</title>
+ <itemizedlist>
+ 
+-<listitem><para>
+-Starting with version 16.08 (August 2016), &konsole; no longer uses KDE4's 
KUniqueApplication and thus <option>--nofork</option> no longer exists.
+-</para>
+-</listitem>
+-
+ <listitem>
+ <para>Some fonts might be unavailable for usage in &konsole;, although they 
are available in other applications. That doesn't mean there is a bug in 
&konsole;. &konsole; requires monospaced fonts to provide the best visual 
result, so it asks &Qt; to only list monospaced fonts.</para>
+ 
diff -Nru 
konsole-16.12.0/debian/patches/upstream_render_text_at_primary_fonts_baseline.patch
 
konsole-16.12.0/debian/patches/upstream_render_text_at_primary_fonts_baseline.patch
--- 
konsole-16.12.0/debian/patches/upstream_render_text_at_primary_fonts_baseline.patch
 1970-01-01 01:00:00.000000000 +0100
+++ 
konsole-16.12.0/debian/patches/upstream_render_text_at_primary_fonts_baseline.patch
 2017-05-11 15:08:52.000000000 +0200
@@ -0,0 +1,50 @@
+From: Christoph Feck <cf...@kde.org>
+Date: Mon, 27 Mar 2017 11:05:41 +0200
+Subject: upstream_render_text_at_primary_fonts_baseline
+
+commit 7e2f9d839f5af447a0fc7fd178dd5d8f58e489bb
+Author: Christoph Feck <cf...@kde.org>
+Date:   Wed Dec 7 20:12:59 2016 +0100
+
+    Render text at primary font's baseline
+    
+    This only addresses the vertical shift and cutoff of lower
+    parts of characters, but not horizontal shift (characters
+    moving to the left or right).
+    
+    See the linked review request for details.
+    
+    This commit is for the 17.04 version. If you can test master
+    builds, please add feedback.
+    
+    REVIEW: 129281
+    CCBUG: 371687
+---
+ src/TerminalDisplay.cpp | 12 ++----------
+ 1 file changed, 2 insertions(+), 10 deletions(-)
+
+diff --git a/src/TerminalDisplay.cpp b/src/TerminalDisplay.cpp
+index dd911779..1d70d7c2 100644
+--- a/src/TerminalDisplay.cpp
++++ b/src/TerminalDisplay.cpp
+@@ -855,18 +855,10 @@ void TerminalDisplay::drawCharacters(QPainter& painter,
+         // This still allows RTL characters to be rendered in the RTL way.
+         painter.setLayoutDirection(Qt::LeftToRight);
+ 
+-        // the drawText(rect,flags,string) overload is used here with null 
flags
+-        // instead of drawText(rect,string) because the (rect,string) 
overload causes
+-        // the application's default layout direction to be used instead of
+-        // the widget-specific layout direction, which should always be
+-        // Qt::LeftToRight for this widget
+-        //
+-        // This was discussed in: 
http://lists.kde.org/?t=120552223600002&r=1&w=2
+         if (_bidiEnabled) {
+-            painter.drawText(rect, 0, text);
++            painter.drawText(rect.x(), rect.y() + _fontAscent + _lineSpacing, 
text);
+         } else {
+-            // See bug 280896 for more info
+-            painter.drawText(rect, Qt::AlignBottom, LTR_OVERRIDE_CHAR + text);
++            painter.drawText(rect.x(), rect.y() + _fontAscent + _lineSpacing, 
LTR_OVERRIDE_CHAR + text);
+         }
+     }
+ }

Reply via email to