[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Get Terminal to Echo line in buffer on backspace



> On 30/08/2021 14:41, Greg Wooledge wrote:
> > What you want to do is redraw the current command.  The easiest way to
> > do this is to press Ctrl-L.  (Or if you're in vi mode, ESC Ctrl-L, and
> > then you'll need to go back to command mode.)

(I mis-spoke slightly.  I meant "exit from command mode".  But this user
probably isn't in vi mode so it probably doesn't matter.)

On Mon, Aug 30, 2021 at 02:57:42PM +0200, Thomas Anderson wrote:
> It's hard for me to describe, so here is an example of I am looking to
> emulate (this is from a mac).
> 
> https://cloud.little-beak.com/s/KxpjEHJ5RTEYZmS
> 
> On debian, I have tried many different terminal emulators, and all the
> visible options to get this type
> 
> of behavior, but have failed. =(

What you're asking for sounds like "every time I backspace, I want
the shell to erase the current prompt and command and redraw them
from scratch, just in case there's some line noise on my terminal".
This is wasteful, and is not an available mode in bash.  I can't speak
for other shells.

You simply aren't going to get that behavior.  So I'm telling you how
you can work around the problem, or fix your *underlying problem*.

When "line noise" scribbles on your interactive shell prompt and makes
it too difficult to see what you're typing, you can either redraw the
screen (Ctrl-L), or power through, knowing what's there even if you
cannot see it, having faith in knowing what your fingers have done.
(For most of us, redrawing will be preferable.)

If the "line noise" is actually output from some job that *you* launched,
then you may wish to reconsider your work habits which are leading to
the undesired situation.  Run this background job in a different way,
which doesn't interfere with your ongoing work.

If you're getting *genuine* line noise (from an analog modem connection),
then you have my sympathy.  I haven't used an analog modem in many years.
But for modem use, there's a *really good reason* you don't redraw the
user's entire shell prompt & command on a frequent basis -- it's SLOW!
The amount of time it would take to redraw the prompt & command over a
slow (and noisy) analog modem line would be significant, and would annoy
you.  A lot.


Reply to: