hyper: Cannot clear terminal with Command+K since latest version (1.3.2.1744)
- I am on the latest Hyper.app version
- I have searched the issues of this repo and believe that this is not a duplicate
- OS version and name: macOS Sierra Version 10.12.2
- Hyper.app version: Version 1.3.2 (1.3.2.1744)
- Link of a Gist with the contents of your .hyper.js: Link
- Relevant information from devtools No errors in console.
- The issue is reproducible in vanilla Hyper.app: The only plugin I have is a theme.
Issue
Ever since the latest update, it seems I can’t clear the terminal with <kbd>command</kbd>+<kbd>K</kbd>. This issue only happens when I have done npm start to start webpack for one of my apps. Currently, whenever I press <kbd>command</kbd>+<kbd>K</kbd>, it makes ^L appear at the bottom of the terminal.
Here is a screenshot of the issue: (You can see the ^L come everytime I try to clear at the bottom):

EDIT: Just to provide some more info, if I exit out of the process with <kbd>control</kbd>+<kbd>C</kbd>, and then run the clear with <kbd>command</kbd>+<kbd>K</kbd> it works fine.
About this issue
- Original URL
- State: open
- Created 7 years ago
- Reactions: 34
- Comments: 33 (9 by maintainers)
You can use CTRL-SHIFT-K to clear. The weird bug still exists but if you use that, then you can clear the screen. However, its weird, because if you clear the screen with ctrl shift k, and then run the clear command, that your past commands will pop up again in the terminal. You can get rid of them by running other random commands and 'ctrl-shift-k’ing a bunch of times.
try
reset.@hiseni you know, that pull-requests are welcomed, right?
Nice, using <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>K</kbd> works for now as a workaround to clear the screen. Thanks for the tip on that.
Same issue when running
tail -f. Also, since the update CMD+K does not completely clear the buffer. I know this behavior is expected, but sometimes it is useful to actually clear the terminal completely (for example long running tails of logs, or running acatof a huge file). Maybe this behavior should be a configuration.@albinekb this seems to work great 👍 https://github.com/Microsoft/vscode/blob/a443a44f40a6ab6595101f418e5fac91b5c93d10/src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts#L569-L577
Hyper v2 is out now, and it looks like this is no longer an issue 😃
Think it’s safe for me to close this, anyone can let me know if they still seem to have the issue after upgrading to v2 and I’ll reopen.
This is the issue I brought up in the stream - you cannot rely on sending escape sequences for this sort of thing as different shells have different default escape sequence behavior, can be customized or may not do anything (probably the case on Windows). This is the same reason XON/XOFF will not work for the general case.
I recommend going back to the previous behavior (I’m assuming it cleared fine, it just didn’t work for multi-line prompts).
Experiencing this as well, in addition to the behavior changing: previously, cmd-k would actually clear the contents (this is I believe the intended behavior), but it now just clears the screen while preserving scrollback. Is that an intended feature change or a regression? How do I actually clear my scrollback?
Same issue when running any command that would require a redraw on the last available line, it just goes up and up and up instead of clearing the previous line.
Nice! Let’s do the same in Hyper. I have a lot going on at work so won’t have time for a couple weeks, PR welcome 🙏
@albinekb previously you sent
^Lwhen ctrl+k was pressed. You’re welcome to do this, I would recommend not doing it under all environments though you did in v1 as you’ll run into why this issue was created in the first place: https://github.com/zeit/hyper/issues/1808#issuecomment-302764540This is not something that makes sense in the xterm.js layer as xterm.js knows nothing about what shell is running.
@timgthomas this is as designed currently. It’s a very tricky problem to solve this generically in a way that would work in all shells/platforms.
I am seeing the same result as @TooTallNate. Might be an issue with users with the name Nate 😃
This looks to be fixed for me now. I’m on 1.4.3 (stable), macOS 10.12.6.
Linux (Mint 18.1) also affected. Before, CTRL+K cleared the window + buffer/history. Now, CTRL+K is same as CTRL+L.
@jesseditson You can test my PR and it will work!