Import nvi2 2.1.2-95773e17e2751.

This commit is contained in:
Peter Wemm 2013-11-11 16:38:34 +00:00
parent be3e4646ee
commit 44e7e21f38
7 changed files with 2365 additions and 1155 deletions

4
README
View File

@ -1,6 +1,6 @@
# $Id: README,v 9.0 2012/10/07 09:13:54 zy Exp $ # $Id: README,v 9.1 2013/11/02 02:50:23 zy Exp $
This is version 2.1.1 (2012-10-07) of nex/nvi, a reimplementation of the ex/vi This is version 2.1.2 (2012-11-02) of nex/nvi, a reimplementation of the ex/vi
text editors originally distributed as part of the Fourth Berkeley text editors originally distributed as part of the Fourth Berkeley
Software Distribution (4BSD), by the University of California, Berkeley. Software Distribution (4BSD), by the University of California, Berkeley.

View File

@ -2,12 +2,38 @@
* Copyright (c) 1992, 1993, 1994 * Copyright (c) 1992, 1993, 1994
* The Regents of the University of California. All rights reserved. * The Regents of the University of California. All rights reserved.
* *
* %sccs.include.redist.c% * 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 disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/ */
#ifndef lint #ifndef lint
static char copyright[] = static char copyright[] =
"%Z% Copyright (c) 1992, 1993, 1994\n\ "@(#) Copyright (c) 1992, 1993, 1994\n\
The Regents of the University of California. All rights reserved.\n"; The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */ #endif /* not lint */

View File

@ -11,9 +11,9 @@
#ifndef lint #ifndef lint
static const char copyright[] = static const char copyright[] =
"%Z% Copyright (c) 1992, 1993, 1994\n\ "@(#) Copyright (c) 1992, 1993, 1994\n\
The Regents of the University of California. All rights reserved.\n\ The Regents of the University of California. All rights reserved.\n\
%Z% Copyright (c) 1992, 1993, 1994, 1995, 1996\n\ @(#) Copyright (c) 1992, 1993, 1994, 1995, 1996\n\
Keith Bostic. All rights reserved.\n"; Keith Bostic. All rights reserved.\n";
#endif /* not lint */ #endif /* not lint */

File diff suppressed because it is too large Load Diff

View File

@ -10,7 +10,7 @@
#include "config.h" #include "config.h"
#ifndef lint #ifndef lint
static const char sccsid[] = "$Id: ex_print.c,v 10.25 2011/12/12 22:12:20 zy Exp $"; static const char sccsid[] = "$Id: ex_print.c,v 10.26 2013/11/02 02:11:07 zy Exp $";
#endif /* not lint */ #endif /* not lint */
#include <sys/types.h> #include <sys/types.h>
@ -213,7 +213,7 @@ ex_prchars(SCR *sp, const CHAR_T *p, size_t *colp, size_t len,
gp = sp->gp; gp = sp->gp;
ts = O_VAL(sp, O_TABSTOP); ts = O_VAL(sp, O_TABSTOP);
for (col = *colp; len--;) for (col = *colp; len--;)
if ((ch = *p++) == '\t' && !LF_ISSET(E_C_LIST)) if ((ch = *p++) == L('\t') && !LF_ISSET(E_C_LIST))
for (tlen = ts - col % ts; for (tlen = ts - col % ts;
col < sp->cols && tlen--; ++col) { col < sp->cols && tlen--; ++col) {
(void)ex_printf(sp, (void)ex_printf(sp,
@ -223,20 +223,31 @@ ex_prchars(SCR *sp, const CHAR_T *p, size_t *colp, size_t len,
} }
else { else {
kp = KEY_NAME(sp, ch); kp = KEY_NAME(sp, ch);
tlen = KEY_LEN(sp, ch); tlen = KEY_COL(sp, ch);
if (!repeatc && col + tlen < sp->cols) {
(void)ex_puts(sp, kp); /*
col += tlen; * Start a new line if the last character does not fit
} else * into the current line. The implicit new lines are
for (; tlen--; ++kp, ++col) { * not interruptible.
if (col == sp->cols) { */
if (col + tlen > sp->cols) {
col = 0; col = 0;
(void)ex_puts(sp, "\n"); (void)ex_puts(sp, "\n");
} }
(void)ex_printf(sp,
"%c", repeatc ? repeatc : *kp); col += tlen;
if (!repeatc) {
(void)ex_puts(sp, kp);
if (INTERRUPTED(sp)) if (INTERRUPTED(sp))
goto intr; goto intr;
} else while (tlen--) {
(void)ex_printf(sp, "%c", repeatc);
if (INTERRUPTED(sp))
goto intr;
}
if (col == sp->cols) {
col = 0;
(void)ex_puts(sp, "\n");
} }
} }
intr: *colp = col; intr: *colp = col;

View File

@ -295,7 +295,8 @@ v_txt(
tiqh = sp->tiq; tiqh = sp->tiq;
if (!TAILQ_EMPTY(tiqh)) { if (!TAILQ_EMPTY(tiqh)) {
tp = TAILQ_FIRST(tiqh); tp = TAILQ_FIRST(tiqh);
if (TAILQ_NEXT(tp, q) != NULL || tp->lb_len < len + 32) { if (TAILQ_NEXT(tp, q) != NULL ||
tp->lb_len < (len + 32) * sizeof(CHAR_T)) {
text_lfree(tiqh); text_lfree(tiqh);
goto newtp; goto newtp;
} }

View File

@ -10,7 +10,7 @@
#include "config.h" #include "config.h"
#ifndef lint #ifndef lint
static const char sccsid[] = "$Id: vs_refresh.c,v 10.52 2011/12/16 11:06:25 zy Exp $"; static const char sccsid[] = "$Id: vs_refresh.c,v 10.53 2013/11/01 11:57:36 zy Exp $";
#endif /* not lint */ #endif /* not lint */
#include <sys/types.h> #include <sys/types.h>
@ -331,7 +331,8 @@ small_fill: (void)gp->scr_move(sp, LASTLINE(sp), 0);
if (vs_sm_1down(sp)) if (vs_sm_1down(sp))
return (1); return (1);
goto adjust; goto adjust;
} } else
goto top; /* XXX No such line. */
/* /*
* If less than a half screen from the bottom of the file, * If less than a half screen from the bottom of the file,