MFC: refresh.c 1.11: A refresh bug.
editline.3 1.26-1.29: Man page update and cleanup. editrc.5: 1.19: Man page cleanup.
This commit is contained in:
parent
380866e56d
commit
beb6b60f01
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: editline.3,v 1.49 2005/09/09 22:32:56 wiz Exp $
|
||||
.\" $NetBSD: editline.3,v 1.50 2005/10/12 09:29:43 wiz Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1997-2003 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
@ -48,6 +48,7 @@
|
||||
.Nm el_push ,
|
||||
.Nm el_parse ,
|
||||
.Nm el_set ,
|
||||
.Nm el_get ,
|
||||
.Nm el_source ,
|
||||
.Nm el_resize ,
|
||||
.Nm el_line ,
|
||||
@ -77,7 +78,7 @@
|
||||
.Ft int
|
||||
.Fn el_getc "EditLine *e" "char *ch"
|
||||
.Ft void
|
||||
.Fn el_push "EditLine *e" "const char *str"
|
||||
.Fn el_push "EditLine *e" "char *str"
|
||||
.Ft int
|
||||
.Fn el_parse "EditLine *e" "int argc" "const char *argv[]"
|
||||
.Ft int
|
||||
@ -107,7 +108,10 @@
|
||||
.Ft void
|
||||
.Fn tok_reset "Tokenizer *t"
|
||||
.Ft int
|
||||
.Fn tok_line "Tokenizer *t" "const LineInfo *li" "int *argc" "const char **argv[]" "int *cursorc" "int *cursoro"
|
||||
.Fo tok_line
|
||||
.Fa "Tokenizer *t" "const LineInfo *li" "int *argc" "const char **argv[]"
|
||||
.Fa "int *cursorc" "int *cursoro"
|
||||
.Fc
|
||||
.Ft int
|
||||
.Fn tok_str "Tokenizer *t" "const char *str" "int *argc" "const char **argv[]"
|
||||
.Sh DESCRIPTION
|
||||
@ -191,7 +195,7 @@ to execute builtin
|
||||
.Nm
|
||||
commands.
|
||||
If the command is prefixed with
|
||||
.Dq prog :
|
||||
.Dq prog:
|
||||
then
|
||||
.Fn el_parse
|
||||
will only execute the command if
|
||||
@ -395,7 +399,8 @@ This function is called internally by
|
||||
and
|
||||
.Fn el_getc .
|
||||
The builtin function can be set or restored with the special function
|
||||
name ``EL_BUILTIN_GETCFN''.
|
||||
name
|
||||
.Dv EL_BUILTIN_GETCFN .
|
||||
.It Dv EL_CLIENTDATA , Fa "void *data"
|
||||
Register
|
||||
.Fa data
|
||||
@ -437,7 +442,8 @@ above).
|
||||
Return non-zero if editing is enabled.
|
||||
.It Dv EL_GETCFN, Fa "int (**f)(EditLine *, char *)"
|
||||
Return a pointer to the function that read characters, which is equal to
|
||||
``EL_BUILTIN_GETCFN'' in the case of the default builtin function.
|
||||
.Dv EL_BUILTIN_GETCFN
|
||||
in the case of the default builtin function.
|
||||
.It Dv EL_CLIENTDATA , Fa "void **data"
|
||||
Retrieve
|
||||
.Fa data
|
||||
@ -648,7 +654,7 @@ The caller is responsible for free'ing the string in the returned
|
||||
.Pp
|
||||
The
|
||||
.Fn history
|
||||
function returns \*[Gt]= 0 if the operation
|
||||
function returns \*[Ge] 0 if the operation
|
||||
.Fa op
|
||||
succeeds.
|
||||
Otherwise, \-1 is returned and
|
||||
@ -719,14 +725,12 @@ and
|
||||
.Aq newline .
|
||||
A positive exit code indicates that another line should be read
|
||||
and tokenization attempted again.
|
||||
.
|
||||
.It Fn tok_str
|
||||
A simpler form of
|
||||
.Fn tok_line ;
|
||||
.Fa str
|
||||
is a NUL terminated string to tokenize.
|
||||
.El
|
||||
.
|
||||
.\"XXX.Sh EXAMPLES
|
||||
.\"XXX: provide some examples
|
||||
.Sh SEE ALSO
|
||||
|
@ -231,7 +231,7 @@ Enable or disable the
|
||||
.Nm editline
|
||||
functionality in a program.
|
||||
.It Ic history Ar list | Ar size Dv n | Ar unique Dv n
|
||||
The
|
||||
The
|
||||
.Ar list
|
||||
command lists all entries in the history.
|
||||
The
|
||||
|
@ -29,7 +29,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $NetBSD: refresh.c,v 1.26 2003/08/07 16:44:33 agc Exp $
|
||||
* $NetBSD: refresh.c,v 1.27 2005/11/09 22:11:10 christos Exp $
|
||||
*/
|
||||
|
||||
#if !defined(lint) && !defined(SCCSID)
|
||||
@ -54,6 +54,7 @@ private void re_update_line(EditLine *, char *, char *, int);
|
||||
private void re_insert (EditLine *, char *, int, int, char *, int);
|
||||
private void re_delete(EditLine *, char *, int, int, int);
|
||||
private void re_fastputc(EditLine *, int);
|
||||
private void re_clear_eol(EditLine *, int, int, int);
|
||||
private void re__strncopy(char *, char *, size_t);
|
||||
private void re__copy_and_pad(char *, const char *, size_t);
|
||||
|
||||
@ -345,7 +346,7 @@ re_insert(EditLine *el __unused,
|
||||
ELRE_DEBUG(1,
|
||||
(__F, "re_insert() starting: %d at %d max %d, d == \"%s\"\n",
|
||||
num, dat, dlen, d));
|
||||
ELRE_DEBUG(1, (__F, "s == \"%s\"n", s));
|
||||
ELRE_DEBUG(1, (__F, "s == \"%s\"\n", s));
|
||||
|
||||
/* open up the space for num chars */
|
||||
if (num > 0) {
|
||||
@ -358,7 +359,7 @@ re_insert(EditLine *el __unused,
|
||||
ELRE_DEBUG(1, (__F,
|
||||
"re_insert() after insert: %d at %d max %d, d == \"%s\"\n",
|
||||
num, dat, dlen, d));
|
||||
ELRE_DEBUG(1, (__F, "s == \"%s\"n", s));
|
||||
ELRE_DEBUG(1, (__F, "s == \"%s\"\n", s));
|
||||
|
||||
/* copy the characters */
|
||||
for (a = d + dat; (a < d + dlen) && (num > 0); num--)
|
||||
@ -367,7 +368,7 @@ re_insert(EditLine *el __unused,
|
||||
ELRE_DEBUG(1,
|
||||
(__F, "re_insert() after copy: %d at %d max %d, %s == \"%s\"\n",
|
||||
num, dat, dlen, d, s));
|
||||
ELRE_DEBUG(1, (__F, "s == \"%s\"n", s));
|
||||
ELRE_DEBUG(1, (__F, "s == \"%s\"\n", s));
|
||||
}
|
||||
|
||||
|
||||
@ -416,6 +417,32 @@ re__strncopy(char *a, char *b, size_t n)
|
||||
*a++ = *b++;
|
||||
}
|
||||
|
||||
/* re_clear_eol():
|
||||
* Find the number of characters we need to clear till the end of line
|
||||
* in order to make sure that we have cleared the previous contents of
|
||||
* the line. fx and sx is the number of characters inserted or deleted
|
||||
* int the first or second diff, diff is the difference between the
|
||||
* number of characters between the new and old line.
|
||||
*/
|
||||
private void
|
||||
re_clear_eol(EditLine *el, int fx, int sx, int diff)
|
||||
{
|
||||
|
||||
ELRE_DEBUG(1, (__F, "re_clear_eol sx %d, fx %d, diff %d\n",
|
||||
sx, fx, diff));
|
||||
|
||||
if (fx < 0)
|
||||
fx = -fx;
|
||||
if (sx < 0)
|
||||
sx = -sx;
|
||||
if (fx > diff)
|
||||
diff = fx;
|
||||
if (sx > diff)
|
||||
diff = sx;
|
||||
|
||||
ELRE_DEBUG(1, (__F, "re_clear_eol %d\n", diff));
|
||||
term_clear_EOL(el, diff);
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
re_update_line() is based on finding the middle difference of each line
|
||||
@ -631,7 +658,7 @@ re_update_line(EditLine *el, char *old, char *new, int i)
|
||||
fx = (nsb - nfd) - (osb - ofd);
|
||||
sx = (nls - nse) - (ols - ose);
|
||||
|
||||
ELRE_DEBUG(1, (__F, "\n"));
|
||||
ELRE_DEBUG(1, (__F, "fx %d, sx %d\n", fx, sx));
|
||||
ELRE_DEBUG(1, (__F, "ofd %d, osb %d, ose %d, ols %d, oe %d\n",
|
||||
ofd - old, osb - old, ose - old, ols - old, oe - old));
|
||||
ELRE_DEBUG(1, (__F, "nfd %d, nsb %d, nse %d, nls %d, ne %d\n",
|
||||
@ -780,9 +807,7 @@ re_update_line(EditLine *el, char *old, char *new, int i)
|
||||
* write (nsb-nfd) chars of new starting at nfd
|
||||
*/
|
||||
term_overwrite(el, nfd, (nsb - nfd));
|
||||
ELRE_DEBUG(1, (__F,
|
||||
"cleareol %d\n", (oe - old) - (ne - new)));
|
||||
term_clear_EOL(el, (oe - old) - (ne - new));
|
||||
re_clear_eol(el, fx, sx, (oe - old) - (ne - new));
|
||||
/*
|
||||
* Done
|
||||
*/
|
||||
@ -823,10 +848,7 @@ re_update_line(EditLine *el, char *old, char *new, int i)
|
||||
ELRE_DEBUG(1, (__F,
|
||||
"but with nothing left to save\r\n"));
|
||||
term_overwrite(el, nse, (nls - nse));
|
||||
ELRE_DEBUG(1, (__F,
|
||||
"cleareol %d\n", (oe - old) - (ne - new)));
|
||||
if ((oe - old) - (ne - new) != 0)
|
||||
term_clear_EOL(el, (oe - old) - (ne - new));
|
||||
re_clear_eol(el, fx, sx, (oe - old) - (ne - new));
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user