Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

restore behaviour of /usr/bin/clear command #477

Closed

Conversation

Dieken
Copy link
Contributor

@Dieken Dieken commented Jan 9, 2021

clear is meant to clear screen, not clear display which clear scrollback buffer too.

And unfortunately fish shell binds Ctrl-L to clear command, so Ctrl-L always clear
scrollback buffer if emacs-vterm.fish is sourced, this is very surprising.

Further more, both original clear command and Ctrl-L don't clear scrollback buffer
in iTerm2 and Terminal.app.

References:

  1. man clear shows "clear the terminal screen".

  2. In bash, bind -p | grep C-l shows:

    "\e\C-l": clear-display
    "\C-l": clear-screen
  1. In zsh, bindkey | fgrep '^L' shows:
    "^L" clear-screen
    "^[^L" clear-screen
  1. In fish, bind -a | fgrep '\cl' shows:
    bind --preset \cl echo\ -n\ \(clear\ \|\ string\ replace\ \\e\\\[3J\ \"\"\)\;\ commandline\ -f\ repaint

@jixiuf

`clear` is meant to clear screen, not clear display which clear scrollback buffer too.

And unfortunately fish shell binds `Ctrl-L` to `clear` command, so `Ctrl-L` always clear
scrollback buffer if `emacs-vterm.fish` is sourced, this is very surprising.

Further more, both original `clear` command and `Ctrl-L` don't clear scrollback buffer
in iTerm2 and Terminal.app.

References:

1. `man clear` shows "clear the terminal screen".

2. In bash, `bind -p | grep C-l` shows:
```
    "\e\C-l": clear-display
    "\C-l": clear-screen
```

3. In zsh, `bindkey | fgrep '^L'` shows:
```
    "^L" clear-screen
    "^[^L" clear-screen
```

4. In fish, `bind -a | fgrep '\cl'` shows:
```
    bind --preset \cl echo\ -n\ \(clear\ \|\ string\ replace\ \\e\\\[3J\ \"\"\)\;\ commandline\ -f\ repaint
```
@Dieken Dieken closed this Jan 9, 2021
@Dieken
Copy link
Contributor Author

Dieken commented Jan 9, 2021

The behaviour of "clear" varies across different OS and terminfo database.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant