=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mg/Attic/random.c,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- src/usr.bin/mg/Attic/random.c 2011/01/18 16:25:40 1.28 +++ src/usr.bin/mg/Attic/random.c 2011/01/19 16:11:38 1.29 @@ -1,4 +1,4 @@ -/* $OpenBSD: random.c,v 1.28 2011/01/18 16:25:40 kjell Exp $ */ +/* $OpenBSD: random.c,v 1.29 2011/01/19 16:11:38 kjell Exp $ */ /* This file is in the public domain. */ @@ -119,7 +119,6 @@ dotp = curwp->w_dotp; doto = curwp->w_doto; - undo_boundary_enable(FFRAND, 0); if (doto == llength(dotp)) { if (--doto <= 0) return (FALSE); @@ -129,6 +128,7 @@ if (doto == 0) return (FALSE); } + undo_boundary_enable(FFRAND, 0); cr = lgetc(dotp, doto - 1); (void)backdel(FFRAND, 1); (void)forwchar(FFRAND, 1); @@ -158,6 +158,7 @@ return (TRUE); /* insert newlines */ + undo_boundary_enable(FFRAND, 0); i = n; do { s = lnewline(); @@ -166,6 +167,7 @@ /* then go back up overtop of them all */ if (s == TRUE) s = backchar(f | FFRAND, n); + undo_boundary_enable(FFRAND, 1); return (s); } @@ -223,8 +225,11 @@ int justone(int f, int n) { + undo_boundary_enable(FFRAND, 0); (void)delwhite(f, n); - return (linsert(1, ' ')); + linsert(1, ' '); + undo_boundary_enable(FFRAND, 1); + return (TRUE); } /* @@ -318,10 +323,12 @@ lfindent(int f, int n) { int c, i, nicol; + int s = TRUE; if (n < 0) return (FALSE); + undo_boundary_enable(FFRAND, 0); while (n--) { nicol = 0; for (i = 0; i < llength(curwp->w_dotp); ++i) { @@ -337,10 +344,13 @@ curbp->b_flag & BFNOTAB) ? linsert(nicol, ' ') == FALSE : ( #endif /* NOTAB */ ((i = nicol / 8) != 0 && linsert(i, '\t') == FALSE) || - ((i = nicol % 8) != 0 && linsert(i, ' ') == FALSE)))) - return (FALSE); + ((i = nicol % 8) != 0 && linsert(i, ' ') == FALSE)))) { + s = FALSE; + break; + } } - return (TRUE); + undo_boundary_enable(FFRAND, 1); + return (s); } /*