Bug 192221 - Last line gets deleted in output after resizing window, sometimes
Summary: Last line gets deleted in output after resizing window, sometimes
Status: RESOLVED UNMAINTAINED
Alias: None
Product: konsole
Classification: Applications
Component: general (show other bugs)
Version: 2.2.3
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
: 183303 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-05-10 13:07 UTC by Daniel
Modified: 2017-02-13 03:04 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.8
Sentry Crash Report:


Attachments
do not erase the bottem line when resizing (866 bytes, patch)
2011-07-28 14:10 UTC, Jekyll Wu
Details
worksforme screencast (812.26 KB, application/x-xz)
2014-03-29 16:00 UTC, Bartosz Brachaczek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel 2009-05-10 13:07:33 UTC
Version:           2.2.3 (using Devel)
OS:                Linux
Installed from:    Compiled sources

Okay this is a tricky one (and the Short description isn't too descriptive), quite a few options must play together, but it can be reproduced easily in real life:

1. Start Konsole, and configure it like this: Edit Current Profile -> Tabs -> Tab bar display (Show Tab Bar When Needed)
2. Type a lot of <Enter>s in the terminal so the prompt will be at the last line at the bottom.
3. Exec `echo -n "last line test"; read`
4. Open a new tab (so there will be 2 tabs); the Tab Bar must appear.
5. Switch to the newly opened tab (if it isn't already  active), and close it, either by pressing the Close button, typing exit, pressing Ctrl+D or whatever.
6. Now we're back at the original tab, the Tab Bar got hidden, and the last line ("last line test") got erased.

The second (2.) step is important or else it can't get reproduced. It is also crucial, that it would be the next to last tab, that you close, thus there are no other tabs opened at the end but the one in which you started the `echo ....` command.
This test case might seem weird, but this can happen so easy and many times if one runs scripts or applications which fills the whole window with output (thus the prompt or cursor will be at the last line in Konsole) and then waits for some input. Then you close a tab which was opened before and you're there with an empty line wondering what was the output or question of the script which is waiting for input.


Here is another way to reproduce it:

1. Start Konsole, and configure it like this: Edit Current Profile -> Tabs -> Tab bar display (Always Show Tab Bar)
2. Type a lot of <Enter>s in the terminal so the prompt will be at the last line at the bottom.
3. Exec `echo -n "last line test"; read`
4. Get back to Edit Current Profile -> Tabs
5. Change "Tab bar display" to "Always Hide Tab Bar"
6. The last line ("last line test") got erased.
Comment 1 Daniel 2009-05-18 21:32:20 UTC
Here is a new and even simpler way to reproduce this:

1. Start Konsole
2. Type a lot of <Enter>s in the terminal so the prompt will be at the last
line at the bottom.
3. Exec `echo -n "last line test"; read`
4. Maximize the Konsole window.
5. The last line ("last line test") got erased. <- the bug
Comment 2 Bartosz Brachaczek 2010-08-16 13:19:49 UTC
Looks like a duplicate of Bug #183303, which describes yet another way to reproduce it.
Comment 3 Kurt Hindenburg 2011-03-19 17:14:43 UTC
*** Bug 183303 has been marked as a duplicate of this bug. ***
Comment 4 Martin Walch 2011-05-16 12:08:46 UTC
*** This bug has been confirmed by popular vote. ***
Comment 5 Jekyll Wu 2011-07-28 14:10:11 UTC
Created attachment 62275 [details]
do not erase the bottem line when resizing

This one liner patch will eliminate the problem.

However,  I am not sure that patch is really correct and would not cause other problems, because I do not quite understand why the Screen class always allocate spaces for N+1 lines when it is set to has N lines.
Comment 6 Daniel 2011-07-28 14:14:07 UTC
Wow, a more than 2 years old bug. And it's not the only one :D
KDE has gotten ridiculous a long time ago...
Comment 7 Jekyll Wu 2011-09-21 17:36:06 UTC
Git commit ca3ef60d6da099f46969eaebcdbfaf3b20761505 by Jekyll Wu.
Committed on 21/09/2011 at 19:35.
Pushed by jekyllwu into branch 'master'.

Fix the problem of possibly losing the last line after resizing window.

This is a simple one-line patch, so it can be reverted easily if
unfortunately needed.

BUG:192221
FIXED-IN:4.8
REVIEW:102177

M  +1    -1    src/Screen.cpp

http://commits.kde.org/konsole/ca3ef60d6da099f46969eaebcdbfaf3b20761505
Comment 8 kdebugs 2013-09-21 03:06:41 UTC
I'm using version 2.10.5 (KDE 4.10.5) on Kubuntu 13.04, and this problem persists.  To reproduce, simply run "echo -n foobar", then do any of the following:
- Resize the window to a different number of columns/lines.
- Maximize or restore the window.
- Press Ctrl+Shift+F, or select the "Find" function from the menus.
Your "foobar" will be obliterated.
Comment 9 kdebugs 2014-03-29 09:59:56 UTC
Still a problem in 2.11.3 (KDE 4.11.5) on Kubuntu 13.10.  See comment 8.  This isn't fixed!
Comment 10 Bartosz Brachaczek 2014-03-29 11:25:23 UTC
(In reply to comment #9)
> Still a problem in 2.11.3 (KDE 4.11.5) on Kubuntu 13.10.  See comment 8. 
> This isn't fixed!

Well, I cannot reproduce it in 4.12.3. At least not the way you described. I suggest trying Kubuntu 14.04 LiveCD (may be in a vm), checking it there and filing a new bug report if it's still a problem there.
Comment 11 Martin Walch 2014-03-29 13:45:14 UTC
I can reproduce it in Konsole 2.12.3 (KDE 4.12.3) with bash 4.2.45(1) as described. The -n switch of echo is important to suppress the trailing newline.

Maybe it helps when I describe it in more detail:
- run Konsole with bash in it
- the exact prompt does not seem to matter, but lets set it to a constant string:

PS1="P: "

- now execute the echo command

echo -n foobar

The last two lines of the Konsole window (not necessarily at the bottom of the window) should look like this:

P: echo -n foobar
foobarP: 

As you can see, the prompt is printed immediately after foobar. When now resizing the window in a way that adds a line to the running bash, the last line is deleted and the prompt is reprinted. Now the two lines from above have changed to:

P: echo -n foobar
P:
Comment 12 Kurt Hindenburg 2014-03-29 14:49:38 UTC
Yes, still there - follow comment #11 instructions.
Comment 13 Bartosz Brachaczek 2014-03-29 16:00:12 UTC
Created attachment 85826 [details]
worksforme screencast

I still cannot reproduce it. I am attaching a screencast. What am I doing wrong?
Comment 14 Bartosz Brachaczek 2014-03-29 16:08:04 UTC
Ah, I got it. In my case I need to start typing after the resize, only then the prompt is reprinted and "foobar" disappears. So, yeah, I can confirm the bug.
Comment 15 Egmont Koblinger 2014-09-13 14:49:44 UTC
I can see this bug with the (konsole-based) cool-retro-term [https://github.com/Swordfish90/cool-retro-term].  Press Enter multiple times until you reach the bottom, then resize horizontally.  The prompt disappears in the last line, only the cursor remains.

This could be a cool-retro-term bug, but the coincidence with this one makes it suspicious that it's actually the same bug.