Re: [PATCH] Fix: call using_history after initializing history entries
Jeremie Courreges-Anglas <[email protected]> Mon, 07 Aug 2017 19:51:24 +0200
| Newsgroups | gmane.comp.window-managers.ratpoison.devel |
|---|---|
| Message-ID | <[email protected]> |
--===============4339519774119641039== Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Wed, Aug 02 2017, Antoine Busque <[email protected]> wrote: > In its current state, history expansion requiring any sort of string > lookup is not working, always returing "event not found". This is due > to `history_offset` being set improperly by an early call to > `using_history`. > > A call to `using_history` needs to follow, not precede, the loop > performing initialization of history entries found in > `history_expand_line`. This allows for `history_offset` to reflect the > now non-zero length of the history, restoring the expected behaviour > of history expansion. Thanks for figuring this out, Antoine. I don't think I've ever used (or tried to use) history expansion support in ratpoison. I think there are two possible ways to move forward: =2D history expansion has been broken for so long that this code should just be removed. =2D only recent versions of libhistory break with the current ratpoison code. So people that are used to this history expansion support might like your fix. I have recently disabled libhistory support by default, and asked whether people would miss it if it was removed for good from ratpoison. Only two persons answered positively. Also, looking at the code in your diff below, history expansion will only be enabled for lines that contain '!', which is a subset of what libhistory supports. I am going to merge your fix, so that people can play with history expansion, and hopefully improve it. I won't test it myself, as my day-to-day system doesn't provide libhistory. Input welcome. > Tested-by: Martin Hertz <[email protected]> > Signed-off-by: Antoine Busque <[email protected]> > --- > src/history.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/history.c b/src/history.c > index d1e9938..1466e89 100644 > --- a/src/history.c > +++ b/src/history.c > @@ -314,10 +314,10 @@ history_expand_line (int history_id UNUSED, char *s= tring, char **output) >=20=20 > if (strchr (string, '!')) { > clear_history (); > - using_history (); > list_for_each_entry(item, &histories[history_id].head, node) { > add_history (item->line); > } > + using_history (); > return history_expand (string, output); > } > #endif =2D-=20 jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEUTWSwa02UpMr393MDfp0rhUk5+4FAlmIqJwACgkQDfp0rhUk 5+6TEA//UZKRhbz7pGnLEjV3eEJPCJ1czfBwEAHtQ5zCfpVnAYWLs869er9Bsix7 2YZ/6n0YQmpzMB9GsQz4vRuYH7RkX/Dt/sCzSoPN6DUKKXDKoihouUrzbhr9ci8A c+bCuI0vb/EmwW8KSr4MYzYoBzgYp0IuEoWf3Ex3WNbw1h+snxfHcZPaAjkPZGm5 rw9qG2Hz/kDIh8R5FofuLF2C3ZOEbEXuJWnjvAmqB0ezT/pVOAPKoDYdI1X5zYgE DTeDe5HiA4kCI46OXUoQzLWNSf9ZQVqZ4iNpvIERcJ0yDxIjG5EuPS6/J4wieJS/ lzBwXW7Kn1OSRIzYcwcULuf3w0tex+LwKFZBK/oiXQAPXknsXwFagGaYofW6tD2I Xb5QH27lYKuM3hIEXVfX3GUVbjXO+jR8PdWNQVR88YS+ZTBp4cQA7qjUF3HstXgc NTaEylK251bi6YpmOXBllk22vwLfxXdcU99Qy3IoeHYRDC49IEaxLCQwVBLe8hZz 9P6FjbMmgoePvcwTfMD6CfcfO1km0Di5RbQdrXSLPTtiXyw1P7JpAgQo5hhJH7VT 95ejn0hrgnBEx4kmooH1+jEKKEHvDy8AWyNqmx3mrxkvMNuZVeUJZF/9UBzX7niX pGBwG5NVEZm0eQ0vN4X+ivDcQ2FbbyCj26akgxSemxLe7BLqviU= =iTCB -----END PGP SIGNATURE----- --=-=-=-- --===============4339519774119641039== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Ratpoison-devel mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/ratpoison-devel --===============4339519774119641039==--