From c9c918fa86d614c71ce3d8af41e116ac2febb055 Mon Sep 17 00:00:00 2001 From: in2 Date: Thu, 10 Apr 2003 05:43:44 +0000 Subject: fix bug, add debug information if DEBUG git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@784 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/edit.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'mbbsd') diff --git a/mbbsd/edit.c b/mbbsd/edit.c index a30b92cb..731f5177 100644 --- a/mbbsd/edit.c +++ b/mbbsd/edit.c @@ -1,9 +1,12 @@ -/* $Id: edit.c,v 1.28 2003/04/09 11:43:35 in2 Exp $ */ +/* $Id: edit.c,v 1.29 2003/04/10 05:43:44 in2 Exp $ */ #include "bbs.h" typedef struct textline_t { struct textline_t *prev; struct textline_t *next; - int len; + short len; +#ifdef DEBUG + short mlength; +#endif char data[1]; } textline_t; @@ -176,6 +179,9 @@ alloc_line(short length) if ((p = (textline_t *) malloc(length + sizeof(textline_t)))) { memset(p, 0, length + sizeof(textline_t)); +#ifdef DEBUG + p->mlength = length; +#endif return p; } indigestion(13); @@ -269,6 +275,9 @@ adjustline(textline_t *oldp, short len) newp = alloc_line(len); memcpy(newp, tmpl, len + sizeof(textline_t)); +#ifdef DEBUG + newp->mlength = len; +#endif if( oldp == firstline ) firstline = newp; if( oldp == lastline ) lastline = newp; if( oldp == currline ) currline = newp; @@ -2198,6 +2207,7 @@ vedit(char *fpath, int saveheader, int *islocal) curr_window_line--; currln--; currline = currline->prev; + currline = adjustline(currline, WRAPMARGIN); currpnt = currline->len; redraw_everything = YEA; if (*killsp(currline->next->data) == '\0') { -- cgit v1.2.3