Bug 405612 - ctrl+L or ctrl+shift+k does not clear /usr/bin/screen correctly
Summary: ctrl+L or ctrl+shift+k does not clear /usr/bin/screen correctly
Status: CONFIRMED
Alias: None
Product: konsole
Classification: Applications
Component: emulation (show other bugs)
Version: 18.12.3
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on: 391075
Blocks:
  Show dependency treegraph
 
Reported: 2019-03-18 20:44 UTC by Luiz Angelo De Luca
Modified: 2021-03-10 19:12 UTC (History)
3 users (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 Luiz Angelo De Luca 2019-03-18 20:44:36 UTC
In Konsole, if I do "ctrl+L", konsole adds to scrollback the current screen before it clears. You can see this pressing ctrl+L multiple times and watch the scroll grows. The same does not happen with "xterm".

ctrl+shift+k is also problematic. It does cleans the scrollback but fails to clean the current screen (while Ctrl+L does work). Even failing to clean the current screen, it did add the current screen to its "scrollback" as "ctrl+L" would. Something like this happens:

1) clears scrollback
2) tries clears current screen
2.1) adds current screen to scrollback
2.2) fails to clean the screen (while ctrl+L can)

I'm using OpenSUSE Tumbleweed. TERM is xterm-256color in normal konsole and screen.xterm-256color inside screen
Comment 1 Luiz Angelo De Luca 2019-03-18 20:47:14 UTC
BTW, CTRL+L followed by a "menu/view/Clear Scrollback" does exactly what I would like ctrl+shift+k to do.
Comment 2 Egmont Koblinger 2019-03-19 09:26:22 UTC
Related to (duplicate of?) bug 384218.
Comment 3 Mariusz Glebocki 2019-03-22 07:30:31 UTC
Ctrl+L/`clear`: described/reported in a bug from Egmont's post, so I'll remove it from the title, as the second part is more unique. I'll try to look at it this weekend, as it annoys me too.

Ctrl+Shift+K:
`screen` is kind of terminal emulator inside terminal emulator (Konsole in this case). Ctrl+Shift+K clears internal Konsole buffers and display buffer #1. `screen`, like e.g vim or nano, works on dedicated display buffer #2, where clearing buffers would be pointless, as "full-screen" applications assume the characters they put on display will be there until they change them. Even if it would be cleared, `screen` redraws everything exactly as it was in nearest opportunity (like screen change).

The way to make it work is to detect the `screen` is running (easy, already done to display program name in tab title) and send clearing escape sequences to it. There could be configurable list of programs which can receive clearing sequences on display buffer #2 (with e.g. screen, tmux by default) somewhere is settings.
Comment 4 Egmont Koblinger 2019-03-22 07:56:01 UTC
> detect the `screen` is running

Sounds hackish to me, IMO the terminal's behavior shouldn't depend on the app running inside.

> and send clearing escape sequences to it

How would you do it (keeping in mind that its keybindings are configurable)? Maybe allow to configure in konsole the keycombo to send for each particular app?

If you really wish to go this direction, maybe you could make it independent from clearing the screen, and instead allow to specify arbitrary remapping based on the running application (and perhaps other circumstances too)?

E.g. if vim is running then Shift+Ctrl+W, instead of closing the tab, could emit `:qEnter`, or sure you can come up with other ideas along these lines.
Comment 5 Mariusz Glebocki 2019-03-24 20:16:01 UTC
(In reply to Egmont Koblinger from comment #4)
> > detect the `screen` is running
> 
> Sounds hackish to me, IMO the terminal's behavior shouldn't depend on the
> app running inside.

I'm not a big fan either, but there is ssh detection/integration - hence the idea.

> > and send clearing escape sequences to it
> 
> How would you do it (keeping in mind that its keybindings are configurable)?
> Maybe allow to configure in konsole the keycombo to send for each particular
> app?

Sorry, my mistake - I just realized the escape sequence would need to be send to screen-controlled pty, not konsole's. This would be pretty big hack.

> If you really wish to go this direction, maybe you could make it independent
> from clearing the screen, and instead allow to specify arbitrary remapping
> based on the running application (and perhaps other circumstances too)?
> 
> E.g. if vim is running then Shift+Ctrl+W, instead of closing the tab, could
> emit `:qEnter`, or sure you can come up with other ideas along these lines.

This could be done with some shortcut managers (e.g. KDE's Custom Shortcuts) - the only problem is to detect program inside terminal in other way than setting its name as a part of a window title.



The first question is a duplicate, the second one not a bug/not fixable. Am I missing something?
Comment 6 Christian Herenz 2019-11-07 22:49:06 UTC
I think this is not a bug, Konsole is in some parts decidedly different than XTerm.