Bug 378642 - Last line of output gets deleted
Summary: Last line of output gets deleted
Status: RESOLVED UPSTREAM
Alias: None
Product: konsole
Classification: Applications
Component: general (show other bugs)
Version: 16.12.3
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-11 01:16 UTC by kdebugs
Modified: 2017-04-11 13:45 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kdebugs 2017-04-11 01:16:25 UTC
Resurrecting Bug 192221.  (Also reported over 8 years ago in Bug 183303.)  Not sure whose idea it is to go silently marking bugs in current products as "RESOLVED UNMAINTAINED" without checking to see whether the bug still exists in the current version.  It does.  Feel free to nix this report, IF the other one is reopened.

Observed in Konsole version 16.12.3 on 64-bit Arch Linux.  Reproducible via any of the methods from Bug 192221 Comment 8, namely:
---------------
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 1 Egmont Koblinger 2017-04-11 07:33:22 UTC
This is not konsole's fault. In fact, all the terminal emulators behave the same way.

The app running inside (e.g. the bash shell) is notified about the window size change, and in turn decides to repaint part of the screen, wiping out the "foobar" string.

konsole simply obeys the instructions it receives, that's what it should do.

It could probably consider not to resize the window on "Find", though.

This is a much higher level design problem. You could try to accept that the overall design sucks, and get used to pressing an Enter as soon as a command completes without a trailing newline (that is, the prompt is not at the left margin), or get used to the content being stripped off otherwise.

Alternatively, there's a hack to start a newline if the command didn't end with one. At the beginning of your PS1 prompt (or PROMPT_COMMAND) emit (columns-1) spaces, then a carriage return and maybe also a \eK to clear to the end of the line.
Comment 2 Egmont Koblinger 2017-04-11 07:41:02 UTC
Probably you didn't see this bug for a while, but you are seeing it again. This is not due to a change in konsole, but rather a change in bash/readline. Bash up to 4.2, and 4.4 repaints the prompt immediately upon a window resize. 4.3 was odd and delayed repainting until the next keypress or similar event.
Comment 3 kdebugs 2017-04-11 13:45:24 UTC
Okay - thanks!  Surprised none of us all that time caught on like you did.

FWIW, Konsole is more prone to terminal size changes than some other emulators, e.g. MATE's or Xfce's, in that when you open a tab on a window that can be grown, the window grows to accommodate the tab bar without resizing the terminal, and also because the search box pops up as separate window rather than encroaching into the terminal.  (I'm NOT complaining about Konsole's behavior here - I rather prefer it - I'm just pointing it out.)

Marking this as upstream.  Bash obliterates the last line on any size changes; mksh only obliterates the last line on horizontal resize.