diff --git a/ChangeLog b/ChangeLog index 3ef21287..26d2aad8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,8 @@ of the list, so that it won't be dropped any time soon. The problem was pointed out by David Niklas. * src/winio.c (edit_redraw): Condense by removing a triplication. + * src/prompt.c (do_statusbar_prev_word, do_statusbar_next_word): + Chop an always-FALSE parameter and delete an unused return value. 2016-01-22 Benno Schulenberg * src/utils.c (get_homedir): Don't use $HOME when we're root, because diff --git a/src/prompt.c b/src/prompt.c index 0e51ef21..de9c7497 100644 --- a/src/prompt.c +++ b/src/prompt.c @@ -159,9 +159,9 @@ int do_statusbar_input(bool *ran_func, bool *finished, do_statusbar_right(); #ifndef NANO_TINY else if (s->scfunc == do_prev_word_void) - do_statusbar_prev_word(FALSE); + do_statusbar_prev_word(); else if (s->scfunc == do_next_word_void) - do_statusbar_next_word(FALSE); + do_statusbar_next_word(); #endif else if (s->scfunc == do_home) do_statusbar_home(); @@ -444,15 +444,13 @@ void do_statusbar_cut_text(void) } #ifndef NANO_TINY -/* Move to the next word in the prompt text. 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_statusbar_next_word(bool allow_punct) +/* Move to the next word in the prompt text. */ +void do_statusbar_next_word(void) { size_t pww_save = statusbar_pww; char *char_mb; int char_mb_len; - bool end_line = FALSE, started_on_word = FALSE; + bool end_line = FALSE; assert(answer != NULL); @@ -465,13 +463,9 @@ bool do_statusbar_next_word(bool allow_punct) /* If we've found it, stop moving forward through the current * line. */ - if (!is_word_mbchar(char_mb, allow_punct)) + if (!is_word_mbchar(char_mb, FALSE)) break; - /* If we haven't found it, then we've started on a word, so set - * started_on_word to TRUE. */ - started_on_word = TRUE; - if (answer[statusbar_x] == '\0') end_line = TRUE; else @@ -489,7 +483,7 @@ bool do_statusbar_next_word(bool allow_punct) /* If we've found it, stop moving forward through the current * line. */ - if (is_word_mbchar(char_mb, allow_punct)) + if (is_word_mbchar(char_mb, FALSE)) break; if (answer[statusbar_x] == '\0') @@ -504,20 +498,15 @@ bool do_statusbar_next_word(bool allow_punct) if (need_statusbar_update(pww_save)) update_statusbar_line(answer, statusbar_x); - - /* Return whether we started on a word. */ - return started_on_word; } -/* Move to the previous word in the prompt text. 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_statusbar_prev_word(bool allow_punct) +/* Move to the previous word in the prompt text. */ +void do_statusbar_prev_word(void) { size_t pww_save = statusbar_pww; char *char_mb; int char_mb_len; - bool begin_line = FALSE, started_on_word = FALSE; + bool begin_line = FALSE; assert(answer != NULL); @@ -530,13 +519,9 @@ bool do_statusbar_prev_word(bool allow_punct) /* If we've found it, stop moving backward through the current * line. */ - if (!is_word_mbchar(char_mb, allow_punct)) + if (!is_word_mbchar(char_mb, FALSE)) break; - /* If we haven't found it, then we've started on a word, so set - * started_on_word to TRUE. */ - started_on_word = TRUE; - if (statusbar_x == 0) begin_line = TRUE; else @@ -555,7 +540,7 @@ bool do_statusbar_prev_word(bool allow_punct) /* If we've found it, stop moving backward through the current * line. */ - if (is_word_mbchar(char_mb, allow_punct)) + if (is_word_mbchar(char_mb, FALSE)) break; if (statusbar_x == 0) @@ -578,7 +563,7 @@ bool do_statusbar_prev_word(bool allow_punct) /* If we've found it, stop moving backward through the * current line. */ - if (!is_word_mbchar(char_mb, allow_punct)) + if (!is_word_mbchar(char_mb, FALSE)) break; if (statusbar_x == 0) @@ -599,9 +584,6 @@ bool do_statusbar_prev_word(bool allow_punct) if (need_statusbar_update(pww_save)) update_statusbar_line(answer, statusbar_x); - - /* Return whether we started on a word. */ - return started_on_word; } #endif /* !NANO_TINY */ diff --git a/src/proto.h b/src/proto.h index cf33e778..984aec8f 100644 --- a/src/proto.h +++ b/src/proto.h @@ -528,8 +528,8 @@ void do_statusbar_backspace(void); void do_statusbar_delete(void); void do_statusbar_cut_text(void); #ifndef NANO_TINY -bool do_statusbar_next_word(bool allow_punct); -bool do_statusbar_prev_word(bool allow_punct); +void do_statusbar_next_word(void); +void do_statusbar_prev_word(void); #endif void do_statusbar_verbatim_input(bool *got_enter); size_t statusbar_xplustabs(void);