Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #239581

Re: Get Terminal to Echo line in buffer on backspace

From Thomas Anderson <thomas.anderson@little-beak.com>
Newsgroups linux.debian.user
Subject Re: Get Terminal to Echo line in buffer on backspace
Date 2021-09-02 05:50 +0200
Message-ID <CSLTH-1Ku-1@gated-at.bofh.it> (permalink)
References <CROJX-5U5-1@gated-at.bofh.it> <CROTE-5XB-7@gated-at.bofh.it> <CRR58-7qq-3@gated-at.bofh.it> <CRRya-7A1-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Thanks for the insightful replies.

I think I am getting closer to a solution.

Wouldn't it be possible to bind the "redraw-current-line" to the delete 
(ASCII DEL), i.e. Alt 127??

And, just add that to my user's bash file?

I am thinking out loud, not sure this would work.

Also, yes. Zsh, I will look into use that.

On 8/30/21 5:39 PM, Greg Wooledge wrote:
> On Mon, Aug 30, 2021 at 05:05:49PM +0200, Nicolas George wrote:
>> With Zsh, there is the "redisplay" zle command, it does exactly that:
>> redraw the prompt and command without clearing the screen.
>>
>> I do not know if readline, used by bash, has the same feature available.
> Interesting.  I've never looked into this stuff before.
>
> There is a "redraw-current-line" action in readline, but bash doesn't
> bind any keys to it by default, neither in emacs nor vi mode.
>
> But before I could even test that, I came across this section in the
> man page:
>
>         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.
>
> That bit about "With an argument" is totally new information for me.
> I'm a vi mode user, so I tried it as indicated: I typed some random
> stuff, and then I pressed ESC 0 Ctrl-L.  It didn't work (it cleared the
> whole screen).  So maybe an argument of 0 doesn't count... oh, right.
> That's because 0 is a movement command ("jump to first column").  Next I
> tried with a non-zero argument: ESC 1 Ctrl-L.  That worked.  It redrew
> the current prompt and command line, without clearing the screen.
>
> I also tested in emacs mode, but I'm not as proficient there.  Again,
> ESC 1 Ctrl-L seems to work.  And so does Alt-1 Ctrl-L, in my terminal
> (but Alt-1 may not work in all terminals, so be warned).
>
> For extra fun: Alt-0 Ctrl-L also works in emacs mode.  Apparently emacs
> can handle an argument of 0, because 0 isn't a movement command in
> emacs the way it is in vi.
>
> So, there's that.  And that will do what the OP wants, albeit not
> "automatically" the way they seemed to want.  They actually have to
> press the keys.
>
> I'll let others play around with binding redraw-current-line to some
> unused key combo.  I'm betting it does the same thing, once bound.
>

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Get Terminal to Echo line in buffer on backspace Thomas Anderson <thomas.anderson@little-beak.com> - 2021-08-30 14:40 +0200
  Re: Get Terminal to Echo line in buffer on backspace Nicolas George <george@nsup.org> - 2021-08-30 14:50 +0200
  Re: Get Terminal to Echo line in buffer on backspace Greg Wooledge <greg@wooledge.org> - 2021-08-30 14:50 +0200
    Re: Get Terminal to Echo line in buffer on backspace Thomas Anderson <thomas.anderson@little-beak.com> - 2021-08-30 15:00 +0200
      Re: Get Terminal to Echo line in buffer on backspace Greg Wooledge <greg@wooledge.org> - 2021-08-30 15:20 +0200
        Re: Get Terminal to Echo line in buffer on backspace songbird <songbird@anthive.com> - 2021-08-31 04:00 +0200
      Re: Get Terminal to Echo line in buffer on backspace Nicolas George <george@nsup.org> - 2021-08-30 17:10 +0200
    Re: Get Terminal to Echo line in buffer on backspace Nicolas George <george@nsup.org> - 2021-08-30 17:10 +0200
      Re: Get Terminal to Echo line in buffer on backspace Greg Wooledge <greg@wooledge.org> - 2021-08-30 17:40 +0200
        Re: Get Terminal to Echo line in buffer on backspace David Wright <deblis@lionunicorn.co.uk> - 2021-08-31 16:10 +0200
          Re: Get Terminal to Echo line in buffer on backspace Nicolas George <george@nsup.org> - 2021-08-31 16:20 +0200
            Re: Get Terminal to Echo line in buffer on backspace David Wright <deblis@lionunicorn.co.uk> - 2021-08-31 16:50 +0200
          Re: Get Terminal to Echo line in buffer on backspace Greg Wooledge <greg@wooledge.org> - 2021-08-31 16:50 +0200
            Re: Get Terminal to Echo line in buffer on backspace David Wright <deblis@lionunicorn.co.uk> - 2021-09-01 16:10 +0200
        Re: Get Terminal to Echo line in buffer on backspace Thomas Anderson <thomas.anderson@little-beak.com> - 2021-09-02 05:50 +0200
          Re: Get Terminal to Echo line in buffer on backspace Greg Wooledge <greg@wooledge.org> - 2021-09-02 15:40 +0200

csiph-web