Subject: lib/9243: libedit ignores repeat count
To: None <gnats-bugs@gnats.netbsd.org>
From: Kevin Schoedel <schoedel@kw.igs.net>
List: netbsd-bugs
Date: 01/19/2000 10:22:30
>Number:         9243
>Category:       lib
>Synopsis:       libedit ignores repeat count
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    lib-bug-people (Library Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jan 19 10:21:00 2000
>Last-Modified:
>Originator:     Kevin Schoedel
>Organization:
>Release:        1.4.1
>Environment:
>Description:

libedit drops keys bound to ed-argument-digit, and consequenly
repeat counts do not work.

>How-To-Repeat:

'foo ESC 2 h' or similar in any program using libedit (e.g. ftp).

>Fix:

The problem is in read_getcmd(), which loops on cmd==0 where it intends
to loop on cmd==ED_UNASSIGNED. It happens that ED_ARGUMENT_DIGIT is
zero, so keys bound to that are dropped.

*** read.c	Tue Oct  5 07:15:35 1999
--- read.c	Wed Jan 19 12:22:43 2000
***************
*** 209,218 ****
      el_action_t *cmdnum;
      char *ch;
  {
!     el_action_t  cmd = 0;
      int     num;
  
!     while (cmd == 0 || cmd == ED_SEQUENCE_LEAD_IN) {
  	if ((num = el_getc(el, ch)) != 1)	/* if EOF or error */
  	    return num;
  
--- 209,218 ----
      el_action_t *cmdnum;
      char *ch;
  {
!     el_action_t  cmd = ED_UNASSIGNED;
      int     num;
  
!     while (cmd == ED_UNASSIGNED || cmd == ED_SEQUENCE_LEAD_IN) {
  	if ((num = el_getc(el, ch)) != 1)	/* if EOF or error */
  	    return num;
  
***************
*** 322,328 ****
  #endif /* DEBUG_READ */
      num_read = read_char(el, cp);
  #ifdef DEBUG_READ
!     (void) fprintf(el->el_errfile, "Got it %c\n", cp);
  #endif /* DEBUG_READ */
      return num_read;
  }
--- 322,328 ----
  #endif /* DEBUG_READ */
      num_read = read_char(el, cp);
  #ifdef DEBUG_READ
!     (void) fprintf(el->el_errfile, "Got it %c\n", *cp);
  #endif /* DEBUG_READ */
      return num_read;
  }

-- 
Kevin Schoedel
schoedel@kw.igs.net
>Audit-Trail:
>Unformatted: