aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid E. O'Brien <obrien@FreeBSD.org>2011-03-31 18:23:38 +0000
committerDavid E. O'Brien <obrien@FreeBSD.org>2011-03-31 18:23:38 +0000
commit04f67c69773abd69e8de67b4bc0b324c4cac4a53 (patch)
tree3e558754bd9f27404813204499c92e766f7ca1d0
parent75d35a370343c1fb6f274d4631225321e727287f (diff)
downloadsrc-04f67c69773abd69e8de67b4bc0b324c4cac4a53.tar.gz
src-04f67c69773abd69e8de67b4bc0b324c4cac4a53.zip
Vendor import NetBSD's libedit of "2005/11/09 22:11:10 UTC".vendor/NetBSD/libedit/2005-11-09
Obtained from: NetBSD
Notes
Notes: svn path=/vendor/NetBSD/libedit/dist/; revision=220214 svn path=/vendor/NetBSD/libedit/2005-11-09/; revision=220215; tag=vendor/NetBSD/libedit/2005-11-09
-rw-r--r--chared.c6
-rw-r--r--chared.h4
-rw-r--r--common.c6
-rw-r--r--editline.313
-rw-r--r--el.c8
-rw-r--r--emacs.c6
-rw-r--r--filecomplete.c6
-rw-r--r--key.c8
-rw-r--r--makelist5
-rw-r--r--map.c23
-rw-r--r--refresh.c48
-rw-r--r--term.c8
-rw-r--r--vi.c19
13 files changed, 93 insertions, 67 deletions
diff --git a/chared.c b/chared.c
index a3121da80259..4d9bdae00699 100644
--- a/chared.c
+++ b/chared.c
@@ -1,4 +1,4 @@
-/* $NetBSD: chared.c,v 1.24 2005/08/01 23:00:15 christos Exp $ */
+/* $NetBSD: chared.c,v 1.25 2005/08/08 01:41:30 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)chared.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: chared.c,v 1.24 2005/08/01 23:00:15 christos Exp $");
+__RCSID("$NetBSD: chared.c,v 1.25 2005/08/08 01:41:30 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
@@ -523,6 +523,8 @@ ch_reset(EditLine *el, int mclear)
el->el_state.argument = 1;
el->el_state.lastcmd = ED_UNASSIGNED;
+ el->el_history.eventno = 0;
+
if (mclear)
ch__clearmacro(el);
}
diff --git a/chared.h b/chared.h
index e2786b25979d..b83595942c7d 100644
--- a/chared.h
+++ b/chared.h
@@ -1,4 +1,4 @@
-/* $NetBSD: chared.h,v 1.15 2005/08/01 23:00:15 christos Exp $ */
+/* $NetBSD: chared.h,v 1.16 2005/08/08 14:05:37 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -48,7 +48,7 @@
#define EL_MAXMACRO 10
/*
- * This is a issue of basic "vi" look-and-feel. Defining VI_MOVE works
+ * This is an issue of basic "vi" look-and-feel. Defining VI_MOVE works
* like real vi: i.e. the transition from command<->insert modes moves
* the cursor.
*
diff --git a/common.c b/common.c
index 15b3aa2f9309..1a2d094a5102 100644
--- a/common.c
+++ b/common.c
@@ -1,4 +1,4 @@
-/* $NetBSD: common.c,v 1.17 2005/08/01 23:00:15 christos Exp $ */
+/* $NetBSD: common.c,v 1.18 2005/08/08 14:05:37 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)common.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: common.c,v 1.17 2005/08/01 23:00:15 christos Exp $");
+__RCSID("$NetBSD: common.c,v 1.18 2005/08/08 14:05:37 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
@@ -155,7 +155,7 @@ ed_delete_next_char(EditLine *el, int c __attribute__((__unused__)))
return (CC_ERROR);
#else
term_overwrite(el, STReof, 4);
- /* then do a EOF */
+ /* then do an EOF */
term__flush();
return (CC_EOF);
#endif
diff --git a/editline.3 b/editline.3
index 3d4ccb1068ab..697541a6e479 100644
--- a/editline.3
+++ b/editline.3
@@ -1,4 +1,4 @@
-.\" $NetBSD: editline.3,v 1.48 2005/07/14 15:02:37 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.
@@ -33,7 +33,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd July 14, 2005
+.Dd September 9, 2005
.Os
.Dt EDITLINE 3
.Sh NAME
@@ -46,6 +46,7 @@
.Nm el_push ,
.Nm el_parse ,
.Nm el_set ,
+.Nm el_get ,
.Nm el_source ,
.Nm el_resize ,
.Nm el_line ,
@@ -629,11 +630,11 @@ Load the history list stored in
Save the history list to
.Fa file .
.It Dv H_SETUNIQUE , Fa "int unique"
-Set if the adjacent identical event strings should not be entered into
-the history.
+Set flag that adjacent identical event strings should not be entered
+into the history.
.It Dv H_GETUNIQUE
-Retrieve the current setting if if adjacent elements should be entered into
-the history.
+Retrieve the current setting if adjacent identical elements should
+be entered into the history.
.It Dv H_DEL , Fa "int num"
Delete the event numbered
.Fa e .
diff --git a/el.c b/el.c
index 57ca25568819..2e6b826ae9e8 100644
--- a/el.c
+++ b/el.c
@@ -1,4 +1,4 @@
-/* $NetBSD: el.c,v 1.40 2005/08/01 23:00:15 christos Exp $ */
+/* $NetBSD: el.c,v 1.41 2005/08/19 04:21:47 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)el.c 8.2 (Berkeley) 1/3/94";
#else
-__RCSID("$NetBSD: el.c,v 1.40 2005/08/01 23:00:15 christos Exp $");
+__RCSID("$NetBSD: el.c,v 1.41 2005/08/19 04:21:47 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
@@ -300,11 +300,11 @@ el_get(EditLine *el, int op, void *ret)
switch (op) {
case EL_PROMPT:
case EL_RPROMPT:
- rv = prompt_get(el, (void *) &ret, op);
+ rv = prompt_get(el, (el_pfunc_t *) ret, op);
break;
case EL_EDITOR:
- rv = map_get_editor(el, (void *) &ret);
+ rv = map_get_editor(el, (const char **)ret);
break;
case EL_SIGNAL:
diff --git a/emacs.c b/emacs.c
index 895bc3ebb66d..3f420b450e47 100644
--- a/emacs.c
+++ b/emacs.c
@@ -1,4 +1,4 @@
-/* $NetBSD: emacs.c,v 1.19 2004/10/28 21:14:52 dsl Exp $ */
+/* $NetBSD: emacs.c,v 1.20 2005/08/08 14:05:37 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)emacs.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: emacs.c,v 1.19 2004/10/28 21:14:52 dsl Exp $");
+__RCSID("$NetBSD: emacs.c,v 1.20 2005/08/08 14:05:37 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
@@ -59,7 +59,7 @@ em_delete_or_list(EditLine *el, int c __attribute__((__unused__)))
/* if I'm at the end */
if (el->el_line.cursor == el->el_line.buffer) {
/* and the beginning */
- term_overwrite(el, STReof, 4); /* then do a EOF */
+ term_overwrite(el, STReof, 4); /* then do an EOF */
term__flush();
return (CC_EOF);
} else {
diff --git a/filecomplete.c b/filecomplete.c
index e0738a7e52b2..271e84a64e1a 100644
--- a/filecomplete.c
+++ b/filecomplete.c
@@ -1,4 +1,4 @@
-/* $NetBSD: filecomplete.c,v 1.7 2005/06/11 18:18:59 christos Exp $ */
+/* $NetBSD: filecomplete.c,v 1.8 2005/08/03 13:41:38 christos Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
#include "config.h"
#if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: filecomplete.c,v 1.7 2005/06/11 18:18:59 christos Exp $");
+__RCSID("$NetBSD: filecomplete.c,v 1.8 2005/08/03 13:41:38 christos Exp $");
#endif /* not lint && not SCCSID */
#include <sys/types.h>
@@ -438,7 +438,7 @@ fn_complete(EditLine *el,
} else
matches = 0;
if (!attempted_completion_function ||
- (over != NULL && *over && !matches))
+ (over != NULL && !*over && !matches))
matches = completion_matches(temp, complet_func);
if (over != NULL)
diff --git a/key.c b/key.c
index 226a62f3c7a6..0516a5f55530 100644
--- a/key.c
+++ b/key.c
@@ -1,4 +1,4 @@
-/* $NetBSD: key.c,v 1.16 2005/07/06 21:13:02 christos Exp $ */
+/* $NetBSD: key.c,v 1.17 2005/08/08 14:05:37 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)key.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: key.c,v 1.16 2005/07/06 21:13:02 christos Exp $");
+__RCSID("$NetBSD: key.c,v 1.17 2005/08/08 14:05:37 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
@@ -46,7 +46,7 @@ __RCSID("$NetBSD: key.c,v 1.16 2005/07/06 21:13:02 christos Exp $");
* the extended-key map.
*
* An extended-key (key) is a sequence of keystrokes introduced
- * with an sequence introducer and consisting of an arbitrary
+ * with a sequence introducer and consisting of an arbitrary
* number of characters. This module maintains a map (the el->el_key.map)
* to convert these extended-key sequences into input strs
* (XK_STR), editor functions (XK_CMD), or unix commands (XK_EXE).
@@ -449,7 +449,7 @@ node__put(EditLine *el, key_node_t *ptr)
/* node__get():
- * Returns pointer to an key_node_t for ch.
+ * Returns pointer to a key_node_t for ch.
*/
private key_node_t *
node__get(int ch)
diff --git a/makelist b/makelist
index 766d3b2eceed..405399d33431 100644
--- a/makelist
+++ b/makelist
@@ -1,5 +1,5 @@
#!/bin/sh -
-# $NetBSD: makelist,v 1.9 2005/05/16 13:14:43 lukem Exp $
+# $NetBSD: makelist,v 1.11 2005/10/22 16:45:03 christos Exp $
#
# Copyright (c) 1992, 1993
# The Regents of the University of California. All rights reserved.
@@ -118,7 +118,6 @@ case $FLAG in
}
}
END {
- printf(" { NULL, 0, NULL }\n");
printf("};\n");
printf("\nprotected const el_bindings_t* help__get()");
printf("{ return el_func_help; }\n");
@@ -141,7 +140,7 @@ case $FLAG in
#
-fh)
cat $FILES | $AWK '/el_action_t/ { print $3 }' | \
- sort | tr '[a-z]' '[A-Z]' | $AWK '
+ sort | tr '[:lower:]' '[:upper:]' | $AWK '
BEGIN {
printf("/* Automatically generated file, do not edit */\n");
printf("#ifndef _h_fcns_c\n#define _h_fcns_c\n");
diff --git a/map.c b/map.c
index 8693fd696cb3..4cef24c1e688 100644
--- a/map.c
+++ b/map.c
@@ -1,4 +1,4 @@
-/* $NetBSD: map.c,v 1.20 2004/08/13 12:10:39 mycroft Exp $ */
+/* $NetBSD: map.c,v 1.22 2005/08/09 13:58:44 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)map.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: map.c,v 1.20 2004/08/13 12:10:39 mycroft Exp $");
+__RCSID("$NetBSD: map.c,v 1.22 2005/08/09 13:58:44 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
@@ -1125,11 +1125,12 @@ private void
map_print_key(EditLine *el, el_action_t *map, const char *in)
{
char outbuf[EL_BUFSIZ];
- el_bindings_t *bp;
+ el_bindings_t *bp, *ep;
if (in[0] == '\0' || in[1] == '\0') {
(void) key__decode_str(in, outbuf, "");
- for (bp = el->el_map.help; bp->name != NULL; bp++)
+ ep = &el->el_map.help[el->el_map.nfunc];
+ for (bp = el->el_map.help; bp < ep; bp++)
if (bp->func == map[(unsigned char) *in]) {
(void) fprintf(el->el_outfile,
"%s\t->\t%s\n", outbuf, bp->name);
@@ -1146,7 +1147,7 @@ map_print_key(EditLine *el, el_action_t *map, const char *in)
private void
map_print_some_keys(EditLine *el, el_action_t *map, int first, int last)
{
- el_bindings_t *bp;
+ el_bindings_t *bp, *ep;
char firstbuf[2], lastbuf[2];
char unparsbuf[EL_BUFSIZ], extrabuf[EL_BUFSIZ];
@@ -1161,7 +1162,8 @@ map_print_some_keys(EditLine *el, el_action_t *map, int first, int last)
key__decode_str(firstbuf, unparsbuf, STRQQ));
return;
}
- for (bp = el->el_map.help; bp->name != NULL; bp++) {
+ ep = &el->el_map.help[el->el_map.nfunc];
+ for (bp = el->el_map.help; bp < ep; bp++) {
if (bp->func == map[first]) {
if (first == last) {
(void) fprintf(el->el_outfile, "%-15s-> %s\n",
@@ -1244,7 +1246,7 @@ map_bind(EditLine *el, int argc, const char **argv)
char outbuf[EL_BUFSIZ];
const char *in = NULL;
char *out = NULL;
- el_bindings_t *bp;
+ el_bindings_t *bp, *ep;
int cmd;
int key;
@@ -1286,8 +1288,8 @@ map_bind(EditLine *el, int argc, const char **argv)
return (0);
case 'l':
- for (bp = el->el_map.help; bp->name != NULL;
- bp++)
+ ep = &el->el_map.help[el->el_map.nfunc];
+ for (bp = el->el_map.help; bp < ep; bp++)
(void) fprintf(el->el_outfile,
"%s\n\t%s\n",
bp->name, bp->description);
@@ -1388,7 +1390,7 @@ protected int
map_addfunc(EditLine *el, const char *name, const char *help, el_func_t func)
{
void *p;
- int nf = el->el_map.nfunc + 2;
+ int nf = el->el_map.nfunc + 1;
if (name == NULL || help == NULL || func == NULL)
return (-1);
@@ -1407,7 +1409,6 @@ map_addfunc(EditLine *el, const char *name, const char *help, el_func_t func)
el->el_map.help[nf].name = name;
el->el_map.help[nf].func = nf;
el->el_map.help[nf].description = help;
- el->el_map.help[++nf].name = NULL;
el->el_map.nfunc++;
return (0);
diff --git a/refresh.c b/refresh.c
index dd710034e7ba..3057ca6c15f3 100644
--- a/refresh.c
+++ b/refresh.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*-
* Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)refresh.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: refresh.c,v 1.26 2003/08/07 16:44:33 agc Exp $");
+__RCSID("$NetBSD: refresh.c,v 1.27 2005/11/09 22:11:10 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
@@ -56,6 +56,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);
@@ -347,7 +348,7 @@ re_insert(EditLine *el __attribute__((__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) {
@@ -360,7 +361,7 @@ re_insert(EditLine *el __attribute__((__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--)
@@ -369,7 +370,7 @@ re_insert(EditLine *el __attribute__((__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));
}
@@ -418,6 +419,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
@@ -633,7 +660,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",
@@ -782,9 +809,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
*/
@@ -825,10 +850,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));
}
}
/*
diff --git a/term.c b/term.c
index 6eafd9f6010d..a4493615ed81 100644
--- a/term.c
+++ b/term.c
@@ -1,4 +1,4 @@
-/* $NetBSD: term.c,v 1.40 2004/05/22 23:21:28 christos Exp $ */
+/* $NetBSD: term.c,v 1.41 2005/08/08 14:05:37 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)term.c 8.2 (Berkeley) 4/30/95";
#else
-__RCSID("$NetBSD: term.c,v 1.40 2004/05/22 23:21:28 christos Exp $");
+__RCSID("$NetBSD: term.c,v 1.41 2005/08/08 14:05:37 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
@@ -944,7 +944,7 @@ term_set(EditLine *el, const char *term)
Val(T_co) = tgetnum("co");
Val(T_li) = tgetnum("li");
for (t = tstr; t->name != NULL; t++) {
- /* XXX: some systems tgetstr needs non const */
+ /* XXX: some systems' tgetstr needs non const */
term_alloc(el, t, tgetstr(strchr(t->name, *t->name),
&area));
}
@@ -1449,7 +1449,7 @@ term_echotc(EditLine *el, int argc __attribute__((__unused__)),
break;
}
if (t->name == NULL) {
- /* XXX: some systems tgetstr needs non const */
+ /* XXX: some systems' tgetstr needs non const */
scap = tgetstr(strchr(*argv, **argv), &area);
}
if (!scap || scap[0] == '\0') {
diff --git a/vi.c b/vi.c
index 8f4180736dba..b2d4a05bb9be 100644
--- a/vi.c
+++ b/vi.c
@@ -1,4 +1,4 @@
-/* $NetBSD: vi.c,v 1.21 2005/04/25 01:06:03 matt Exp $ */
+/* $NetBSD: vi.c,v 1.24 2005/08/10 12:46:24 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)vi.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: vi.c,v 1.21 2005/04/25 01:06:03 matt Exp $");
+__RCSID("$NetBSD: vi.c,v 1.24 2005/08/10 12:46:24 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
@@ -71,8 +71,10 @@ cv_action(EditLine *el, int c)
el->el_line.lastchar - el->el_line.buffer);
el->el_chared.c_vcmd.action = NOP;
el->el_chared.c_vcmd.pos = 0;
- el->el_line.lastchar = el->el_line.buffer;
- el->el_line.cursor = el->el_line.buffer;
+ if (!(c & YANK)) {
+ el->el_line.lastchar = el->el_line.buffer;
+ el->el_line.cursor = el->el_line.buffer;
+ }
if (c & INSERT)
el->el_map.current = el->el_map.key;
@@ -89,7 +91,6 @@ cv_action(EditLine *el, int c)
private el_action_t
cv_paste(EditLine *el, int c)
{
- char *ptr;
c_kill_t *k = &el->el_chared.c_kill;
int len = k->last - k->buf;
@@ -103,12 +104,12 @@ cv_paste(EditLine *el, int c)
if (!c && el->el_line.cursor < el->el_line.lastchar)
el->el_line.cursor++;
- ptr = el->el_line.cursor;
c_insert(el, len);
if (el->el_line.cursor + len > el->el_line.lastchar)
return (CC_ERROR);
- (void) memcpy(ptr, k->buf, len +0u);
+ (void) memcpy(el->el_line.cursor, k->buf, len +0u);
+
return (CC_REFRESH);
}
@@ -895,7 +896,7 @@ vi_yank(EditLine *el, int c)
/* vi_comment_out():
* Vi comment out current command
- * [c]
+ * [#]
*/
protected el_action_t
/*ARGSUSED*/
@@ -912,7 +913,7 @@ vi_comment_out(EditLine *el, int c)
/* vi_alias():
* Vi include shell alias
* [@]
- * NB: posix impiles that we should enter insert mode, however
+ * NB: posix implies that we should enter insert mode, however
* this is against historical precedent...
*/
protected el_action_t