Skip to content

reset_clear doesn't show new prompt #703

Closed

Description

@IvoryJam

Describe the bug
reset_clear doesn't show new prompt, left with an empty terminal window until you press enter or hit ctrl+l

To Reproduce
Steps to reproduce the behavior:

  1. Run command to reset and clear terminal (default is ctrl+shift+g)

Expected behavior
Clears the terminal and resets the scroll back while leaving prompt

Desktop:

  • OS or Linux Distribution: Fedora
  • Version 37
  • Display Technology: Wayland
  • Terminator: 2.1.2

Additional context
If it helps, konsole does what I would expect it to, clears the screen and resets scroll back, but it leaves the prompt at the top of the terminal window

Activity

  1. mattrose commented on Jan 22, 2023

    @mattrose
    Member

    This is the way it works with all of the vte-based terminal emulators.

  2. FernandoBasso commented on Jan 22, 2023

    @FernandoBasso
    Contributor

    @IvoryJam On my setup, I bound reset_clear to Ctrl+Shift+k (on br-abnt2 keyboard layout, it is easier to type than Ctrl+Shift+g). Then I follow with Ctrl-l.

    Note that Ctrl-l is NOT a Terminator's feature, but a shell thing.

    Bash is my default shell, so, for me, Ctrl-l is a readline feature. Other shells generally implement something similar. I found this while perusing man bash:

    clear-display (M-C-l)
        Clear the screen and, if  possible,  the  terminal's  scrollback
        buffer,  then  redraw the current line, leaving the current line
        at the top of the screen.
    clear-screen (C-l)
        Clear the screen, then redraw the current line, leaving the cur‐
        rent  line  at the top of the screen.  With an argument, refresh
        the current line without clearing the screen.
    

    So, instead of doing Ctrl+Shift+k followed by Ctrl-l, I can simply do Ctrl-Alt-l. Note that this shortcut may be already taken by your window manager or desktop environment, which was the case for me: it was used by xflock4 to lock the screen.

    It is possible to add a bash shortcut though:

    $ bind -x '"\C-l": clear
    

    Or to remap readline we can add something like this to ~/.inputrc:

    ##
    # Clear scrollback and redraw current line.
    #
    "\C-l": clear-display
    

    I have always been a little put of with “+” vs ”-” syntax to describe shortcuts. It seems Gtk stuff prefers the “+”, while shell-related documentation and configuration seems to prefer ”-”, including vim and emacs. The latter family of tools describe things like C-l rather than C+l or Ctrl+l.

    Anyway, this is out of the scope of Terminator itself, but at least related and I learned some stuff researching on this today 🙂.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions