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

Re: cat and pipelines, mostly (was Re: Delete all after a pattern)



On Sat 31 Aug 2019 at 11:31:34 (-0400), Roberto C. Sánchez wrote:
> On Sat, Aug 31, 2019 at 10:26:34AM -0500, David Wright wrote:
> > On Sat 31 Aug 2019 at 11:11:43 (-0400), Roberto C. Sánchez wrote:
> > > On Sat, Aug 31, 2019 at 10:39:00AM -0400, The Wanderer wrote:
> > > > On 2019-08-31 at 10:07, Roberto C. Sánchez wrote:
> > > > 
> > > > I actually think this is good behavior. The only obvious places to put
> > > > the cursor when doing command history are at the beginning of the line
> > > > and at the end, and for convenience-of-editing purposes, the end seems
> > > > obviously preferable to the beginning.
> > > > 
> > > > What possible shell behavior would you suggest that might be better in
> > > > this regard?
> > > > 
> > > When viewing the immediate prior command in history the cursor could
> > > placed at the same position on the line as where it was found when the
> > > command was executed (most likely because the user presed 'enter').
> > 
> > That completely screws up command history recall.
> > 
> > [Assuming we're speaking bash,] ↑ leaves the cursor at the end of the
> > previous command line so that ↑↑ goes to the next previous, and so on.
> > If ↑ leaves the cursor in the middle of the line, then ↑↑ can only
> > visit previous command lines that match up to the cursor position.
> > What good is that?
> > 
> I don't think so.  What I was thinking was history that operates as it
> currently does, but that when reaching a new entry, the cursor is placed
> where it was when that line was executed.  That would mean that the
> cursor could jump around as you traverse history.  But then, it already
> does that since the end of the line is usually in a different place for
> each entry.

Perhaps a clue to the difference between us is in that last sentence.

I see all the difference between sticking to the end of the line and
pointing to different positions within the lines. In the former case
(as now), yes, the shell is changing the cursor's column number while
each command line is recalled, but the natural concept of "end-ness"
is what the eye and brain perceive.

If you do move the cursor in the command line at any time, then the
current behaviour changes: the text to the left of the cursor is
constant as you scroll back and forth through the history. That too
is a simple human perception.

(If you press Home, the cursor behaviour reverts to the first scheme,
except that you can't return to the original blank line with repeated ↓.)

With your scheme, you have to pay careful attention to the lines being
recalled because both the text and the cursor position are changing
all the time.

> My prior description was not sufficiently clear.

Well, I'm still not sure about the meaning of "when reaching a new entry".

Cheers,
David.


Reply to: