From fc6ddbeabfc2f4cc53ea08b5095cb217a270f3bc Mon Sep 17 00:00:00 2001 From: piaip Date: Wed, 20 Apr 2005 14:25:35 +0000 Subject: make it more clear to prevent accidents. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2704 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/edit.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'mbbsd') diff --git a/mbbsd/edit.c b/mbbsd/edit.c index db2fdea7..9e4ebc4d 100644 --- a/mbbsd/edit.c +++ b/mbbsd/edit.c @@ -2442,21 +2442,22 @@ vedit(char *fpath, int saveheader, int *islocal) if (*fpath) { read_file(fpath); - curr_buf->firstline = adjustline(curr_buf->firstline, WRAPMARGIN); } if (*quote_file) { do_quote(); *quote_file = '\0'; - curr_buf->firstline = adjustline(curr_buf->firstline, WRAPMARGIN); } /* No matter you quote or not, just start the cursor from (0,0) */ - /* Warning! Because we moved line to first line, any buffer update - * must call adjustline for firstline. */ + if(oldcurrline != curr_buf->firstline || curr_buf->currline != curr_buf->firstline) { + /* we must adjust because cursor (currentline) moved. */ + curr_buf->firstline = adjustline(curr_buf->firstline, WRAPMARGIN); + oldcurrline = curr_buf->currline = curr_buf->firstline; + } - oldcurrline = curr_buf->currline = curr_buf->firstline; - curr_buf->currpnt = curr_buf->currln = curr_buf->curr_window_line = curr_buf->edit_margin = curr_buf->last_margin = 0; + curr_buf->currpnt = curr_buf->currln = curr_buf->curr_window_line = + curr_buf->edit_margin = curr_buf->last_margin = 0; while (1) { if (curr_buf->redraw_everything || has_block_selection()) { -- cgit v1.2.3