On 3/10/14, 5:23 PM, Anatol Pomozov wrote:

> Then I tried to find why r is 1. Here is the session
> https://gist.githubusercontent.com/anatol/9474427/raw/362de60a2dc75cc53f9650d7cbead2e1370c773c/where_from_1_comes
> 
> This value comes from
> 
>  if ((cxt->flags & KSEQ_DISPATCHED) == 0)
>     {
>       nkey = _rl_subseq_getchar (cxt->okey);
>       if (nkey < 0)
>         {
>           _rl_abort_internal ();
>           return -1;
>         }
>       r = _rl_dispatch_subseq (nkey, cxt->dmap, cxt->subseq_arg);
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>       cxt->flags |= KSEQ_DISPATCHED;
>     }
> 
> 
> 
> That itself comes from
>           r = (*func) (rl_numeric_arg * rl_arg_sign, key);
> 
> it is rl_history_search_forward (count=1, ignore=66)
> it calls rl_history_search_internal (count=1, dir=1)

Thanks, this solves the mystery.  That is not the default function bound
to the up-arrow key (the default is "get-previous-history").  That's why
I was not able to reproduce it: either ipython, the python core, or your
inputrc must have changed the key binding.

I've attached a new patch that should solve all of these problems.  Please
let me know how it works for you.

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 14:15:02.000000000 -0400
***************
*** 745,749 ****
  
    RL_CHECK_SIGNALS ();
!   if (r == 0)			/* success! */
      {
        _rl_keyseq_chain_dispose ();
--- 745,750 ----
  
    RL_CHECK_SIGNALS ();
!   /* We only treat values < 0 specially to simulate recursion. */
!   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

Reply via email to