1
0
mirror of https://github.com/rfivet/uemacs.git synced 2025-09-25 14:44:01 -04:00

Move paragraph related function from basic.c to word.c.

This commit is contained in:
2013-09-25 15:09:09 +08:00
parent 9ec9176c81
commit 1f7826d3a8
6 changed files with 110 additions and 108 deletions

101
basic.c
View File

@@ -24,7 +24,6 @@
#include "random.h"
#include "utf8.h"
#include "window.h"
#include "word.h"
/*
* This routine, given a pointer to a struct line, and the current cursor goal
@@ -215,106 +214,6 @@ int backline(int f, int n)
return TRUE;
}
#if WORDPRO
/*
* go back to the beginning of the current paragraph
* here we look for a <NL><NL> or <NL><TAB> or <NL><SPACE>
* combination to delimit the beginning of a paragraph
*
* int f, n; default Flag & Numeric argument
*/
int gotobop(int f, int n)
{
int suc; /* success of last backchar */
if (n < 0) /* the other way... */
return gotoeop(f, -n);
while (n-- > 0) { /* for each one asked for */
/* first scan back until we are in a word */
suc = backchar(FALSE, 1);
while (!inword() && suc)
suc = backchar(FALSE, 1);
curwp->w_doto = 0; /* and go to the B-O-Line */
/* and scan back until we hit a <NL><NL> or <NL><TAB>
or a <NL><SPACE> */
while (lback(curwp->w_dotp) != curbp->b_linep)
if (llength(curwp->w_dotp) != 0 &&
#if PKCODE
((justflag == TRUE) ||
#endif
(lgetc(curwp->w_dotp, curwp->w_doto) != TAB &&
lgetc(curwp->w_dotp, curwp->w_doto) != ' '))
#if PKCODE
)
#endif
curwp->w_dotp = lback(curwp->w_dotp);
else
break;
/* and then forward until we are in a word */
suc = forwchar(FALSE, 1);
while (suc && !inword())
suc = forwchar(FALSE, 1);
}
curwp->w_flag |= WFMOVE; /* force screen update */
return TRUE;
}
/*
* Go forword to the end of the current paragraph
* here we look for a <NL><NL> or <NL><TAB> or <NL><SPACE>
* combination to delimit the beginning of a paragraph
*
* int f, n; default Flag & Numeric argument
*/
int gotoeop(int f, int n)
{
int suc; /* success of last backchar */
if (n < 0) /* the other way... */
return gotobop(f, -n);
while (n-- > 0) { /* for each one asked for */
/* first scan forward until we are in a word */
suc = forwchar(FALSE, 1);
while (!inword() && suc)
suc = forwchar(FALSE, 1);
curwp->w_doto = 0; /* and go to the B-O-Line */
if (suc) /* of next line if not at EOF */
curwp->w_dotp = lforw(curwp->w_dotp);
/* and scan forword until we hit a <NL><NL> or <NL><TAB>
or a <NL><SPACE> */
while (curwp->w_dotp != curbp->b_linep) {
if (llength(curwp->w_dotp) != 0 &&
#if PKCODE
((justflag == TRUE) ||
#endif
(lgetc(curwp->w_dotp, curwp->w_doto) != TAB &&
lgetc(curwp->w_dotp, curwp->w_doto) != ' '))
#if PKCODE
)
#endif
curwp->w_dotp = lforw(curwp->w_dotp);
else
break;
}
/* and then backward until we are in a word */
suc = backchar(FALSE, 1);
while (suc && !inword()) {
suc = backchar(FALSE, 1);
}
curwp->w_doto = llength(curwp->w_dotp); /* and to the EOL */
}
curwp->w_flag |= WFMOVE; /* force screen update */
return TRUE;
}
#endif
/*
* Scroll forward by a specified number of lines, or by a full page if no
* argument. Bound to "C-V". The "2" in the arithmetic on the window size is