diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-04-20 22:25:35 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-04-20 22:25:35 +0800 |
commit | fc6ddbeabfc2f4cc53ea08b5095cb217a270f3bc (patch) | |
tree | f2d72e4f64d5d07f72264e48bad617f8b34ca7ff | |
parent | 977f7677ac95fae772fd6fc3ceebc20ff5d5599d (diff) | |
download | pttbbs-fc6ddbeabfc2f4cc53ea08b5095cb217a270f3bc.tar pttbbs-fc6ddbeabfc2f4cc53ea08b5095cb217a270f3bc.tar.gz pttbbs-fc6ddbeabfc2f4cc53ea08b5095cb217a270f3bc.tar.bz2 pttbbs-fc6ddbeabfc2f4cc53ea08b5095cb217a270f3bc.tar.lz pttbbs-fc6ddbeabfc2f4cc53ea08b5095cb217a270f3bc.tar.xz pttbbs-fc6ddbeabfc2f4cc53ea08b5095cb217a270f3bc.tar.zst pttbbs-fc6ddbeabfc2f4cc53ea08b5095cb217a270f3bc.zip |
make it more clear to prevent accidents.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2704 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | mbbsd/edit.c | 13 |
1 files changed, 7 insertions, 6 deletions
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()) { |