If you open mg with only the *scratch* buffer loaded (no file names given on command line), and press enter 5 times, take a note of the line number in the status bar then open theo mode (M-x theo). Then move back to the *scratch* buffer via switch-to-buffer (C-x b). You'll notice the line number of the *scratch* buffer is now 1, though the cursor is on line 5. theo mode is initally opened splitting the screen in two, then onlywind() is called. The bug is in onlywind(). This diff fixes this behavior. ok?
-lum Index: window.c =================================================================== RCS file: /cvs/src/usr.bin/mg/window.c,v retrieving revision 1.33 diff -u -p -u -p -r1.33 window.c --- window.c 25 Mar 2015 20:53:31 -0000 1.33 +++ window.c 8 Oct 2015 19:49:34 -0000 @@ -167,6 +167,8 @@ onlywind(int f, int n) wp->w_bufp->b_doto = wp->w_doto; wp->w_bufp->b_markp = wp->w_markp; wp->w_bufp->b_marko = wp->w_marko; + wp->w_bufp->b_dotline = wp->w_dotline; + wp->w_bufp->b_markline = wp->w_markline; } free(wp); } @@ -178,6 +180,8 @@ onlywind(int f, int n) wp->w_bufp->b_doto = wp->w_doto; wp->w_bufp->b_markp = wp->w_markp; wp->w_bufp->b_marko = wp->w_marko; + wp->w_bufp->b_dotline = wp->w_dotline; + wp->w_bufp->b_markline = wp->w_markline; } free(wp); }