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

Path csiph.com!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!bofh.it!news.nic.it!robomod
From Thomas Anderson <thomas.anderson@little-beak.com>
Newsgroups linux.debian.user
Subject Re: Get Terminal to Echo line in buffer on backspace
Date Thu, 02 Sep 2021 05:50:01 +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>
X-Original-To debian-user@lists.debian.org
X-Mailbox-Line From debian-user-request@lists.debian.org Thu Sep 2 03:44:48 2021
Old-Return-Path <thomas.anderson@little-beak.com>
X-Amavis-Spam-Status No, score=-7.305 tagged_above=-10000 required=5.3 tests=[BAYES_00=-2, DKIM_ADSP_ALL=0.8, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, LDO_WHITELIST=-5, NICE_REPLY_A=-1.305] autolearn=ham autolearn_force=no
X-Policyd-Weight using cached result; rate: -4.6
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0
MIME-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 8bit
Content-Language en-US
X-Mailing-List <debian-user@lists.debian.org> archive/latest/780276
List-ID <debian-user.lists.debian.org>
List-URL <https://lists.debian.org/debian-user/>
List-Archive https://lists.debian.org/msgid-search/a8e40369-76f4-b639-94bc-751c8450e7b9@little-beak.com
Approved robomod@news.nic.it
Lines 55
Organization linux.* mail to news gateway
Sender robomod@news.nic.it
X-Original-Date Thu, 2 Sep 2021 05:44:33 +0200
X-Original-Message-ID <a8e40369-76f4-b639-94bc-751c8450e7b9@little-beak.com>
X-Original-References <11000339-dda5-1cbf-6dd6-502507e21f45@little-beak.com> <YSzSDqxC/2HKRaf1@wooledge.org> <YSzzzdQc8Pck6tqw@phare.normalesup.org> <YSz7ou2JyD0w4se7@wooledge.org>
Xref csiph.com linux.debian.user:239581

Show key headers only | 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