/* This file contains the word-oriented movement functions */
MARK
m_fword(m
, cnt
, cmd
, prevkey
)
MARK m
; /* movement is relative to this mark */
long cnt
; /* a numeric argument */
int cmd
; /* either 'w' or 'W' */
int prevkey
;/* previous command... if 'c' then exclude whitespace */
text
= ptext
+ markidx(m
);
/* As a special case, "cw" or "cW" on whitespace without a count
* treats the single whitespace character under the cursor as a word.
if (cnt
== 1L && prevkey
== 'c' && isspace(*text
))
while (cnt
-- > 0) /* yes, ASSIGNMENT! */
/* include any non-whitespace */
else if (isalnum(i
) || i
== '_')
/* include an alphanumeric word */
/* include contiguous punctuation */
while (i
&& !isalnum(i
) && !isspace(i
))
/* if not part of "cw" or "cW" command... */
if (prevkey
!= 'c' || cnt
> 0)
/* include trailing whitespace */
/* did we hit the end of this line? */
/* "dw" shouldn't delete newline after word */
/* move to next line, if there is one */
/* if argument to operator, then back off 1 char since "w" and "W"
* include the last char in the affected text.
/* construct a MARK for this place */
MARK
m_bword(m
, cnt
, cmd
)
MARK m
; /* movement is relative to this mark */
long cnt
; /* a numeric argument */
int cmd
; /* either 'b' or 'B' */
text
= ptext
+ markidx(m
);
while (cnt
-- > 0) /* yes, ASSIGNMENT! */
/* include preceding whitespace */
while (text
< ptext
|| isspace(*text
))
/* did we hit the end of this line? */
/* move to preceding line, if there is one */
/* include any non-whitespace */
while (text
>= ptext
&& !isspace(*text
))
else if (isalnum(*text
) || *text
== '_')
/* include an alphanumeric word */
while (text
>= ptext
&& isalnum(*text
))
/* include contiguous punctuation */
while (text
>= ptext
&& !isalnum(*text
) && !isspace(*text
))
/* construct a MARK for this place */
MARK
m_eword(m
, cnt
, cmd
)
MARK m
; /* movement is relative to this mark */
long cnt
; /* a numeric argument */
int cmd
; /* either 'e' or 'E' */
text
= ptext
+ markidx(m
);
while (cnt
-- > 0) /* yes, ASSIGNMENT! */
/* include preceding whitespace */
/* did we hit the end of this line? */
/* move to next line, if there is one */
/* include any non-whitespace */
else if (isalnum(i
) || i
== '_')
/* include an alphanumeric word */
/* include contiguous punctuation */
while (i
&& !isalnum(i
) && !isspace(i
))
/* construct a MARK for this place */