On Mon, 14 Sep 2020 at 21:56, Greg Wooledge <wool...@eeg.ccf.org> wrote:
> On Sun, Sep 13, 2020 at 09:14:54PM -0500, David Wright wrote:
> > On Sat 12 Sep 2020 at 21:45:34 (+1000), David wrote:

> > > And regarding "just hit the enter key ... and all is fine", this
> > > behaviour does not just occur at a login prompt. If you login quickly
> > > as root to a minimal install as I often do, this behaviour occurs
> > > during root console use, and if one is half-way through typing a
> > > command which suddenly disappears from view, pressing enter could be a
> > > recipe for disaster.

> > > (eg dd before I have added the count= parameter).

> > > So my habit when it occurs has become to: ctrl-u, enter, ctrl-y.

> It's the same general kind of problem that you can face during terminal
> usage in many situations.  Something unexpectedly scribbles on your
> terminal while you're typing, whether it's modem line noise, or the
> kernel warning all users of an imminent reboot, or a background job
> you forgot you had running, or whatever.

> There are many ways to work around it.  My preferred way is to clear
> the screen with Ctrl-L (ESC Ctrl-L for me, because I use bash in vi
> mode).  That will redraw the shell prompt and the partially typed
> command after clearing the screen, and allow you to continue typing.

Thank you very much for that advice. I was not aware that bash
"clear-screen" has the feature of repainting the partially typed
command. This exactly addresses what was causing my concern, so I am
less troubled by this now.

For curiosity, I had a look at 'man bash' (on buster), it hints about
this feature in a way that might seem clear to someone who already knew
it, but does not communicate it clearly to me (ie someone with no
prior knowledge of it).

"clear-screen: Clear the screen leaving the current line at the top of
the screen."

The word "leaving" is what misdirects me.

Without knowing the actual behaviour, that sentence suggests to me
that the *current* (ie broken or invisible) line would be *left*
(ie unchanged) at the top. The sentence would better describe to me the
useful behaviour if it read something like:

"clear-screen: Clear the screen, redrawing the current line at the top
of the screen."

or

"clear-screen: Clear the screen, placing the current line at the top
of the screen, and redrawing any readline buffer contents."

Reply via email to