+ Fix bug where ^V didn't keep input mapping from happening.
+ Fix a core dump bug in the R command.
+ Give up on licensing: no more shareware, adware, whatever.
+ Fix cursor positioning bug for C, S and c$ in an empty file.
+The vi program is freely redistributable. You are welcome to copy, modify
+and share it with others under the conditions listed in this file. If any
+company (not any individual!) finds vi sufficiently useful that you would
+have purchased it, or if any company wishes to redistribute it, contributions
+to the authors would be appreciated.
+
/*-
* Copyright (c) 1991, 1992, 1993, 1994
* The Regents of the University of California. All rights reserved.
+ * Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996
+ * Keith Bostic. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-
-/*
- * Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996
- * Keith Bostic. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following message.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following message in the
- * documentation and/or other materials provided with the distribution.
- * 3. For permission to redistribute this program under conditions other
- * than these, contact Keith Bostic.
- *
- * The vi program is freely redistributable. You are welcome to copy,
- * modify and share it with others under the conditions listed in the
- * LICENSE file. If any company (not individual!) finds vi sufficiently
- * useful that you would have purchased it, or if any company wishes to
- * redistribute it, contributions to the authors would be appreciated.
- */
*
* See the LICENSE file for redistribution information.
*
- * @(#)cl.h 10.17 (Berkeley) 7/12/96
+ * @(#)cl.h 10.18 (Berkeley) 9/15/96
*/
typedef struct _cl_private {
char *rmso, *smso; /* Inverse video terminal strings. */
char *smcup, *rmcup; /* Terminal start/stop strings. */
- int in_ex; /* XXX: Currently running ex. */
-
int killersig; /* Killer signal. */
#define INDX_HUP 0
#define INDX_INT 1
enum { /* Terminal initialization strings. */
TE_SENT=0, TI_SENT } ti_te;
-#define CL_RENAME 0x001 /* X11 xterm icon/window renamed. */
-#define CL_RENAME_OK 0x002 /* User wants the windows renamed. */
-#define CL_SCR_EX_INIT 0x004 /* Ex screen initialized. */
-#define CL_SCR_VI_INIT 0x008 /* Vi screen initialized. */
-#define CL_SIGHUP 0x010 /* SIGHUP arrived. */
-#define CL_SIGINT 0x020 /* SIGINT arrived. */
-#define CL_SIGTERM 0x040 /* SIGTERM arrived. */
-#define CL_SIGWINCH 0x080 /* SIGWINCH arrived. */
+#define CL_IN_EX 0x0001 /* Currently running ex. */
+#define CL_RENAME 0x0002 /* X11 xterm icon/window renamed. */
+#define CL_RENAME_OK 0x0004 /* User wants the windows renamed. */
+#define CL_SCR_EX_INIT 0x0008 /* Ex screen initialized. */
+#define CL_SCR_VI_INIT 0x0010 /* Vi screen initialized. */
+#define CL_SIGHUP 0x0020 /* SIGHUP arrived. */
+#define CL_SIGINT 0x0040 /* SIGINT arrived. */
+#define CL_SIGTERM 0x0080 /* SIGTERM arrived. */
+#define CL_SIGWINCH 0x0100 /* SIGWINCH arrived. */
u_int32_t flags;
} CL_PRIVATE;
/* The screen line relative to a specific window. */
#define RLNO(sp, lno) (sp)->woff + (lno)
-/* Some functions can be safely ignored until the screen is running. */
-#define VI_INIT_IGNORE(sp) \
- if (F_ISSET(sp, SC_VI) && !F_ISSET(sp, SC_SCR_VI)) \
- return (0);
-#define EX_INIT_IGNORE(sp) \
- if (F_ISSET(sp, SC_EX) && !F_ISSET(sp, SC_SCR_EX)) \
- return (0);
-
/* X11 xterm escape sequence to rename the icon/window. */
#define XTERM_RENAME "\033]0;%s\007"
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)cl_screen.c 10.47 (Berkeley) 7/30/96";
+static const char sccsid[] = "@(#)cl_screen.c 10.48 (Berkeley) 9/15/96";
#endif /* not lint */
#include <sys/types.h>
if (LF_ISSET(SC_EX)) {
if (cl_ex_init(sp))
return (1);
- clp->in_ex = 1;
- F_SET(clp, CL_SCR_EX_INIT);
+ F_SET(clp, CL_IN_EX | CL_SCR_EX_INIT);
/*
* If doing an ex screen for ex mode, move to the last line
} else {
if (cl_vi_init(sp))
return (1);
- clp->in_ex = 0;
+ F_CLR(clp, CL_IN_EX);
F_SET(clp, CL_SCR_VI_INIT);
}
return (0);
* Move to the bottom of the window (some endwin implementations don't
* do this for you).
*/
- if (!clp->in_ex) {
+ if (!F_ISSET(clp, CL_IN_EX)) {
(void)move(0, 0);
(void)deleteln();
(void)move(LINES - 1, 0);
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)cl_term.c 10.21 (Berkeley) 7/12/96";
+static const char sccsid[] = "@(#)cl_term.c 10.22 (Berkeley) 9/15/96";
#endif /* not lint */
#include <sys/types.h>
CHAR_T *from, *to;
size_t flen, tlen;
{
- EX_INIT_IGNORE(sp);
- VI_INIT_IGNORE(sp);
+ /* Ignore until the screen is running, do the real work then. */
+ if (F_ISSET(sp, SC_VI) && !F_ISSET(sp, SC_SCR_VI))
+ return (0);
+ if (F_ISSET(sp, SC_EX) && !F_ISSET(sp, SC_SCR_EX))
+ return (0);
return (cl_pfmap(sp, stype, from, flen, to, tlen));
}
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)api.c 8.22 (Berkeley) 8/10/96";
+static const char sccsid[] = "@(#)api.c 8.23 (Berkeley) 9/15/96";
#endif /* not lint */
#include <sys/types.h>
#include <bitstring.h>
#include <limits.h>
-#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)cut.c 10.9 (Berkeley) 3/30/96";
+static const char sccsid[] = "@(#)cut.c 10.10 (Berkeley) 9/15/96";
#endif /* not lint */
#include <sys/types.h>
if (len != 0) {
if (clen == 0)
clen = len - fcno;
- memmove(tp->lb, p + fcno, clen);
+ memcpy(tp->lb, p + fcno, clen);
tp->len = clen;
}
return (NULL);
}
if (p != NULL && len != 0)
- memmove(tp->lb, p, len);
+ memcpy(tp->lb, p, len);
}
tp->len = len;
return (tp);
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)delete.c 10.10 (Berkeley) 3/6/96";
+static const char sccsid[] = "@(#)delete.c 10.11 (Berkeley) 9/15/96";
#endif /* not lint */
#include <sys/types.h>
if (db_get(sp, fm->lno, DBG_FATAL, &p, &len))
return (1);
GET_SPACE_RET(sp, bp, blen, fm->cno);
- memmove(bp, p, fm->cno);
+ memcpy(bp, p, fm->cno);
if (db_set(sp, fm->lno, bp, fm->cno))
return (1);
goto done;
return (1);
GET_SPACE_RET(sp, bp, blen, len);
if (fm->cno != 0)
- memmove(bp, p, fm->cno);
- memmove(bp + fm->cno, p + (tm->cno + 1), len - (tm->cno + 1));
+ memcpy(bp, p, fm->cno);
+ memcpy(bp + fm->cno, p + (tm->cno + 1), len - (tm->cno + 1));
if (db_set(sp, fm->lno,
bp, len - ((tm->cno - fm->cno) + 1)))
goto err;
if (db_get(sp, fm->lno, DBG_FATAL, &p, NULL))
return (1);
GET_SPACE_RET(sp, bp, blen, tlen + 256);
- memmove(bp, p, tlen);
+ memcpy(bp, p, tlen);
}
/* Copy the end partial line into place. */
} else
ADD_SPACE_RET(sp, bp, blen, nlen);
- memmove(bp + tlen, p + (tm->cno + 1), len - (tm->cno + 1));
+ memcpy(bp + tlen, p + (tm->cno + 1), len - (tm->cno + 1));
tlen += len - (tm->cno + 1);
}
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)line.c 10.20 (Berkeley) 4/27/96";
+static const char sccsid[] = "@(#)line.c 10.21 (Berkeley) 9/15/96";
#endif /* not lint */
#include <sys/types.h>
#include <bitstring.h>
#include <errno.h>
#include <limits.h>
-#include <signal.h>
#include <stdio.h>
#include <string.h>
}
/* Fill the cache. */
- memmove(&lno, key.data, sizeof(lno));
+ memcpy(&lno, key.data, sizeof(lno));
ep->c_nlines = ep->c_lno = lno;
ep->c_len = data.size;
ep->c_lp = data.data;
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)msg.c 10.46 (Berkeley) 8/19/96";
+static const char sccsid[] = "@(#)msg.c 10.48 (Berkeley) 9/15/96";
#endif /* not lint */
#include <sys/param.h>
tlen += len;
t = msg_cat(sp,
lines[sp->rptlines[cnt] == 1 ? 0 : 1], &len);
- memmove(p, t, len);
+ memcpy(p, t, len);
p += len;
tlen += len;
*p++ = ' ';
++tlen;
t = msg_cat(sp, *ap, &len);
- memmove(p, t, len);
+ memcpy(p, t, len);
p += len;
tlen += len;
sp->rptlines[cnt] = 0;
(void)sprintf(p, " (pid %lu)", (u_long)getpid());
p += strlen(p);
#endif
- len = p - bp;
-
- /*
- * Poison.
- *
- * This message may not be altered in any way, without the written
- * permission of Keith Bostic. See the LICENSE file for further
- * information.
- */
-#define POISON " UNLICENSED"
- if (!poisoned && len < sp->cols - ((sizeof(POISON) - 1) + 1)) {
- memset(p, ' ', sp->cols - len);
- p = (bp + sp->cols) - ((sizeof(POISON) - 1) + 1);
- memcpy(p, POISON, sizeof(POISON) - 1);
- p = (bp + sp->cols) - 1;
- len = p - bp;
- poisoned = 1;
- }
-
*p++ = '\n';
- ++len;
+ len = p - bp;
/*
* There's a nasty problem with long path names. Cscope and tags files
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)options.c 10.48 (Berkeley) 8/10/96";
+static const char sccsid[] = "@(#)options.c 10.49 (Berkeley) 9/15/96";
#endif /* not lint */
#include <sys/types.h>
int cnt, rval;
/* Copy most everything without change. */
- memmove(sp->opts, orig->opts, sizeof(orig->opts));
+ memcpy(sp->opts, orig->opts, sizeof(orig->opts));
/* Copy the string edit options. */
for (cnt = rval = 0; cnt < O_OPTIONCOUNT; ++cnt) {
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)put.c 10.9 (Berkeley) 3/6/96";
+static const char sccsid[] = "@(#)put.c 10.10 (Berkeley) 9/15/96";
#endif /* not lint */
#include <sys/types.h>
/* Original line, left of the split. */
if (len > 0 && (clen = cp->cno + (append ? 1 : 0)) > 0) {
- memmove(bp, p, clen);
+ memcpy(bp, p, clen);
p += clen;
t += clen;
}
/* First line from the CB. */
- memmove(t, tp->lb, tp->len);
+ memcpy(t, tp->lb, tp->len);
t += tp->len;
/* Calculate length left in the original line. */
*/
if (tp->q.cqe_next == (void *)&cbp->textq) {
if (clen > 0) {
- memmove(t, p, clen);
+ memcpy(t, p, clen);
t += clen;
}
if (db_set(sp, lno, bp, t - bp))
t = bp + len;
/* Add in last part of the CB. */
- memmove(t, ltp->lb, ltp->len);
+ memcpy(t, ltp->lb, ltp->len);
if (clen)
- memmove(t + ltp->len, p, clen);
+ memcpy(t + ltp->len, p, clen);
clen += ltp->len;
/*
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)recover.c 10.20 (Berkeley) 6/20/96";
+static const char sccsid[] = "@(#)recover.c 10.21 (Berkeley) 9/15/96";
#endif /* not lint */
#include <sys/param.h>
#include <fcntl.h>
#include <limits.h>
#include <pwd.h>
-#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)screen.c 10.14 (Berkeley) 7/19/96";
+static const char sccsid[] = "@(#)screen.c 10.15 (Berkeley) 9/15/96";
#endif /* not lint */
#include <sys/types.h>
}
sp->newl_len = orig->newl_len;
sp->newl_cnt = orig->newl_cnt;
- memmove(sp->newl, orig->newl, len);
+ memcpy(sp->newl, orig->newl, len);
}
if (opts_copy(orig, sp))
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)util.c 10.10 (Berkeley) 3/6/96";
+static const char sccsid[] = "@(#)util.c 10.11 (Berkeley) 9/15/96";
#endif /* not lint */
#include <sys/types.h>
MALLOC(sp, copy, CHAR_T *, len + 1);
if (copy == NULL)
return (NULL);
- memmove(copy, str, len * sizeof(CHAR_T));
+ memcpy(copy, str, len * sizeof(CHAR_T));
copy[len] = '\0';
return (copy);
}
+1.75 -> 1.76 (09/15/96)
+ + Fix bug where ^V didn't keep input mapping from happening.
+ + Fix a core dump bug in the R command.
+ + Give up on licensing: no more shareware, adware, whatever.
+ + Fix cursor positioning bug for C, S and c$ in an empty file.
1.74 -> 1.75 (08/22/96)
+ Add French to the error message translations.
+ Move the UNLICENSED message to the end of the message line.
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)ex.c 10.53 (Berkeley) 8/11/96";
+static const char sccsid[] = "@(#)ex.c 10.54 (Berkeley) 9/15/96";
#endif /* not lint */
#include <sys/types.h>
ecp->save_cmd -= arg1_len;
ecp->save_cmdlen += arg1_len;
- memmove(ecp->save_cmd, arg1, arg1_len);
+ memcpy(ecp->save_cmd, arg1, arg1_len);
/*
* Any commands executed from a +cmd are executed starting at
* so we have play games.
*/
ecp->cp = ecp->o_cp;
- memmove(ecp->cp, ecp->cp + ecp->o_clen, ecp->o_clen);
+ memcpy(ecp->cp, ecp->cp + ecp->o_clen, ecp->o_clen);
ecp->clen = ecp->o_clen;
ecp->range_lno = sp->lno = rp->start++;
GET_SPACE_GOTO(sp, bp, blen, len + 1);
bp[len] = '\0';
- memmove(bp, cmd, len);
+ memcpy(bp, cmd, len);
msgq_str(sp, M_ERR, bp, "098|The %s command is unknown");
FREE_SPACE(sp, bp, blen);
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)ex_at.c 10.11 (Berkeley) 6/30/96";
+static const char sccsid[] = "@(#)ex_at.c 10.12 (Berkeley) 9/15/96";
#endif /* not lint */
#include <sys/types.h>
/* Copy the buffer into the command space. */
for (p = ecp->cp + len, tp = cbp->textq.cqh_last;
tp != (void *)&cbp->textq; tp = tp->q.cqe_prev) {
- memmove(p, tp->lb, tp->len);
+ memcpy(p, tp->lb, tp->len);
p += tp->len;
*p++ = '\n';
}
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)ex_cscope.c 10.12 (Berkeley) 8/11/96";
+static const char sccsid[] = "@(#)ex_cscope.c 10.13 (Berkeley) 9/15/96";
#endif /* not lint */
#include <sys/param.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
-#include <signal.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)ex_join.c 10.9 (Berkeley) 3/6/96";
+static const char sccsid[] = "@(#)ex_join.c 10.10 (Berkeley) 9/15/96";
#endif /* not lint */
#include <sys/types.h>
}
if (len != 0) {
- memmove(tbp, p, len);
+ memcpy(tbp, p, len);
tbp += len;
clen += len;
echar = p[len - 1];
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)ex_move.c 10.9 (Berkeley) 3/6/96";
+static const char sccsid[] = "@(#)ex_move.c 10.10 (Berkeley) 9/15/96";
#endif /* not lint */
#include <sys/types.h>
if (db_get(sp, fl, DBG_FATAL, &p, &len))
return (1);
BINC_RET(sp, bp, blen, len);
- memmove(bp, p, len);
+ memcpy(bp, p, len);
if (db_append(sp, 1, tl, bp, len))
return (1);
if (mark_reset)
if (db_get(sp, fl, DBG_FATAL, &p, &len))
return (1);
BINC_RET(sp, bp, blen, len);
- memmove(bp, p, len);
+ memcpy(bp, p, len);
if (db_append(sp, 1, tl++, bp, len))
return (1);
if (mark_reset)
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)ex_perl.c 8.9 (Berkeley) 7/19/96";
+static const char sccsid[] = "@(#)ex_perl.c 8.10 (Berkeley) 9/15/96";
#endif /* not lint */
#include <sys/types.h>
#include <bitstring.h>
#include <ctype.h>
#include <limits.h>
-#include <signal.h>
#include <stdio.h>
#include <string.h>
#include <termios.h>
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)ex_shift.c 10.10 (Berkeley) 3/6/96";
+static const char sccsid[] = "@(#)ex_shift.c 10.11 (Berkeley) 9/15/96";
#endif /* not lint */
#include <sys/types.h>
*tbp++ = ' ';
/* Add the original line. */
- memmove(tbp, p + oldidx, len - oldidx);
+ memcpy(tbp, p + oldidx, len - oldidx);
/* Set the replacement line. */
if (db_set(sp, from, bp, (tbp + (len - oldidx)) - bp)) {
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)ex_subst.c 10.36 (Berkeley) 8/20/96";
+static const char sccsid[] = "@(#)ex_subst.c 10.37 (Berkeley) 9/15/96";
#endif /* not lint */
#include <sys/types.h>
}
} else if (p[0] == '~' && O_ISSET(sp, O_MAGIC)) {
tilde: ++p;
- memmove(t, sp->repl, sp->repl_len);
+ memcpy(t, sp->repl, sp->repl_len);
t += sp->repl_len;
len += sp->repl_len;
continue;
FREE_SPACE(sp, bp, blen);
return (1);
}
- memmove(sp->repl, bp, len);
+ memcpy(sp->repl, bp, len);
}
FREE_SPACE(sp, bp, blen);
}
return (1); \
} \
} \
- memmove(lb + lbclen, l, len); \
+ memcpy(lb + lbclen, l, len); \
lbclen += len; \
}
GET_SPACE_RET(sp, bp, blen, llen);
} else
ADD_SPACE_RET(sp, bp, blen, llen);
- memmove(bp, s, llen);
+ memcpy(bp, s, llen);
s = bp;
}
if (db_get(sp, lno, DBG_FATAL, &s, &llen))
goto err;
ADD_SPACE_RET(sp, bp, blen, llen)
- memmove(bp, s, llen);
+ memcpy(bp, s, llen);
s = bp;
len = llen - offset;
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)ex_tag.c 10.35 (Berkeley) 6/30/96";
+static const char sccsid[] = "@(#)ex_tag.c 10.36 (Berkeley) 9/15/96";
#endif /* not lint */
#include <sys/param.h>
free(tfp);
return (1);
}
- memmove(tfp->name, t, len);
+ memcpy(tfp->name, t, len);
tfp->name[len] = '\0';
tfp->flags = 0;
TAILQ_INSERT_TAIL(&exp->tagfq, tfp, q);
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)ex_tcl.c 8.9 (Berkeley) 4/28/96";
+static const char sccsid[] = "@(#)ex_tcl.c 8.10 (Berkeley) 9/15/96";
#endif /* not lint */
#include <sys/types.h>
#include <bitstring.h>
#include <limits.h>
-#include <signal.h>
#include <stdio.h>
#include <string.h>
#include <termios.h>
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)ex_txt.c 10.14 (Berkeley) 6/30/96";
+static const char sccsid[] = "@(#)ex_txt.c 10.15 (Berkeley) 9/15/96";
#endif /* not lint */
#include <sys/types.h>
ait.lb = NULL;
ait.lb_len = 0;
BINC_GOTO(sp, ait.lb, ait.lb_len, tp->ai);
- memmove(ait.lb, tp->lb, tp->ai);
+ memcpy(ait.lb, tp->lb, tp->ai);
ait.ai = ait.len = tp->ai;
carat_st = C_NOCHANGE;
#define VI_VERSION \
- "Version 1.75 (8/22/96) The CSRG, University of California, Berkeley."
+ "Version 1.76 (9/15/96) The CSRG, University of California, Berkeley."
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)v_itxt.c 10.13 (Berkeley) 4/27/96";
+static const char sccsid[] = "@(#)v_itxt.c 10.14 (Berkeley) 9/15/96";
#endif /* not lint */
#include <sys/types.h>
int isempty, lmode, rval;
char *bp, *p;
+ /*
+ * 'c' can be combined with motion commands that set the resulting
+ * cursor position, i.e. "cG". Clear the VM_RCM flags and make the
+ * resulting cursor position stick, inserting text has its own rules
+ * for cursor positioning.
+ */
+ F_CLR(vp, VM_RCM_MASK);
+ F_SET(vp, VM_RCM_SET);
+
/*
* Find out if the file is empty, it's easier to handle it as a
* special case.
LOG_CORRECT;
- /*
- * 'c' can be combined with motion commands that set the resulting
- * cursor position, i.e. "cG". Clear the VM_RCM flags and make the
- * resulting cursor position stick, inserting text has its own rules
- * for cursor positioning.
- */
- F_CLR(vp, VM_RCM_MASK);
- F_SET(vp, VM_RCM_SET);
-
/*
* If not in line mode and changing within a single line, copy the
* text and overwrite it.
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)v_txt.c 10.80 (Berkeley) 8/13/96";
+static const char sccsid[] = "@(#)v_txt.c 10.83 (Berkeley) 9/15/96";
#endif /* not lint */
#include <sys/types.h>
*/
if (quote == Q_BTHIS || quote == Q_VTHIS) {
FL_CLR(ec_flags, EC_QUOTED);
+ if (LF_ISSET(TXT_MAPINPUT))
+ FL_SET(ec_flags, EC_MAPINPUT);
if (quote == Q_BTHIS &&
(evp->e_value == K_VERASE || evp->e_value == K_VKILL)) {
abb = AB_NOTWORD; \
if (UNMAP_TST) \
txt_unmap(sp, tp, &ec_flags); \
- /* Delete any appended cursor. */ \
- if (LF_ISSET(TXT_APPENDEOL)) { \
+ /* \
+ * Delete any appended cursor. It's possible to get in \
+ * situations where TXT_APPENDEOL is set but tp->insert \
+ * is 0 when using the R command and all the characters \
+ * are tp->owrite characters. \
+ */ \
+ if (LF_ISSET(TXT_APPENDEOL) && tp->insert > 0) { \
--tp->len; \
--tp->insert; \
} \
/*
* Save the current line information for restoration in
- * txt_backup(). Set the new line length.
+ * txt_backup(), and set the line final length.
*/
tp->sv_len = tp->len;
tp->sv_cno = tp->cno;
owrite = 0;
}
- /* Set up bookkeeping for the new line. */
+ /*
+ * !!!
+ * Create a new line and insert the new TEXT into the queue.
+ * DON'T insert until the old line has been updated, or the
+ * inserted line count in line.c:db_get() will be wrong.
+ */
if ((ntp = text_init(sp, p,
insert + owrite, insert + owrite + 32)) == NULL)
goto err;
+ CIRCLEQ_INSERT_TAIL(&sp->tiq, ntp, q);
+
+ /* Set up bookkeeping for the new line. */
ntp->insert = insert;
ntp->owrite = owrite;
ntp->lno = tp->lno + 1;
++ntp->len;
}
- /*
- * Swap old and new TEXT's, and insert the new TEXT into the
- * queue.
- *
- * !!!
- * DON'T insert until the old line has been updated, or the
- * inserted line count in line.c:db_get() will be wrong.
- */
+ /* Swap old and new TEXT's, and update the new line. */
tp = ntp;
- CIRCLEQ_INSERT_TAIL(&sp->tiq, tp, q);
-
- /* Update the new line. */
if (vs_change(sp, tp->lno, LINE_INSERT))
goto err;
case K_VLNEXT: /* Quote next character. */
evp->e_c = '^';
quote = Q_VNEXT;
+ /*
+ * Turn on the quote flag so that the underlying routines
+ * quote the next character where it's possible. Turn off
+ * the input mapbiting flag so that we don't remap the next
+ * character.
+ */
FL_SET(ec_flags, EC_QUOTED);
+ FL_CLR(ec_flags, EC_MAPINPUT);
/*
* !!!
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)vs_refresh.c 10.39 (Berkeley) 8/17/96";
+static const char sccsid[] = "@(#)vs_refresh.c 10.41 (Berkeley) 9/15/96";
#endif /* not lint */
#include <sys/types.h>
* XXX
* This is fairly evil. Status lines are written using the vi message
* mechanism, since we have no idea how long they are. Since we may be
- * painting screens other than the current one, we don't want want to
- * make the user wait. We depend heavily on there not being any other
- * lines currently waiting to be displayed and the message truncation
- * code in the msgq_status routine working.
+ * painting screens other than the current one, we don't want to make
+ * the user wait. We depend heavily on there not being any other lines
+ * currently waiting to be displayed and the message truncation code in
+ * the msgq_status routine working.
*/
for (tsp = sp->gp->dq.cqh_first;
tsp != (void *)&sp->gp->dq; tsp = tsp->q.cqe_next)
didpaint = 1;
done_cursor:
-#ifdef DEBUG
/*
* Sanity checking. When the repainting code messes up, the usual
- * result is we don't repaint the cursor. Die now.
+ * result is we don't repaint the cursor and so sc_smap will be
+ * NULL. If we're debugging, die, otherwise restart from scratch.
*/
+#ifdef DEBUG
if (vip->sc_smap == NULL)
abort();
+#else
+ if (vip->sc_smap == NULL) {
+ F_SET(sp, SC_SCR_REFORMAT);
+ return (vs_paint(sp, flags));
+ }
#endif
/*