<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>330214</bug_id>
          
          <creation_ts>2014-01-20 16:51:30 +0000</creation_ts>
          <short_desc>Wrong rendering at the end of line when drawing colored whitespaces</short_desc>
          <delta_ts>2014-02-26 04:27:24 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>2</classification_id>
          <classification>Applications</classification>
          <product>konsole</product>
          <component>emulation</component>
          <version>unspecified</version>
          <rep_platform>openSUSE</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>http://gyazo.com/775c9ec8cc81861ff40e62d7350be512</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Igor Kostromin">elwood.su</reporter>
          <assigned_to name="Konsole Bugs">konsole-bugs-null</assigned_to>
          <cc>elwood.su</cc>
    
    <cc>muxa.su</cc>
          
          <cf_commitlink>http://commits.kde.org/konsole/c7b9435d65c4c1324eadc71e66bae2ca78e6dd7a</cf_commitlink>
          <cf_versionfixedin>2.13</cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1425972</commentid>
    <comment_count>0</comment_count>
    <who name="Igor Kostromin">elwood.su</who>
    <bug_when>2014-01-20 16:51:30 +0000</bug_when>
    <thetext>#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;curses.h&gt;

// This program shows bug of rendering in Konsole Version 2.11.2( Using KDE Development Platform 4.11.2) - on OpenSuse 13.1
//
// Screenshots of problem:
// http://gyazo.com/71e754c61f6aafcd501894d806e1a7f1 (from real wild)
// http://gyazo.com/775c9ec8cc81861ff40e62d7350be512 (this test program)
// Screenshot of good rendering:
// http://gyazo.com/c8ff96af7aa0006d5fb4343a73722ae1
//
// To reproduce, build it using
// g++ -Wall -fexceptions -g -I/usr/include/ncurses -c ./main.cpp -o ./main.o
// g++  -o ./ ./main.o   -lncurses
//
// And then run program in konsole terminal with width &lt;= 80 (width in main func)
// Press any key and you will see artifacts at the end of line
// If terminal&apos;s width &gt; 80 or character is not a whitespace, all renders OK.

int main()
{
    int x = 10;
    int width = 80;

    WINDOW* stdscr = initscr ();
    cbreak ();
    noecho ();
    nonl ();
    intrflush (stdscr, false);
    keypad (stdscr, true);
    start_color ();

    init_pair(1, 4, 4);
    init_pair(2, 7, 7);

    while (x &gt; 5) {
        attrset(COLOR_PAIR(2) | A_BOLD);
        mvaddstr(3, x, &quot;SomeText&quot;);
        for (int xx = x + 8; xx &lt; width; xx++) {
            attrset(COLOR_PAIR(1));
            // If change next character to any (not space - for example, &quot;_&quot; or &quot;X&quot;) all will work ok
            mvaddstr(3, xx, &quot; &quot;);
        }
        refresh();
        getch();
        x--;
    }
    endwin();
    return 0;
}


Reproducible: Always

Actual Results:  
Blue background line is rendered to X=80 coordinate, but at the end of line there are some incorrect symbols (white blocks).

Expected Results:  
Blue background line is rendered to X=80 coordinate.

This bug is reproduced in Konsole and Konsole-based (Yakuake) terminal emulators only. In xterm, gnome-terminal and putty this works without troubles.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1425985</commentid>
    <comment_count>1</comment_count>
    <who name="Igor Kostromin">elwood.su</who>
    <bug_when>2014-01-20 18:55:00 +0000</bug_when>
    <thetext>Also reproduced on Debian 7 (Konsole 2.8.4) http://gyazo.com/e7ad5b49a52803d4276f8fd0887feff5 - but black characters at the end of line instead of white. Color of parasite blocks depends on color scheme selected in Konsole&apos;s profile.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1429556</commentid>
    <comment_count>2</comment_count>
    <who name="Igor Kostromin">elwood.su</who>
    <bug_when>2014-02-08 20:59:26 +0000</bug_when>
    <thetext>After several days of investigation, I have found the source of a problem. If width &gt; 80, ncurses for this line generates sequence of control codes with text, this sequence rerenders it 100%. But when width &lt; 80, ncurses (optimized?) generates sequence of control codes without any text, but with &quot;DEL&quot; control code. Konsole deletes one character, and at end of line it filled with empty flags. XTerm and another terms handle it otherwise: they fill end of line using space with attributes which are set now (see ClearCells func at screen.c file in xterm sources - view https://gist.github.com/elw00d/8890166). If comment ClearCells call in ScrnDeleteChar func implementation, bug will be &quot;reproduced&quot; in xterm too.

Proposed patch:
https://gist.github.com/anonymous/8890021

I didn&apos;t code on C/C++ for several years, and I don&apos;t sure that creating anonymous Character object is good in this place, so fix my code, please, if it is buggy from memory consistency point of view.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1429601</commentid>
    <comment_count>3</comment_count>
    <who name="Kurt Hindenburg">khindenburg</who>
    <bug_when>2014-02-09 00:00:31 +0000</bug_when>
    <thetext>Thanks for the work and patch - it does appear to fix you test - let me look at it further.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1429677</commentid>
    <comment_count>4</comment_count>
    <who name="Kurt Hindenburg">khindenburg</who>
    <bug_when>2014-02-09 14:16:26 +0000</bug_when>
    <thetext>I think this will work

+    // Append space(s) with current attributes
+    Character spaceWithCurrentAttrs(&apos; &apos;, _effectiveForeground, _effectiveBackground,
+           _effectiveRendition, false);
+
+    for (int i = 0; i &lt; n; i++)
+      _screenLines[_cuY].append(spaceWithCurrentAttrs);</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1429686</commentid>
    <comment_count>5</comment_count>
    <who name="Igor Kostromin">elwood.su</who>
    <bug_when>2014-02-09 15:26:31 +0000</bug_when>
    <thetext>Yes, it works for me - for test program and for original mono application.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1429692</commentid>
    <comment_count>6</comment_count>
    <who name="Kurt Hindenburg">khindenburg</who>
    <bug_when>2014-02-09 16:03:48 +0000</bug_when>
    <thetext>Git commit 427de88cc1020c7fb9fb2b8752fddfd4cc0be736 by Kurt Hindenburg.
Committed on 09/02/2014 at 16:02.
Pushed by hindenburg into branch &apos;master&apos;.

Fix wrong rendering at the end of line when drawing colored whitespaces

Previous code just deleted the end characters; new code puts in spaces
with current attributes at the end of the line.

Thanks to Igor Kostromin elwood.su@gmail.com for bug, research + patch

See bko for test code + more info
FIXED-IN: 2.13

M  +8    -0    src/Screen.cpp

http://commits.kde.org/konsole/427de88cc1020c7fb9fb2b8752fddfd4cc0be736</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1429697</commentid>
    <comment_count>7</comment_count>
    <who name="Igor Kostromin">elwood.su</who>
    <bug_when>2014-02-09 16:36:17 +0000</bug_when>
    <thetext>Thanks !</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1429905</commentid>
    <comment_count>8</comment_count>
    <who name="Kurt Hindenburg">khindenburg</who>
    <bug_when>2014-02-10 14:29:33 +0000</bug_when>
    <thetext>Git commit 3d9c101877290f8d4fffc83b364d7bad6e4c9653 by Kurt Hindenburg.
Committed on 09/02/2014 at 16:02.
Pushed by hindenburg into branch &apos;frameworks&apos;.

Fix wrong rendering at the end of line when drawing colored whitespaces

Previous code just deleted the end characters; new code puts in spaces
with current attributes at the end of the line.

Thanks to Igor Kostromin elwood.su@gmail.com for bug, research + patch

See bko for test code + more info
FIXED-IN: 2.13

(cherry picked from commit 427de88cc1020c7fb9fb2b8752fddfd4cc0be736)

M  +8    -0    src/Screen.cpp

http://commits.kde.org/konsole/3d9c101877290f8d4fffc83b364d7bad6e4c9653</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1432657</commentid>
    <comment_count>9</comment_count>
    <who name="Kurt Hindenburg">khindenburg</who>
    <bug_when>2014-02-26 04:27:24 +0000</bug_when>
    <thetext>Git commit c7b9435d65c4c1324eadc71e66bae2ca78e6dd7a by Kurt Hindenburg.
Committed on 09/02/2014 at 16:02.
Pushed by hindenburg into branch &apos;KDE/4.12&apos;.

Fix wrong rendering at the end of line when drawing colored whitespaces

Previous code just deleted the end characters; new code puts in spaces
with current attributes at the end of the line.

Thanks to Igor Kostromin elwood.su@gmail.com for bug, research + patch

See bko for test code + more info
FIXED-IN: 2.13

(cherry picked from commit 427de88cc1020c7fb9fb2b8752fddfd4cc0be736)

M  +8    -0    src/Screen.cpp

http://commits.kde.org/konsole/c7b9435d65c4c1324eadc71e66bae2ca78e6dd7a</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>