Implement CC_REDISPLAY, which (unlink CC_REFRESH) redraws the entire input

line (a la ^R). This is useful if the binding outputs information and
mucks up the input line. To be used in ``list-choices'' bindings (refer
to the ^D binding in csh when filec is set)
This commit is contained in:
lukem 1997-01-14 04:17:22 +00:00
parent 4ee6502e8b
commit 730be84dfc
4 changed files with 19 additions and 11 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: common.c,v 1.2 1997/01/11 06:47:50 lukem Exp $ */
/* $NetBSD: common.c,v 1.3 1997/01/14 04:17:22 lukem Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)common.c 8.1 (Berkeley) 6/4/93";
#else
static char rcsid[] = "$NetBSD: common.c,v 1.2 1997/01/11 06:47:50 lukem Exp $";
static char rcsid[] = "$NetBSD: common.c,v 1.3 1997/01/14 04:17:22 lukem Exp $";
#endif
#endif /* not lint && not SCCSID */
@ -657,9 +657,7 @@ ed_redisplay(el, c)
EditLine *el;
int c;
{
re_clear_lines(el);
re_clear_display(el);
return CC_REFRESH;
return CC_REDISPLAY;
}

View File

@ -1,4 +1,4 @@
.\" $NetBSD: editline.3,v 1.3 1997/01/11 06:47:51 lukem Exp $
.\" $NetBSD: editline.3,v 1.4 1997/01/14 04:17:23 lukem Exp $
.\"
.\" Copyright (c) 1997 The NetBSD Foundation, Inc.
.\" All rights reserved.
@ -325,7 +325,7 @@ is the key which caused the invocation.
The return value of
.Fn func
should be one of:
.Bl -tag -width "CC_REFRESH"
.Bl -tag -width "CC_REDISPLAY"
.It Dv CC_NORM
Add a normal character.
.It Dv CC_NEWLINE
@ -337,7 +337,11 @@ Expecting further command input as arguments, do nothing visually.
.It Dv CC_REFRESH
Refresh display.
.It Dv CC_CURSOR
Move cursor and refresh display.
Cursor moved, so update and perform
.Dv CC_REFRESH.
.It Dv CC_REDISPLAY
Redisplay entire input line.
This is useful if a key binding outputs extra information.
.It Dv CC_ERROR
An error occurred.
Beep, and flush tty.

View File

@ -1,4 +1,4 @@
/* $NetBSD: histedit.h,v 1.3 1997/01/11 06:47:56 lukem Exp $ */
/* $NetBSD: histedit.h,v 1.4 1997/01/14 04:17:24 lukem Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -74,6 +74,7 @@ typedef struct lineinfo {
#define CC_CURSOR 5
#define CC_ERROR 6
#define CC_FATAL 7
#define CC_REDISPLAY 8
/*
* Initialization, cleanup, and resetting

View File

@ -1,4 +1,4 @@
/* $NetBSD: read.c,v 1.2 1997/01/11 06:48:06 lukem Exp $ */
/* $NetBSD: read.c,v 1.3 1997/01/14 04:17:25 lukem Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)read.c 8.1 (Berkeley) 6/4/93";
#else
static char rcsid[] = "$NetBSD: read.c,v 1.2 1997/01/11 06:48:06 lukem Exp $";
static char rcsid[] = "$NetBSD: read.c,v 1.3 1997/01/14 04:17:25 lukem Exp $";
#endif
#endif /* not lint && not SCCSID */
@ -385,6 +385,11 @@ el_gets(el, nread)
re_refresh_cursor(el);
break;
case CC_REDISPLAY:
re_clear_lines(el);
re_clear_display(el);
/* FALLTHROUGH */
case CC_REFRESH:
el->el_state.argument = 1;
el->el_state.doingarg = 0;