zsh-workers
 help / color / mirror / code / Atom feed
* up-line-or-search
@ 1998-06-01 12:13 Andy Wick
  1998-06-01 13:27 ` up-line-or-search Louis-David Mitterrand
  1998-06-01 16:29 ` up-line-or-search Bart Schaefer
  0 siblings, 2 replies; 5+ messages in thread
From: Andy Wick @ 1998-06-01 12:13 UTC (permalink / raw)
  To: zsh-workers

I guess I am the only one who uses up-line-or-search, since it
is still broken in 3.1.4.  I did a little bit of debugging, but
since I have no clue what is going on, I am really not much help.
If you comment out line 376 of Zle/zle_hist.c
    iblank(s[histmpos] == Meta ? s[histmpos+1]^32 : s[histmpos]) &&
up-line-or-search will kind of work, which is better then not
working.  What it still does with that line commented out is forget
the orginal string typed in, and uses the last string found each
time you hit up arrow.

Example:
(Previous Commands)
%lss -d
%ls -l
%lss
%ls

Now if I do 
   l<uparrow>
it finds "ls" if I hit up arrow again it finds "lss", one more
up arrow skips the "ls -l" and finds the "lss -d".

I'll buy someone a pizza if they just fix this for me, I really
want to upgrade to 3.1.x, but can't without my favorite feature.

Thanks,
Andy
-- 
awick@vt.edu                                    Andy Wick
awick@purple.org                              Virginia Tech


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: up-line-or-search
  1998-06-01 12:13 up-line-or-search Andy Wick
@ 1998-06-01 13:27 ` Louis-David Mitterrand
  1998-06-01 16:29 ` up-line-or-search Bart Schaefer
  1 sibling, 0 replies; 5+ messages in thread
From: Louis-David Mitterrand @ 1998-06-01 13:27 UTC (permalink / raw)
  To: zsh-workers

On Mon, Jun 01, 1998 at 08:13:57AM -0400, Andy Wick wrote:
> I guess I am the only one who uses up-line-or-search, since it
> is still broken in 3.1.4.  I did a little bit of debugging, but
> since I have no clue what is going on, I am really not much help.
> If you comment out line 376 of Zle/zle_hist.c
>     iblank(s[histmpos] == Meta ? s[histmpos+1]^32 : s[histmpos]) &&
> up-line-or-search will kind of work, which is better then not
> working.  What it still does with that line commented out is forget
> the orginal string typed in, and uses the last string found each
> time you hit up arrow.

I get the same effect than up-line-or-search by using:

bindkey <up-arrow> history-beginning-search-backward
(replace the <up-arrow> with the appropriate key sequence)

-- 
Louis-David Mitterrand
http://www.aparima.com
mito@aparima.com


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: up-line-or-search
  1998-06-01 12:13 up-line-or-search Andy Wick
  1998-06-01 13:27 ` up-line-or-search Louis-David Mitterrand
@ 1998-06-01 16:29 ` Bart Schaefer
  1998-06-01 16:51   ` up-line-or-search Andy Wick
  1 sibling, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 1998-06-01 16:29 UTC (permalink / raw)
  To: Andy Wick, zsh-workers

On Jun 1,  8:13am, Andy Wick wrote:
} Subject: up-line-or-search
}
} If you comment out line 376 of Zle/zle_hist.c
}     iblank(s[histmpos] == Meta ? s[histmpos+1]^32 : s[histmpos]) &&
} up-line-or-search will kind of work, which is better then not

I just downloaded and unpacked the 3.1.4 tarfile, and I have that code
on line 390, not 376.  So you may want to check the state of your
sources.  (This does not appear to be the reason for the problem.)

} What it still does with that line commented out is forget
} the orginal string typed in, and uses the last string found each
} time you hit up arrow.

This is all the result of the change in history-search-backward, which
causes it not to match word prefixes.  In my freshly-built copy of 3.1.4,
I can't even perform the search you describe here:

} Example:
} (Previous Commands)
} %lss -d
} %ls -l
} %lss
} %ls
} 
} Now if I do 
}    l<uparrow>
} it finds "ls"

When I do that, I get a beep, because there is no previous command where
`l' is the entire first word.  If I do "ls<uparrow>" I get "ls -l", having
entirely skipped "lss".  Repeated <uparrow> correctly finds other uses of
ls, skipping lss.

Now, I've never been terribly happy with the change to require full word
matching in history-search-backward, and the fact that it has rippled
through to change the way other commands behave makes it even more of an
annoyance.  However, I can't decide if this is actually a bug.  The doc
says:

`up-line-or-search'
     Move up a line in the buffer, or if already at the top line, search
     backward in the history for a line beginning with the first word
     in the buffer.

Neither there nor under history-search-backward does it say "a line whose
first word is the same as the first word in the buffer" but I suppose the
reference to "the first word" is supposed to imply that.  So perhaps the
command is working correctly but the doc is unclear.

} I'll buy someone a pizza if they just fix this for me, I really
} want to upgrade to 3.1.x, but can't without my favorite feature.

In zle_hist.c, in uplineorsearch(), call historybeginningsearchbackward()
instead of historysearchbackward() and I believe you'll get what you want.
How or whether Zefram intends to deal with this is another matter.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: up-line-or-search
  1998-06-01 16:29 ` up-line-or-search Bart Schaefer
@ 1998-06-01 16:51   ` Andy Wick
  1998-06-01 18:02     ` up-line-or-search Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Andy Wick @ 1998-06-01 16:51 UTC (permalink / raw)
  To: Bart Schaefer, zsh-workers

On Mon, Jun 01, 1998 at 09:29:32AM -0700, Bart Schaefer wrote:
> On Jun 1,  8:13am, Andy Wick wrote:
> } Subject: up-line-or-search
> }
> } If you comment out line 376 of Zle/zle_hist.c
> }     iblank(s[histmpos] == Meta ? s[histmpos+1]^32 : s[histmpos]) &&
> } up-line-or-search will kind of work, which is better then not
> 
> I just downloaded and unpacked the 3.1.4 tarfile, and I have that code
> on line 390, not 376.  So you may want to check the state of your
> sources.  (This does not appear to be the reason for the problem.)

Ah yes I typed in the wrong line number, thanks.

> In zle_hist.c, in uplineorsearch(), call historybeginningsearchbackward()
> instead of historysearchbackward() and I believe you'll get what you want.
> How or whether Zefram intends to deal with this is another matter.


THANK YOU, THANK YOU, THANK YOU.  This almost makes it work like it used to.
Only problem is it doesn't stick the cursor at the end of the line, but
I can get used to that.  Actually I think I like it better this way.
It would be nice if the old behavior was some how retained or a new 
binding was added, I don't want to edit the source everywhere.

Also what does "up-line" mean?  Should it go to the previous command
if you haven't typed anything?  In a stock 3.1.4 it just beeps.
Previous versions used to go to the previous command.

Where do you want your pizza? :-)

Thanks,
Andy
-- 
awick@vt.edu                                    Andy Wick
awick@purple.org                              Virginia Tech


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: up-line-or-search
  1998-06-01 16:51   ` up-line-or-search Andy Wick
@ 1998-06-01 18:02     ` Bart Schaefer
  0 siblings, 0 replies; 5+ messages in thread
From: Bart Schaefer @ 1998-06-01 18:02 UTC (permalink / raw)
  To: Andy Wick, zsh-workers

On Jun 1, 12:51pm, Andy Wick wrote:
} Subject: Re: up-line-or-search
}
} Also what does "up-line" mean?  Should it go to the previous command
} if you haven't typed anything?  In a stock 3.1.4 it just beeps.

That does appear to be a bug.

} Previous versions used to go to the previous command.

In previous versions, historysearchbackward() with an empty search would
find any line, thus "accidentally" finding the immediately previous line.
That behavior is recovered by using historybeginningsearchbackward().

I suspect this is further evidence that the history-beginning-search change
was a Bad Thing, as obviously more was depending on the old behavior than
anyone realized.

} Where do you want your pizza? :-)

How do you want to ship it? :-)

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1998-06-01 18:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-06-01 12:13 up-line-or-search Andy Wick
1998-06-01 13:27 ` up-line-or-search Louis-David Mitterrand
1998-06-01 16:29 ` up-line-or-search Bart Schaefer
1998-06-01 16:51   ` up-line-or-search Andy Wick
1998-06-01 18:02     ` up-line-or-search Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).