version 1.23, 2013/02/17 15:42:21 |
version 1.24, 2013/05/19 10:27:11 |
|
|
* and GNU-ified by mwm@ucbvax. Several bug fixes by blarson@usc-oberon. |
* and GNU-ified by mwm@ucbvax. Several bug fixes by blarson@usc-oberon. |
*/ |
*/ |
|
|
|
#include <ctype.h> |
|
|
#include "def.h" |
#include "def.h" |
|
|
static int fillcol = 70; |
static int fillcol = 70; |
|
|
int |
int |
gotobop(int f, int n) |
gotobop(int f, int n) |
{ |
{ |
|
int col; |
|
int nospace = 0; |
|
|
/* the other way... */ |
/* the other way... */ |
if (n < 0) |
if (n < 0) |
return (gotoeop(f, -n)); |
return (gotoeop(f, -n)); |
|
|
while (n-- > 0) { |
while (n-- > 0) { |
/* first scan back until we are in a word */ |
while (lback(curwp->w_dotp) != curbp->b_headp) { |
while (backchar(FFRAND, 1) && inword() == 0); |
curwp->w_dotp = lback(curwp->w_dotp); |
|
curwp->w_dotline--; |
|
curwp->w_doto = 0; |
|
col = 0; |
|
|
/* and go to the B-O-Line */ |
while (col < llength(curwp->w_dotp) && |
curwp->w_doto = 0; |
(isspace(lgetc(curwp->w_dotp, col)))) |
|
col++; |
|
|
/* |
if (col >= llength(curwp->w_dotp)) { |
* and scan back until we hit a <NL><SP> <NL><TAB> or |
if (nospace) |
* <NL><NL> |
break; |
*/ |
} else |
while (lback(curwp->w_dotp) != curbp->b_headp) |
nospace = 1; |
if (llength(lback(curwp->w_dotp)) && |
} |
lgetc(curwp->w_dotp, 0) != ' ' && |
|
lgetc(curwp->w_dotp, 0) != '.' && |
|
lgetc(curwp->w_dotp, 0) != '\t') { |
|
curwp->w_dotp = lback(curwp->w_dotp); |
|
curwp->w_dotline--; |
|
} else { |
|
if (llength(lback(curwp->w_dotp)) && |
|
lgetc(curwp->w_dotp, 0) == '.') { |
|
curwp->w_dotp = lforw(curwp->w_dotp); |
|
curwp->w_dotline++; |
|
} |
|
break; |
|
} |
|
} |
} |
/* force screen update */ |
/* force screen update */ |
curwp->w_rflag |= WFMOVE; |
curwp->w_rflag |= WFMOVE; |