On 3/9/14 5:44 PM, [email protected] wrote:
> Hi,
>
> (I'm not subscribed so I could not reply to the last message)
>
> I could reproduce the issue by pressing delete twice in
> examples/rl-callbacktest. After debugging the issue, I found that when
> the first delete is pressed, at some point at readline.c:747, r is -1 so
> it fails to call the RL_UNSETSTATE line. After comparing with rl-6.2, I
> found the cause of the problem to be in readline.c:
> rl_dispatching = 1;
> RL_SETSTATE(RL_STATE_DISPATCHING);
> -(*map[key].function)(rl_numeric_arg * rl_arg_sign, key);
> +r = (*func) (rl_numeric_arg * rl_arg_sign, key);
> RL_UNSETSTATE(RL_STATE_DISPATCHING);
> rl_dispatching = 0;
>
> The dispatcher calls rl_delete() which calls rl_ding() and returns -1
> which gets stored as r and hence causes RL_STATE_MULTIKEY not to be set.
> In rl-6.2, rl_delete() also returns -1 but r is not stored so it
> doesn't fail.
>
> I'm not sure as to the solution or why the change was made but it seems
> to be the cause of the problem.
Thanks; this is a great piece of debugging. You pointed me to the right
place, and I was finally able to reproduce it on a convenient platform.
The problem is that the code uses -1 to mean two different things, but the
second use is only significant when the dispatch code notes that it has
read, or is reading, a multiple-key sequence. That suggests the solution
to the DEL issue, which I've attached as a patch. I will continue to look
at the previous-history/next-history issue.
Please let me know whether it fixes the various other problems on various
platforms.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU [email protected] http://cnswww.cns.cwru.edu/~chet/
*** ../bash-4.3/lib/readline/readline.c 2013-10-28 14:58:06.000000000 -0400
--- lib/readline/readline.c 2014-03-10 11:01:19.000000000 -0400
***************
*** 745,749 ****
RL_CHECK_SIGNALS ();
! if (r == 0) /* success! */
{
_rl_keyseq_chain_dispose ();
--- 745,749 ----
RL_CHECK_SIGNALS ();
! if (r == 0 || (r == -1 && (cxt->flags & KSEQ_SUBSEQ) == 0)) /* success! or failure! */
{
_rl_keyseq_chain_dispose ();
_______________________________________________
Bug-readline mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-readline