Make this compile under linux
This commit is contained in:
parent
41c6b0167f
commit
c3f0ff041d
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: readline.c,v 1.5 1998/12/12 19:54:16 christos Exp $ */
|
/* $NetBSD: readline.c,v 1.6 1999/06/12 18:58:05 christos Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||||
@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#if !defined(lint) && !defined(SCCSID)
|
#if !defined(lint) && !defined(SCCSID)
|
||||||
__RCSID("$NetBSD: readline.c,v 1.5 1998/12/12 19:54:16 christos Exp $");
|
__RCSID("$NetBSD: readline.c,v 1.6 1999/06/12 18:58:05 christos Exp $");
|
||||||
#endif /* not lint && not SCCSID */
|
#endif /* not lint && not SCCSID */
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -1169,10 +1169,10 @@ filename_completion_function(text, state)
|
|||||||
/* otherwise, get first entry where first */
|
/* otherwise, get first entry where first */
|
||||||
/* filename_len characters are equal */
|
/* filename_len characters are equal */
|
||||||
if (entry->d_name[0] == filename[0]
|
if (entry->d_name[0] == filename[0]
|
||||||
#ifndef __SVR4
|
#if defined(__SVR4) || defined(__linux__)
|
||||||
&& entry->d_namlen >= filename_len
|
|
||||||
#else
|
|
||||||
&& strlen(entry->d_name) >= filename_len
|
&& strlen(entry->d_name) >= filename_len
|
||||||
|
#else
|
||||||
|
&& entry->d_namlen >= filename_len
|
||||||
#endif
|
#endif
|
||||||
&& strncmp(entry->d_name, filename,
|
&& strncmp(entry->d_name, filename,
|
||||||
filename_len) == 0)
|
filename_len) == 0)
|
||||||
@ -1182,10 +1182,10 @@ filename_completion_function(text, state)
|
|||||||
if (entry) { /* match found */
|
if (entry) { /* match found */
|
||||||
|
|
||||||
struct stat stbuf;
|
struct stat stbuf;
|
||||||
#ifndef __SVR4
|
#if defined(__SVR4) || defined(__linux__)
|
||||||
len = entry->d_namlen +
|
|
||||||
#else
|
|
||||||
len = strlen(entry->d_name) +
|
len = strlen(entry->d_name) +
|
||||||
|
#else
|
||||||
|
len = entry->d_namlen +
|
||||||
#endif
|
#endif
|
||||||
((dirname) ? strlen(dirname) : 0) + 1 + 1;
|
((dirname) ? strlen(dirname) : 0) + 1 + 1;
|
||||||
temp = malloc(len);
|
temp = malloc(len);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: refresh.c,v 1.6 1999/02/05 20:53:50 christos Exp $ */
|
/* $NetBSD: refresh.c,v 1.7 1999/06/12 18:58:05 christos Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1992, 1993
|
* Copyright (c) 1992, 1993
|
||||||
@ -41,7 +41,7 @@
|
|||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)refresh.c 8.1 (Berkeley) 6/4/93";
|
static char sccsid[] = "@(#)refresh.c 8.1 (Berkeley) 6/4/93";
|
||||||
#else
|
#else
|
||||||
__RCSID("$NetBSD: refresh.c,v 1.6 1999/02/05 20:53:50 christos Exp $");
|
__RCSID("$NetBSD: refresh.c,v 1.7 1999/06/12 18:58:05 christos Exp $");
|
||||||
#endif
|
#endif
|
||||||
#endif /* not lint && not SCCSID */
|
#endif /* not lint && not SCCSID */
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ private void re__copy_and_pad __P((char *, char *, size_t));
|
|||||||
private void re_printstr __P((EditLine *, char *, char *,
|
private void re_printstr __P((EditLine *, char *, char *,
|
||||||
char *));
|
char *));
|
||||||
# define __F el->el_errfile
|
# define __F el->el_errfile
|
||||||
# define RE_DEBUG(a, b, c) do \
|
# define ELRE_DEBUG(a, b, c) do \
|
||||||
if (a) { \
|
if (a) { \
|
||||||
(void) fprintf b; \
|
(void) fprintf b; \
|
||||||
c; \
|
c; \
|
||||||
@ -86,13 +86,13 @@ re_printstr(el, str, f, t)
|
|||||||
char *str;
|
char *str;
|
||||||
char *f, *t;
|
char *f, *t;
|
||||||
{
|
{
|
||||||
RE_DEBUG(1,(__F, "%s:\"", str),);
|
ELRE_DEBUG(1,(__F, "%s:\"", str),);
|
||||||
while (f < t)
|
while (f < t)
|
||||||
RE_DEBUG(1,(__F, "%c", *f++ & 0177),);
|
ELRE_DEBUG(1,(__F, "%c", *f++ & 0177),);
|
||||||
RE_DEBUG(1,(__F, "\"\r\n"),);
|
ELRE_DEBUG(1,(__F, "\"\r\n"),);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
# define RE_DEBUG(a, b, c)
|
# define ELRE_DEBUG(a, b, c)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -146,7 +146,7 @@ re_putc(el, c)
|
|||||||
EditLine *el;
|
EditLine *el;
|
||||||
int c;
|
int c;
|
||||||
{
|
{
|
||||||
RE_DEBUG(1,(__F, "printing %3.3o '%c'\r\n", c, c),);
|
ELRE_DEBUG(1,(__F, "printing %3.3o '%c'\r\n", c, c),);
|
||||||
|
|
||||||
el->el_vdisplay[el->el_refresh.r_cursor.v][el->el_refresh.r_cursor.h] = c;
|
el->el_vdisplay[el->el_refresh.r_cursor.v][el->el_refresh.r_cursor.h] = c;
|
||||||
el->el_refresh.r_cursor.h++; /* advance to next place */
|
el->el_refresh.r_cursor.h++; /* advance to next place */
|
||||||
@ -155,7 +155,7 @@ re_putc(el, c)
|
|||||||
/* assure end of line */
|
/* assure end of line */
|
||||||
el->el_refresh.r_cursor.h = 0; /* reset it. */
|
el->el_refresh.r_cursor.h = 0; /* reset it. */
|
||||||
el->el_refresh.r_cursor.v++;
|
el->el_refresh.r_cursor.v++;
|
||||||
RE_DEBUG(el->el_refresh.r_cursor.v >= el->el_term.t_size.v,
|
ELRE_DEBUG(el->el_refresh.r_cursor.v >= el->el_term.t_size.v,
|
||||||
(__F, "\r\nre_putc: overflow! r_cursor.v == %d > %d\r\n",
|
(__F, "\r\nre_putc: overflow! r_cursor.v == %d > %d\r\n",
|
||||||
el->el_refresh.r_cursor.v, el->el_term.t_size.v), abort());
|
el->el_refresh.r_cursor.v, el->el_term.t_size.v), abort());
|
||||||
}
|
}
|
||||||
@ -176,7 +176,7 @@ re_refresh(el)
|
|||||||
char *cp;
|
char *cp;
|
||||||
coord_t cur;
|
coord_t cur;
|
||||||
|
|
||||||
RE_DEBUG(1,(__F, "el->el_line.buffer = :%s:\r\n", el->el_line.buffer),);
|
ELRE_DEBUG(1,(__F, "el->el_line.buffer = :%s:\r\n", el->el_line.buffer),);
|
||||||
|
|
||||||
/* reset the Drawing cursor */
|
/* reset the Drawing cursor */
|
||||||
el->el_refresh.r_cursor.h = 0;
|
el->el_refresh.r_cursor.h = 0;
|
||||||
@ -204,12 +204,12 @@ re_refresh(el)
|
|||||||
el->el_refresh.r_newcv = el->el_refresh.r_cursor.v;
|
el->el_refresh.r_newcv = el->el_refresh.r_cursor.v;
|
||||||
re_putc(el, '\0'); /* put NUL on end */
|
re_putc(el, '\0'); /* put NUL on end */
|
||||||
|
|
||||||
RE_DEBUG(1,(__F,
|
ELRE_DEBUG(1,(__F,
|
||||||
"term.h=%d vcur.h=%d vcur.v=%d vdisplay[0]=\r\n:%80.80s:\r\n",
|
"term.h=%d vcur.h=%d vcur.v=%d vdisplay[0]=\r\n:%80.80s:\r\n",
|
||||||
el->el_term.t_size.h, el->el_refresh.r_cursor.h,
|
el->el_term.t_size.h, el->el_refresh.r_cursor.h,
|
||||||
el->el_refresh.r_cursor.v, el->el_vdisplay[0]),);
|
el->el_refresh.r_cursor.v, el->el_vdisplay[0]),);
|
||||||
|
|
||||||
RE_DEBUG(1,(__F, "updating %d lines.\r\n", el->el_refresh.r_newcv),);
|
ELRE_DEBUG(1,(__F, "updating %d lines.\r\n", el->el_refresh.r_newcv),);
|
||||||
for (i = 0; i <= el->el_refresh.r_newcv; i++) {
|
for (i = 0; i <= el->el_refresh.r_newcv; i++) {
|
||||||
/* NOTE THAT re_update_line MAY CHANGE el_display[i] */
|
/* NOTE THAT re_update_line MAY CHANGE el_display[i] */
|
||||||
re_update_line(el, el->el_display[i], el->el_vdisplay[i], i);
|
re_update_line(el, el->el_display[i], el->el_vdisplay[i], i);
|
||||||
@ -223,7 +223,7 @@ re_refresh(el)
|
|||||||
re__copy_and_pad(el->el_display[i], el->el_vdisplay[i],
|
re__copy_and_pad(el->el_display[i], el->el_vdisplay[i],
|
||||||
(size_t)el->el_term.t_size.h);
|
(size_t)el->el_term.t_size.h);
|
||||||
}
|
}
|
||||||
RE_DEBUG(1,(__F,
|
ELRE_DEBUG(1,(__F,
|
||||||
"\r\nel->el_refresh.r_cursor.v=%d,el->el_refresh.r_oldcv=%d i=%d\r\n",
|
"\r\nel->el_refresh.r_cursor.v=%d,el->el_refresh.r_oldcv=%d i=%d\r\n",
|
||||||
el->el_refresh.r_cursor.v, el->el_refresh.r_oldcv, i),);
|
el->el_refresh.r_cursor.v, el->el_refresh.r_oldcv, i),);
|
||||||
|
|
||||||
@ -239,7 +239,7 @@ re_refresh(el)
|
|||||||
}
|
}
|
||||||
|
|
||||||
el->el_refresh.r_oldcv = el->el_refresh.r_newcv; /* set for next time */
|
el->el_refresh.r_oldcv = el->el_refresh.r_newcv; /* set for next time */
|
||||||
RE_DEBUG(1,(__F,
|
ELRE_DEBUG(1,(__F,
|
||||||
"\r\ncursor.h = %d, cursor.v = %d, cur.h = %d, cur.v = %d\r\n",
|
"\r\ncursor.h = %d, cursor.v = %d, cur.h = %d, cur.v = %d\r\n",
|
||||||
el->el_refresh.r_cursor.h, el->el_refresh.r_cursor.v,
|
el->el_refresh.r_cursor.h, el->el_refresh.r_cursor.v,
|
||||||
cur.h, cur.v),);
|
cur.h, cur.v),);
|
||||||
@ -283,9 +283,9 @@ re_insert(el, d, dat, dlen, s, num)
|
|||||||
if (num > dlen - dat)
|
if (num > dlen - dat)
|
||||||
num = dlen - dat;
|
num = dlen - dat;
|
||||||
|
|
||||||
RE_DEBUG(1,(__F, "re_insert() starting: %d at %d max %d, d == \"%s\"\n",
|
ELRE_DEBUG(1,(__F, "re_insert() starting: %d at %d max %d, d == \"%s\"\n",
|
||||||
num, dat, dlen, d),);
|
num, dat, dlen, d),);
|
||||||
RE_DEBUG(1,(__F, "s == \"%s\"n", s),);
|
ELRE_DEBUG(1,(__F, "s == \"%s\"n", s),);
|
||||||
|
|
||||||
/* open up the space for num chars */
|
/* open up the space for num chars */
|
||||||
if (num > 0) {
|
if (num > 0) {
|
||||||
@ -295,18 +295,18 @@ re_insert(el, d, dat, dlen, s, num)
|
|||||||
*b-- = *a--;
|
*b-- = *a--;
|
||||||
d[dlen] = '\0'; /* just in case */
|
d[dlen] = '\0'; /* just in case */
|
||||||
}
|
}
|
||||||
RE_DEBUG(1,(__F,
|
ELRE_DEBUG(1,(__F,
|
||||||
"re_insert() after insert: %d at %d max %d, d == \"%s\"\n",
|
"re_insert() after insert: %d at %d max %d, d == \"%s\"\n",
|
||||||
num, dat, dlen, d),);
|
num, dat, dlen, d),);
|
||||||
RE_DEBUG(1,(__F, "s == \"%s\"n", s),);
|
ELRE_DEBUG(1,(__F, "s == \"%s\"n", s),);
|
||||||
|
|
||||||
/* copy the characters */
|
/* copy the characters */
|
||||||
for (a = d + dat; (a < d + dlen) && (num > 0); num--)
|
for (a = d + dat; (a < d + dlen) && (num > 0); num--)
|
||||||
*a++ = *s++;
|
*a++ = *s++;
|
||||||
|
|
||||||
RE_DEBUG(1,(__F, "re_insert() after copy: %d at %d max %d, %s == \"%s\"\n",
|
ELRE_DEBUG(1,(__F, "re_insert() after copy: %d at %d max %d, %s == \"%s\"\n",
|
||||||
num, dat, dlen, d, s),);
|
num, dat, dlen, d, s),);
|
||||||
RE_DEBUG(1,(__F, "s == \"%s\"n", s),);
|
ELRE_DEBUG(1,(__F, "s == \"%s\"n", s),);
|
||||||
} /* end re_insert */
|
} /* end re_insert */
|
||||||
|
|
||||||
|
|
||||||
@ -329,7 +329,7 @@ re_delete(el, d, dat, dlen, num)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RE_DEBUG(1,(__F, "re_delete() starting: %d at %d max %d, d == \"%s\"\n",
|
ELRE_DEBUG(1,(__F, "re_delete() starting: %d at %d max %d, d == \"%s\"\n",
|
||||||
num, dat, dlen, d),);
|
num, dat, dlen, d),);
|
||||||
|
|
||||||
/* open up the space for num chars */
|
/* open up the space for num chars */
|
||||||
@ -340,7 +340,7 @@ re_delete(el, d, dat, dlen, num)
|
|||||||
*b++ = *a++;
|
*b++ = *a++;
|
||||||
d[dlen] = '\0'; /* just in case */
|
d[dlen] = '\0'; /* just in case */
|
||||||
}
|
}
|
||||||
RE_DEBUG(1,(__F, "re_delete() after delete: %d at %d max %d, d == \"%s\"\n",
|
ELRE_DEBUG(1,(__F, "re_delete() after delete: %d at %d max %d, d == \"%s\"\n",
|
||||||
num, dat, dlen, d),);
|
num, dat, dlen, d),);
|
||||||
} /* end re_delete */
|
} /* end re_delete */
|
||||||
|
|
||||||
@ -434,7 +434,7 @@ re_update_line(el, old, new, i)
|
|||||||
* if no diff, continue to next line of redraw
|
* if no diff, continue to next line of redraw
|
||||||
*/
|
*/
|
||||||
if (*ofd == '\0' && *nfd == '\0') {
|
if (*ofd == '\0' && *nfd == '\0') {
|
||||||
RE_DEBUG(1,(__F, "no difference.\r\n"),);
|
ELRE_DEBUG(1,(__F, "no difference.\r\n"),);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -575,14 +575,14 @@ re_update_line(el, old, new, i)
|
|||||||
fx = (nsb - nfd) - (osb - ofd);
|
fx = (nsb - nfd) - (osb - ofd);
|
||||||
sx = (nls - nse) - (ols - ose);
|
sx = (nls - nse) - (ols - ose);
|
||||||
|
|
||||||
RE_DEBUG(1,(__F, "\n"),);
|
ELRE_DEBUG(1,(__F, "\n"),);
|
||||||
RE_DEBUG(1,(__F, "ofd %d, osb %d, ose %d, ols %d, oe %d\n",
|
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),);
|
ofd - old, osb - old, ose - old, ols - old, oe - old),);
|
||||||
RE_DEBUG(1,(__F, "nfd %d, nsb %d, nse %d, nls %d, ne %d\n",
|
ELRE_DEBUG(1,(__F, "nfd %d, nsb %d, nse %d, nls %d, ne %d\n",
|
||||||
nfd - new, nsb - new, nse - new, nls - new, ne - new),);
|
nfd - new, nsb - new, nse - new, nls - new, ne - new),);
|
||||||
RE_DEBUG(1,(__F,
|
ELRE_DEBUG(1,(__F,
|
||||||
"xxx-xxx:\"00000000001111111111222222222233333333334\"\r\n"),);
|
"xxx-xxx:\"00000000001111111111222222222233333333334\"\r\n"),);
|
||||||
RE_DEBUG(1,(__F,
|
ELRE_DEBUG(1,(__F,
|
||||||
"xxx-xxx:\"01234567890123456789012345678901234567890\"\r\n"),);
|
"xxx-xxx:\"01234567890123456789012345678901234567890\"\r\n"),);
|
||||||
#ifdef DEBUG_REFRESH
|
#ifdef DEBUG_REFRESH
|
||||||
re_printstr(el, "old- oe", old, oe);
|
re_printstr(el, "old- oe", old, oe);
|
||||||
@ -646,7 +646,7 @@ re_update_line(el, old, new, i)
|
|||||||
* We need to delete characters! else No insert or delete
|
* We need to delete characters! else No insert or delete
|
||||||
*/
|
*/
|
||||||
if ((nsb != nfd) && fx > 0 && ((p - old) + fx <= el->el_term.t_size.h)) {
|
if ((nsb != nfd) && fx > 0 && ((p - old) + fx <= el->el_term.t_size.h)) {
|
||||||
RE_DEBUG(1,(__F, "first diff insert at %d...\r\n", nfd - new),);
|
ELRE_DEBUG(1,(__F, "first diff insert at %d...\r\n", nfd - new),);
|
||||||
/*
|
/*
|
||||||
* Move to the first char to insert, where the first diff is.
|
* Move to the first char to insert, where the first diff is.
|
||||||
*/
|
*/
|
||||||
@ -655,12 +655,12 @@ re_update_line(el, old, new, i)
|
|||||||
* Check if we have stuff to keep at end
|
* Check if we have stuff to keep at end
|
||||||
*/
|
*/
|
||||||
if (nsb != ne) {
|
if (nsb != ne) {
|
||||||
RE_DEBUG(1,(__F, "with stuff to keep at end\r\n"),);
|
ELRE_DEBUG(1,(__F, "with stuff to keep at end\r\n"),);
|
||||||
/*
|
/*
|
||||||
* insert fx chars of new starting at nfd
|
* insert fx chars of new starting at nfd
|
||||||
*/
|
*/
|
||||||
if (fx > 0) {
|
if (fx > 0) {
|
||||||
RE_DEBUG(!EL_CAN_INSERT,
|
ELRE_DEBUG(!EL_CAN_INSERT,
|
||||||
(__F, "ERROR: cannot insert in early first diff\n"),);
|
(__F, "ERROR: cannot insert in early first diff\n"),);
|
||||||
term_insertwrite(el, nfd, fx);
|
term_insertwrite(el, nfd, fx);
|
||||||
re_insert(el, old, ofd - old, el->el_term.t_size.h, nfd, fx);
|
re_insert(el, old, ofd - old, el->el_term.t_size.h, nfd, fx);
|
||||||
@ -672,7 +672,7 @@ re_update_line(el, old, new, i)
|
|||||||
re__strncopy(ofd + fx, nfd + fx, (size_t)((nsb - nfd) - fx));
|
re__strncopy(ofd + fx, nfd + fx, (size_t)((nsb - nfd) - fx));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
RE_DEBUG(1,(__F, "without anything to save\r\n"),);
|
ELRE_DEBUG(1,(__F, "without anything to save\r\n"),);
|
||||||
term_overwrite(el, nfd, (nsb - nfd));
|
term_overwrite(el, nfd, (nsb - nfd));
|
||||||
re__strncopy(ofd, nfd, (size_t)(nsb - nfd));
|
re__strncopy(ofd, nfd, (size_t)(nsb - nfd));
|
||||||
/*
|
/*
|
||||||
@ -682,7 +682,7 @@ re_update_line(el, old, new, i)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (fx < 0) {
|
else if (fx < 0) {
|
||||||
RE_DEBUG(1,(__F, "first diff delete at %d...\r\n", ofd - old),);
|
ELRE_DEBUG(1,(__F, "first diff delete at %d...\r\n", ofd - old),);
|
||||||
/*
|
/*
|
||||||
* move to the first char to delete where the first diff is
|
* move to the first char to delete where the first diff is
|
||||||
*/
|
*/
|
||||||
@ -691,13 +691,13 @@ re_update_line(el, old, new, i)
|
|||||||
* Check if we have stuff to save
|
* Check if we have stuff to save
|
||||||
*/
|
*/
|
||||||
if (osb != oe) {
|
if (osb != oe) {
|
||||||
RE_DEBUG(1,(__F, "with stuff to save at end\r\n"),);
|
ELRE_DEBUG(1,(__F, "with stuff to save at end\r\n"),);
|
||||||
/*
|
/*
|
||||||
* fx is less than zero *always* here but we check for code
|
* fx is less than zero *always* here but we check for code
|
||||||
* symmetry
|
* symmetry
|
||||||
*/
|
*/
|
||||||
if (fx < 0) {
|
if (fx < 0) {
|
||||||
RE_DEBUG(!EL_CAN_DELETE,
|
ELRE_DEBUG(!EL_CAN_DELETE,
|
||||||
(__F, "ERROR: cannot delete in first diff\n"),);
|
(__F, "ERROR: cannot delete in first diff\n"),);
|
||||||
term_deletechars(el, -fx);
|
term_deletechars(el, -fx);
|
||||||
re_delete(el, old, ofd - old, el->el_term.t_size.h, -fx);
|
re_delete(el, old, ofd - old, el->el_term.t_size.h, -fx);
|
||||||
@ -710,12 +710,12 @@ re_update_line(el, old, new, i)
|
|||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
RE_DEBUG(1,(__F, "but with nothing left to save\r\n"),);
|
ELRE_DEBUG(1,(__F, "but with nothing left to save\r\n"),);
|
||||||
/*
|
/*
|
||||||
* write (nsb-nfd) chars of new starting at nfd
|
* write (nsb-nfd) chars of new starting at nfd
|
||||||
*/
|
*/
|
||||||
term_overwrite(el, nfd, (nsb - nfd));
|
term_overwrite(el, nfd, (nsb - nfd));
|
||||||
RE_DEBUG(1,(__F, "cleareol %d\n", (oe - old) - (ne - new)),);
|
ELRE_DEBUG(1,(__F, "cleareol %d\n", (oe - old) - (ne - new)),);
|
||||||
term_clear_EOL(el, (oe - old) - (ne - new));
|
term_clear_EOL(el, (oe - old) - (ne - new));
|
||||||
/*
|
/*
|
||||||
* Done
|
* Done
|
||||||
@ -727,7 +727,7 @@ re_update_line(el, old, new, i)
|
|||||||
fx = 0;
|
fx = 0;
|
||||||
|
|
||||||
if (sx < 0) {
|
if (sx < 0) {
|
||||||
RE_DEBUG(1,(__F, "second diff delete at %d...\r\n", (ose - old) + fx),);
|
ELRE_DEBUG(1,(__F, "second diff delete at %d...\r\n", (ose - old) + fx),);
|
||||||
/*
|
/*
|
||||||
* Check if we have stuff to delete
|
* Check if we have stuff to delete
|
||||||
*/
|
*/
|
||||||
@ -740,12 +740,12 @@ re_update_line(el, old, new, i)
|
|||||||
* Check if we have stuff to save
|
* Check if we have stuff to save
|
||||||
*/
|
*/
|
||||||
if (ols != oe) {
|
if (ols != oe) {
|
||||||
RE_DEBUG(1,(__F, "with stuff to save at end\r\n"),);
|
ELRE_DEBUG(1,(__F, "with stuff to save at end\r\n"),);
|
||||||
/*
|
/*
|
||||||
* Again a duplicate test.
|
* Again a duplicate test.
|
||||||
*/
|
*/
|
||||||
if (sx < 0) {
|
if (sx < 0) {
|
||||||
RE_DEBUG(!EL_CAN_DELETE,
|
ELRE_DEBUG(!EL_CAN_DELETE,
|
||||||
(__F, "ERROR: cannot delete in second diff\n"),);
|
(__F, "ERROR: cannot delete in second diff\n"),);
|
||||||
term_deletechars(el, -sx);
|
term_deletechars(el, -sx);
|
||||||
}
|
}
|
||||||
@ -756,9 +756,9 @@ re_update_line(el, old, new, i)
|
|||||||
term_overwrite(el, nse, (nls - nse));
|
term_overwrite(el, nse, (nls - nse));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
RE_DEBUG(1,(__F, "but with nothing left to save\r\n"),);
|
ELRE_DEBUG(1,(__F, "but with nothing left to save\r\n"),);
|
||||||
term_overwrite(el, nse, (nls - nse));
|
term_overwrite(el, nse, (nls - nse));
|
||||||
RE_DEBUG(1,(__F, "cleareol %d\n", (oe - old) - (ne - new)),);
|
ELRE_DEBUG(1,(__F, "cleareol %d\n", (oe - old) - (ne - new)),);
|
||||||
term_clear_EOL(el, (oe - old) - (ne - new));
|
term_clear_EOL(el, (oe - old) - (ne - new));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -767,14 +767,14 @@ re_update_line(el, old, new, i)
|
|||||||
* if we have a first insert AND WE HAVEN'T ALREADY DONE IT...
|
* if we have a first insert AND WE HAVEN'T ALREADY DONE IT...
|
||||||
*/
|
*/
|
||||||
if ((nsb != nfd) && (osb - ofd) <= (nsb - nfd) && (fx == 0)) {
|
if ((nsb != nfd) && (osb - ofd) <= (nsb - nfd) && (fx == 0)) {
|
||||||
RE_DEBUG(1,(__F, "late first diff insert at %d...\r\n", nfd - new),);
|
ELRE_DEBUG(1,(__F, "late first diff insert at %d...\r\n", nfd - new),);
|
||||||
|
|
||||||
term_move_to_char(el, nfd - new);
|
term_move_to_char(el, nfd - new);
|
||||||
/*
|
/*
|
||||||
* Check if we have stuff to keep at the end
|
* Check if we have stuff to keep at the end
|
||||||
*/
|
*/
|
||||||
if (nsb != ne) {
|
if (nsb != ne) {
|
||||||
RE_DEBUG(1,(__F, "with stuff to keep at end\r\n"),);
|
ELRE_DEBUG(1,(__F, "with stuff to keep at end\r\n"),);
|
||||||
/*
|
/*
|
||||||
* We have to recalculate fx here because we set it
|
* We have to recalculate fx here because we set it
|
||||||
* to zero above as a flag saying that we hadn't done
|
* to zero above as a flag saying that we hadn't done
|
||||||
@ -785,7 +785,7 @@ re_update_line(el, old, new, i)
|
|||||||
/*
|
/*
|
||||||
* insert fx chars of new starting at nfd
|
* insert fx chars of new starting at nfd
|
||||||
*/
|
*/
|
||||||
RE_DEBUG(!EL_CAN_INSERT,
|
ELRE_DEBUG(!EL_CAN_INSERT,
|
||||||
(__F, "ERROR: cannot insert in late first diff\n"),);
|
(__F, "ERROR: cannot insert in late first diff\n"),);
|
||||||
term_insertwrite(el, nfd, fx);
|
term_insertwrite(el, nfd, fx);
|
||||||
re_insert(el, old, ofd - old, el->el_term.t_size.h, nfd, fx);
|
re_insert(el, old, ofd - old, el->el_term.t_size.h, nfd, fx);
|
||||||
@ -798,7 +798,7 @@ re_update_line(el, old, new, i)
|
|||||||
re__strncopy(ofd + fx, nfd + fx, (size_t)((nsb - nfd) - fx));
|
re__strncopy(ofd + fx, nfd + fx, (size_t)((nsb - nfd) - fx));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
RE_DEBUG(1,(__F, "without anything to save\r\n"),);
|
ELRE_DEBUG(1,(__F, "without anything to save\r\n"),);
|
||||||
term_overwrite(el, nfd, (nsb - nfd));
|
term_overwrite(el, nfd, (nsb - nfd));
|
||||||
re__strncopy(ofd, nfd, (size_t)(nsb - nfd));
|
re__strncopy(ofd, nfd, (size_t)(nsb - nfd));
|
||||||
}
|
}
|
||||||
@ -808,13 +808,13 @@ re_update_line(el, old, new, i)
|
|||||||
* line is now NEW up to nse
|
* line is now NEW up to nse
|
||||||
*/
|
*/
|
||||||
if (sx >= 0) {
|
if (sx >= 0) {
|
||||||
RE_DEBUG(1,(__F, "second diff insert at %d...\r\n", nse - new),);
|
ELRE_DEBUG(1,(__F, "second diff insert at %d...\r\n", nse - new),);
|
||||||
term_move_to_char(el, nse - new);
|
term_move_to_char(el, nse - new);
|
||||||
if (ols != oe) {
|
if (ols != oe) {
|
||||||
RE_DEBUG(1,(__F, "with stuff to keep at end\r\n"),);
|
ELRE_DEBUG(1,(__F, "with stuff to keep at end\r\n"),);
|
||||||
if (sx > 0) {
|
if (sx > 0) {
|
||||||
/* insert sx chars of new starting at nse */
|
/* insert sx chars of new starting at nse */
|
||||||
RE_DEBUG(!EL_CAN_INSERT,
|
ELRE_DEBUG(!EL_CAN_INSERT,
|
||||||
(__F, "ERROR: cannot insert in second diff\n"),);
|
(__F, "ERROR: cannot insert in second diff\n"),);
|
||||||
term_insertwrite(el, nse, sx);
|
term_insertwrite(el, nse, sx);
|
||||||
}
|
}
|
||||||
@ -825,7 +825,7 @@ re_update_line(el, old, new, i)
|
|||||||
term_overwrite(el, nse + sx, (nls - nse) - sx);
|
term_overwrite(el, nse + sx, (nls - nse) - sx);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
RE_DEBUG(1,(__F, "without anything to save\r\n"),);
|
ELRE_DEBUG(1,(__F, "without anything to save\r\n"),);
|
||||||
term_overwrite(el, nse, (nls - nse));
|
term_overwrite(el, nse, (nls - nse));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -835,7 +835,7 @@ re_update_line(el, old, new, i)
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RE_DEBUG(1,(__F, "done.\r\n"),);
|
ELRE_DEBUG(1,(__F, "done.\r\n"),);
|
||||||
} /* re_update_line */
|
} /* re_update_line */
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user