Bug 365893

Summary: Clear scrollback and reset leaves the terminal screen completely blank.
Product: [Applications] konsole Reporter: 3ndymion <3ndymion>
Component: generalAssignee: Konsole Developer <konsole-devel>
Status: RESOLVED WAITINGFORINFO    
Severity: normal CC: a.samirh78, egmont, jaak, rdieter
Priority: NOR    
Version: 16.04.3   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description 3ndymion 2016-07-20 11:54:33 UTC
In the Konsole terminal emulator, whenever you do "clear scrollback and reset", either through the menu option or by pressing Control Shift K, the screen will remain completely blank.  The prompt is not there.  It will reappear whenever you press another key.

Reproducible: Always

Steps to Reproduce:
1. Go to "View".
2. Choose "Clear Scrollback and Reset".
3. Or press Control+Shift+K

Actual Results:  
Screen remains completely blank.

Expected Results:  
The username prompt should be showing.

Running Fedora 24 KDE.
Comment 1 Egmont Koblinger 2016-09-19 21:27:18 UTC
Works as intended.

There's no way the app running inside the terminal could possibly know that the terminal's contents have been tampered with by some other means, not initiated by the app (that is, the shell in this case).

Workarounds (such as injecting a Ctrl-L or Enter keypress) are bound to cause much more severe problems in other situations.

If this really bothers you, you can execute the "clear" command instead, or manually press Enter or Ctrl-L after clearing the screen.
Comment 2 3ndymion 2016-10-07 04:14:47 UTC
(In reply to Egmont Koblinger from comment #1)
> Works as intended.
> 
> There's no way the app running inside the terminal could possibly know that
> the terminal's contents have been tampered with by some other means, not
> initiated by the app (that is, the shell in this case).
> 
> Workarounds (such as injecting a Ctrl-L or Enter keypress) are bound to
> cause much more severe problems in other situations.
> 
> If this really bothers you, you can execute the "clear" command instead, or
> manually press Enter or Ctrl-L after clearing the screen.

Hi, & thanks for responding.  I don't quite understand what  you mean by "app running inside the terminal".  It is the Konsole terminal that I was referring to.  This problem did not occur in KDE4.  Now in KDE5, it exists.

I don't know how it was done before (in terms of programming), but the screen definitely should not remain complete blank without the prompt after clearing it.  It should at least give you the prompt back.  Other systems do not have this problem.  It may seem right to you as a developer, but to anybody & everybody else who actually uses the system, it is definitely broken.  There are many other bug reports about this exact issue that have gone unresolved, or have been closed, saying that the problem must be dealt with at the source, which is here.

Leaving the screen with no prompt definitely gives the user the impression that the OS is broken & full of bugs.  It's basically breaking something that was not broken, & then calling it fixed.  The developers working on KDE (perhaps yourself included) are working very hard to create an awesome system for everyone to use.  But when something like this happens, it's like punching them in the face.  What is all the hard work for when new, avoidable problems are created & refused to be fixed???

The "clear" command only moves the existing text up past the top of the screen.  It is not the same as what this option does.  As a user, I don't know how it should work behind the scenes in the code, but all I know is that it did indeed work correctly in the past, & now it does not.  There are many ignored bug reports that attest to this fact.

I kindly & humbly ask you or any KDE developer that sees this to please resolve this issue.  I don't know how it should or should not be done in the code, but the screen should definitely return the user prompt when the screen is cleared.  I'm not even asking for myself, as I currently do not use KDE, although I might try it again for Fedora 25.  No, instead, I'm asking on behalf of all of the people who do use KDE, whether it be on Fedora, Suse, or whatever.

KDE5 is really shaping up nicely from the way it started out.  It would be a terrible shame to keep such a blemish like this on what is intended to be a beautiful & problem-free system.  Please do consider it.  Thank you for looking.
Comment 3 Egmont Koblinger 2016-10-07 06:22:20 UTC
> I don't quite understand what you mean by "app running inside the terminal".

In this case I'm afraid you lack the very basic knowledge about what happens when you open a terminal emulator. There are at least two applications that start and co-operate, one is the terminal emulator itself, and the other one is the shell running inside (there could easily be more applications nested running inside). The shell is the command line interpreter which instructs the terminal emulator to display the prompt, and the terminal emulator obeys this instruction and does display the prompt.

Then you ask the terminal emulator to clear its contents, and again, it obeys your instruction, and clears the screen. So everything's fine.

There is no way the terminal emulator could potentially know which parts of the screen to retain, and there is no way the terminal emulator could notify the app running inside (e.g. your shell) that it cleared the screen.

Also, there could be other apps running inside, maybe a text editor (e.g. vim), a file manager (e.g. mc), a non-interactive tool (e.g. gcc), or a whole lot more. What should the clear action do then?

The only sane way I can see to "fix" this issue would be to remove this menu entry, I really don't think it's needed. For the time being, you could just personally not use it.

> This problem did not occur in KDE4. [...] I currently do not use KDE

I don't use KDE either, I'm a developer of another terminal emulator (that does the same on clear) lurking around in other forums. I have absolutely no clue what KDE4 did and I won't install that to find it out.

> Leaving the screen with no prompt definitely gives the user the impression that the OS is broken & full of bugs.

In my opinion, complaining about this gives the impression that you don't understand how the world of terminal emulation works. Unlike browsers, popular homepages, mobile phone UIs etc. where it's pretty much expected that you should be able to use them without prior knowledge, terminal emulators are mostly for power users and developers. I think it's a reasonable expectation that you first try to understand how and why it behaves, before coming up with expectations.
Comment 4 Ahmad Samir 2018-02-17 17:53:44 UTC
I can't reproduce this issue with konosle 15.04.70 nor with a recent snapshot of the master branch; if you can still reproduce this issue feel free to reopen the report.
Comment 5 Ahmad Samir 2018-02-17 17:54:05 UTC
FTR, for a long time Konsole has had a (hackish) way to redraw the prompt after using e.g. `reset` or the menu item "Clear scrollback and reset". Have a look at:
https://bugs.kde.org/show_bug.cgi?id=149562#c1

and the relevant commit:
https://cgit.kde.org/konsole.git/commit/?id=d346a2ccad3950dad5ec137edce27e2930d536d6

and a follow up to that code to make it work with e.g. zsh:
https://cgit.kde.org/konsole.git/commit/?id=ccfc3f859c5695cc08895570efd0831db0d3b9b0
Comment 6 3ndymion 2018-02-19 16:40:12 UTC
(In reply to Ahmad Samir from comment #5)
> FTR, for a long time Konsole has had a (hackish) way to redraw the prompt
> after using e.g. `reset` or the menu item "Clear scrollback and reset". Have
> a look at:
> https://bugs.kde.org/show_bug.cgi?id=149562#c1
> 
> and the relevant commit:
> https://cgit.kde.org/konsole.git/commit/
> ?id=d346a2ccad3950dad5ec137edce27e2930d536d6
> 
> and a follow up to that code to make it work with e.g. zsh:
> https://cgit.kde.org/konsole.git/commit/
> ?id=ccfc3f859c5695cc08895570efd0831db0d3b9b0

Hi!!!  Thanks for the good info.  That's very interesting to see.  It's good to know that it has stayed fixed for quite some time now.  I'm currently using an outdated Fedora 25 KDE with Konsole 16.12.3, & even that one is working fine.  The prompt returns to the screen as it should.  Although it is a hackish way of doing it, it works, & I am happy.  Thanks again!!!  : )