mirror of git://git.sv.gnu.org/nano.git
tweaks: elide two parameters, as they are now always the same
This commit is contained in:
parent
33041d0ad5
commit
ba093b0b48
|
@ -185,7 +185,7 @@ void chop_word(bool forward)
|
|||
* on the edge of the original line, then put the cursor on that
|
||||
* edge instead, so that lines will not be joined unexpectedly. */
|
||||
if (!forward) {
|
||||
do_prev_word(ISSET(WORD_BOUNDS));
|
||||
do_prev_word();
|
||||
if (openfile->current != is_current) {
|
||||
if (is_current_x > 0) {
|
||||
openfile->current = is_current;
|
||||
|
@ -194,7 +194,7 @@ void chop_word(bool forward)
|
|||
openfile->current_x = strlen(openfile->current->data);
|
||||
}
|
||||
} else {
|
||||
do_next_word(ISSET(AFTER_ENDS), ISSET(WORD_BOUNDS));
|
||||
do_next_word(ISSET(AFTER_ENDS));
|
||||
if (openfile->current != is_current &&
|
||||
is_current->data[is_current_x] != '\0') {
|
||||
openfile->current = is_current;
|
||||
|
|
30
src/move.c
30
src/move.c
|
@ -265,10 +265,10 @@ void to_next_block(void)
|
|||
edit_redraw(was_current, CENTERING);
|
||||
}
|
||||
|
||||
/* Move to the previous word. If allow_punct is TRUE, treat punctuation
|
||||
* as part of a word. */
|
||||
void do_prev_word(bool allow_punct)
|
||||
/* Move to the previous word. */
|
||||
void do_prev_word(void)
|
||||
{
|
||||
bool punctuation_as_letters = ISSET(WORD_BOUNDS);
|
||||
bool seen_a_word = FALSE, step_forward = FALSE;
|
||||
|
||||
/* Move backward until we pass over the start of a word. */
|
||||
|
@ -286,7 +286,7 @@ void do_prev_word(bool allow_punct)
|
|||
openfile->current_x);
|
||||
|
||||
if (is_word_char(openfile->current->data + openfile->current_x,
|
||||
allow_punct)) {
|
||||
punctuation_as_letters)) {
|
||||
seen_a_word = TRUE;
|
||||
/* If at the head of a line now, this surely is a word start. */
|
||||
if (openfile->current_x == 0)
|
||||
|
@ -309,12 +309,12 @@ void do_prev_word(bool allow_punct)
|
|||
}
|
||||
|
||||
/* Move to the next word. If after_ends is TRUE, stop at the ends of words
|
||||
* instead of their beginnings. If allow_punct is TRUE, treat punctuation as
|
||||
* part of a word. Return TRUE if we started on a word, and FALSE otherwise. */
|
||||
bool do_next_word(bool after_ends, bool allow_punct)
|
||||
* instead of at their beginnings. Return TRUE if we started on a word. */
|
||||
bool do_next_word(bool after_ends)
|
||||
{
|
||||
bool punctuation_as_letters = ISSET(WORD_BOUNDS);
|
||||
bool started_on_word = is_word_char(openfile->current->data +
|
||||
openfile->current_x, allow_punct);
|
||||
openfile->current_x, punctuation_as_letters);
|
||||
bool seen_space = !started_on_word;
|
||||
#ifndef NANO_TINY
|
||||
bool seen_word = started_on_word;
|
||||
|
@ -341,7 +341,7 @@ bool do_next_word(bool after_ends, bool allow_punct)
|
|||
/* If this is a word character, continue; else it's a separator,
|
||||
* and if we've already seen a word, then it's a word end. */
|
||||
if (is_word_char(openfile->current->data + openfile->current_x,
|
||||
allow_punct))
|
||||
punctuation_as_letters))
|
||||
seen_word = TRUE;
|
||||
#ifdef ENABLE_UTF8
|
||||
else if (is_zerowidth(openfile->current->data + openfile->current_x))
|
||||
|
@ -360,7 +360,7 @@ bool do_next_word(bool after_ends, bool allow_punct)
|
|||
/* If this is not a word character, then it's a separator; else
|
||||
* if we've already seen a separator, then it's a word start. */
|
||||
if (!is_word_char(openfile->current->data + openfile->current_x,
|
||||
allow_punct))
|
||||
punctuation_as_letters))
|
||||
seen_space = TRUE;
|
||||
else if (seen_space)
|
||||
break;
|
||||
|
@ -370,25 +370,23 @@ bool do_next_word(bool after_ends, bool allow_punct)
|
|||
return started_on_word;
|
||||
}
|
||||
|
||||
/* Move to the previous word in the file, treating punctuation as part of a
|
||||
* word if the WORD_BOUNDS flag is set, and update the screen afterwards. */
|
||||
/* Move to the previous word in the file, and update the screen afterwards. */
|
||||
void to_prev_word(void)
|
||||
{
|
||||
linestruct *was_current = openfile->current;
|
||||
|
||||
do_prev_word(ISSET(WORD_BOUNDS));
|
||||
do_prev_word();
|
||||
|
||||
edit_redraw(was_current, FLOWING);
|
||||
}
|
||||
|
||||
/* Move to the next word in the file. If the AFTER_ENDS flag is set, stop
|
||||
* at word ends instead of beginnings. If the WORD_BOUNDS flag is set, treat
|
||||
* punctuation as part of a word. Update the screen afterwards. */
|
||||
* at word ends instead of beginnings. Update the screen afterwards. */
|
||||
void to_next_word(void)
|
||||
{
|
||||
linestruct *was_current = openfile->current;
|
||||
|
||||
do_next_word(ISSET(AFTER_ENDS), ISSET(WORD_BOUNDS));
|
||||
do_next_word(ISSET(AFTER_ENDS));
|
||||
|
||||
edit_redraw(was_current, FLOWING);
|
||||
}
|
||||
|
|
|
@ -360,8 +360,8 @@ void to_para_end(void);
|
|||
#endif
|
||||
void to_prev_block(void);
|
||||
void to_next_block(void);
|
||||
void do_prev_word(bool allow_punct);
|
||||
bool do_next_word(bool after_ends, bool allow_punct);
|
||||
void do_prev_word(void);
|
||||
bool do_next_word(bool after_ends);
|
||||
void to_prev_word(void);
|
||||
void to_next_word(void);
|
||||
void do_home(void);
|
||||
|
|
|
@ -2960,7 +2960,7 @@ void count_lines_words_and_characters(void)
|
|||
* incrementing the word count for each successful step. */
|
||||
while (openfile->current->lineno < botline->lineno ||
|
||||
(openfile->current == botline && openfile->current_x < bot_x)) {
|
||||
if (do_next_word(FALSE, ISSET(WORD_BOUNDS)))
|
||||
if (do_next_word(FALSE))
|
||||
words++;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue