From 9ab044ab08421d2ccda42fed75fe55c92a59adf6 Mon Sep 17 00:00:00 2001 From: victor Date: Sun, 27 Feb 2005 13:26:43 +0000 Subject: fix illegal top_of_win, and add comment on oldcurrline git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2558 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/edit.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/mbbsd/edit.c b/mbbsd/edit.c index 3188a027..6b85c748 100644 --- a/mbbsd/edit.c +++ b/mbbsd/edit.c @@ -94,6 +94,13 @@ enum { * editor_internal_t。enter_edit_buffer 跟 exit_edit_buffer 提供進出的介面, * 裡面分別會呼叫 constructor 跟 destructor。 * + * TODO + * vedit 裡面有個 oldcurrline,用來記上一次的 currline。由於只有 currline 擁 + * 有 WRAPMARGIN 的空間,所以目前的作法是當 oldcurrline != currline 時,就 + * resize oldcurrline 跟 currline。但是糟糕的是目前必須人工追蹤 currline 的行 + * 為,而且若不幸遇到 oldcurrline 指到的那一行已經被 free 掉,就完了。最好是 + * 把這些東西包起來。不過我沒空做了,patch is welcome :P + * * Victor Hsieh * Thu, 03 Feb 2005 15:18:00 +0800 */ @@ -2890,7 +2897,13 @@ vedit(char *fpath, int saveheader, int *islocal) curr_buf->currpnt = curr_buf->currline->len; curr_buf->redraw_everything = YEA; if (*next_non_space_char(curr_buf->currline->next->data) == '\0') { - delete_line(curr_buf->currline->next, 0); + if (curr_buf->currline->next == curr_buf->top_of_win) { + delete_line(curr_buf->currline->next, 0); + curr_buf->top_of_win = curr_buf->currline; + curr_buf->curr_window_line = 0; + } + else + delete_line(curr_buf->currline->next, 0); break; } p = curr_buf->currline; -- cgit v1.2.3