Package: mg Version: 20060919-1 Followup-For: Bug #391827 The attached patch scroll-up-down.diff fixes the problem with page up/down. search.diff fixes similar problems with incremental search.
Yet another bug gets triggered in an obscure scenario with exchange-point-and-mark: - split the screen in two windows - open a file in one of them and set the mark somewhere - switch to the other window and put the same file in it - exchange-point-and-mark - notice the line number displayed is wrong. This is fixed with showbuffer.diff. I found one more bug: find-file and insert-file get the number of lines in the buffer wrong, which in turn makes end-of-buffer display the wrong line number. The bug seems to be in the insertfile() function, but I haven't been able to fix it.
--- mg-20060919/basic.c 2006-10-02 04:53:45.000000000 +0200 +++ mg-hack/basic.c 2006-10-19 16:45:08.000000000 +0200 @@ -273,7 +273,6 @@ lp = curwp->w_linep; while (n-- && lforw(lp) != curbp->b_headp) { lp = lforw(lp); - curwp->w_dotline++; } curwp->w_linep = lp; curwp->w_flag |= WFFULL; @@ -281,7 +280,10 @@ for (n = curwp->w_ntrows; n-- && lp != curbp->b_headp; lp = lforw(lp)) if (lp == curwp->w_dotp) return (TRUE); - curwp->w_dotp = curwp->w_linep; + while (curwp->w_dotp != curwp->w_linep) { + curwp->w_dotp = lforw(curwp->w_dotp); + curwp->w_dotline++; + } curwp->w_doto = 0; return (TRUE); } @@ -313,7 +315,6 @@ lp = curwp->w_linep; while (n-- && lback(lp) != curbp->b_headp) { lp = lback(lp); - curwp->w_dotline--; } curwp->w_linep = lp; curwp->w_flag |= WFFULL; @@ -321,7 +322,10 @@ for (n = curwp->w_ntrows; n-- && lp != curbp->b_headp; lp = lforw(lp)) if (lp == curwp->w_dotp) return (TRUE); - curwp->w_dotp = curwp->w_linep; + while (curwp->w_dotp != curwp->w_linep) { + curwp->w_dotp = lback(curwp->w_dotp); + curwp->w_dotline--; + } curwp->w_doto = 0; return (TRUE); }
--- mg-20060919/search.c 2006-10-02 04:53:45.000000000 +0200 +++ mg-hack/search.c 2006-10-19 17:54:49.000000000 +0200 @@ -29,6 +29,7 @@ int s_code; struct line *s_dotp; int s_doto; + int s_dotline; }; static int isearch(int); @@ -202,6 +203,7 @@ srch_lastdir = dir; curwp->w_markp = clp; curwp->w_marko = cbo; + curwp->w_markline = cdotline; ewprintf("Mark set"); return (TRUE); case CCHR('G'): @@ -342,6 +344,7 @@ ungetkey(c); curwp->w_markp = clp; curwp->w_marko = cbo; + curwp->w_markline = cdotline; ewprintf("Mark set"); curwp->w_flag |= WFMOVE; return (TRUE); @@ -396,6 +399,7 @@ cmds[ctp].s_code = SRCH_NOPR; cmds[ctp].s_doto = curwp->w_doto; cmds[ctp].s_dotp = curwp->w_dotp; + cmds[ctp].s_dotline = curwp->w_dotline; } static void @@ -404,6 +408,7 @@ if (cmds[cip].s_code != SRCH_NOPR) { curwp->w_doto = cmds[cip].s_doto; curwp->w_dotp = cmds[cip].s_dotp; + curwp->w_dotline = cmds[cip].s_dotline; curwp->w_flag |= WFMOVE; cmds[cip].s_code = SRCH_NOPR; } @@ -454,11 +459,12 @@ static int is_find(int dir) { - int plen, odoto; + int plen, odoto, odotline; struct line *odotp; odoto = curwp->w_doto; odotp = curwp->w_dotp; + odotline = curwp->w_dotline; plen = strlen(pat); if (plen != 0) { if (dir == SRCH_FORW) { @@ -466,6 +472,7 @@ if (forwsrch() == FALSE) { curwp->w_doto = odoto; curwp->w_dotp = odotp; + curwp->w_dotline = odotline; return (FALSE); } return (TRUE); @@ -475,6 +482,7 @@ if (backsrch() == FALSE) { curwp->w_doto = odoto; curwp->w_dotp = odotp; + curwp->w_dotline = odotline; return (FALSE); } return (TRUE);
--- mg-20060919/buffer.c 2006-10-02 04:53:45.000000000 +0200 +++ mg-hack/buffer.c 2006-10-19 16:45:08.000000000 +0200 @@ -623,6 +623,7 @@ wp->w_markp = owp->w_markp; wp->w_marko = owp->w_marko; wp->w_dotline = owp->w_dotline; + wp->w_markline = owp->w_markline; break; } wp->w_flag |= WFMODE | flags;