On Wed, Aug 29, 2012 at 05:55:58PM +0000, Florian Obser wrote: > Hi, > while looking why sometimes line numbers are wrong in mg I found this: > 1) mg theo.c > 2) move around in file > 3) C-x C-f theo.c > 4) the cursor will be at the end of the buffer (sometimes one line after > the end of the buffer) and the line number is not updated.
I have seen the effects of this a couple of times (wrong line number) and it has done my head-in trying to work out what I have done (what functions I have called on which buffers) to cause it, but your series of steps definitley causes the effects. (there may be other causes of course ;) Your solution seems good too; removes definite dodgy line counter and makes cursor behave like emacs in the same situation. mark > > If there is another file open this doesn't seem to happen, the cursor only > jumps to column 0. But this might be totaly random because def.h has this > to say (above struct buffer): > * [...] There is a safe store for the > * dot and mark in the header, but this is only valid if the buffer > * is not being displayed (that is, if "b_nwnd" is 0). [...] > > Maybe "wp->w_rflag |= flags;" should go, too. > > diff --git usr.bin/mg/buffer.c usr.bin/mg/buffer.c > index 0a4254c..ef2a25b 100644 > --- usr.bin/mg/buffer.c > +++ usr.bin/mg/buffer.c > @@ -611,8 +611,6 @@ showbuffer(struct buffer *bp, struct mgwin *wp, int flags) > > if (wp->w_bufp == bp) { /* Easy case! */ > wp->w_rflag |= flags; > - wp->w_dotp = bp->b_dotp; > - wp->w_doto = bp->b_doto; > return (TRUE); > } > /* First, detach the old buffer from the window */ > > Thanks, > Florian > -- > I'm not entirely sure you are real.