Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Oct 2017 20:59:33 -0700
From:      Devin Teske <devin@shxd.cx>
To:        Dan Mack <mack@macktronics.com>
Cc:        Alexey Dokuchaev <danfe@FreeBSD.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>, Eitan Adler <eadler@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>, Cy Schubert <Cy.Schubert@komquats.com>, Ed Maste <emaste@freebsd.org>, Warner Losh <imp@bsdimp.com>
Subject:   Re: svn commit: r325092 - head/usr.bin/fortune/datfiles
Message-ID:  <2D640E63-6C20-4904-ADF6-DAF422797604@shxd.cx>
In-Reply-To: <m2k1zc5ng7.fsf@macktronics.com>
References:  <201710291851.v9TIpM0I073542@slippy.cwsent.com> <B855A05D-E1BB-485F-AB8D-9F9656F531CC@shxd.cx> <m28tfsofph.fsf@macktronics.com> <20171030151627.GA74374@FreeBSD.org> <3CB26689-0D12-4E69-9BBA-58CCC3B71F3F@shxd.cx> <m2k1zc5ng7.fsf@macktronics.com>

next in thread | previous in thread | raw e-mail | index | archive | help

> On Oct 30, 2017, at 2:35 PM, Dan Mack <mack@macktronics.com> wrote:
>=20
> Devin Teske <devin@shxd.cx> writes:
>=20
>> Better in bash which allows you to filter not only on "begins with"
>> but also "contains" (which is arguably more valuable than "begins
>> with").
>=20
> Definately different. Better? Maybe for some.  I most always search
> command history by prefix and then just using multiple ESC-p invocations
> to find the one command to edit/re-execute.  Less frequently I want to
> search the whole text of history for the whole command line sequence
> like bash Ctrl-R accomplishes.
>=20
>>>> To emulate this behaviour in bash, I simply create a .inputrc file in m=
y
>>>> $HOME with the following contents:
>>>>=20
>>>> # .inputrc file
>>>> "\ep": history-search-backward
>>>> "\en": history-search-forward
>=20
>> Interesting that you mapped these to cursor-up/cursor-down.
>>=20
>> That may cause unexpected results.
>=20
>> For example, typing something and then pressing up-arrow will cause
>> the shell to give you the previous command that started with that
>> rather than the previous command in-general.
>=20
> It's ESC-p/ESC-n, not just plain up-arrow/down-arrow. =20

You cut too important context from your reply. Before I said "Interesting th=
at you mapped ...", ...

> On Oct 30, 2017, at 8:16 AM, Alexey Dokuchaev <danfe@FreeBSD.org> wrote:
>=20
> On GNU/Linux boxes mine has:
>=20
> "\e[A": history-search-backward
> "\e[B": history-search-forward

And according to wikipedia:

https://en.m.wikipedia.org/wiki/ANSI_escape_code

Under "CSI Sequences" ...

\e[A is really "cursor up" (CUU; with syntax of CSI [n] A)

\e[B is really "cursor down" (CUD; with syntax of CSI [n] B)

NB: CSI is \e[

> Up arrow still
> does up without any search.

Not if you do what danfe did above, in the restored context.


> At least with my config using \ep as shown.
> My up arrows work for me as expected - they just iterate forward and
> backward through shell history.
>=20

That is expected behavior.
--=20
Devin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2D640E63-6C20-4904-ADF6-DAF422797604>