Chopping two parameters that are always the same, and that are

global variables anyway.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5611 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Benno Schulenberg 2016-02-06 11:40:15 +00:00
parent 97dcd377e7
commit d844f05a1e
3 changed files with 19 additions and 20 deletions

View File

@ -5,6 +5,8 @@
message has been posted on the status bar. message has been posted on the status bar.
* src/winio.c (statusbar), src/nano.c (do_input): Turn the cursor off * src/winio.c (statusbar), src/nano.c (do_input): Turn the cursor off
when writing in the status bar, and on when waiting for input. when writing in the status bar, and on when waiting for input.
* src/prompt.c (update_the_statusbar): Chop two parameters that are
always the same, and that are global variables anyway.
2016-02-05 Benno Schulenberg <bensberg@justemail.net> 2016-02-05 Benno Schulenberg <bensberg@justemail.net>
* doc/texinfo/nano.texi: Condense the descriptions of command-key * doc/texinfo/nano.texi: Condense the descriptions of command-key

View File

@ -316,7 +316,7 @@ void do_statusbar_output(char *output, size_t output_len, bool
statusbar_pww = statusbar_xplustabs(); statusbar_pww = statusbar_xplustabs();
update_statusbar_line(answer, statusbar_x); update_the_statusbar();
} }
/* Move to the beginning of the prompt text. */ /* Move to the beginning of the prompt text. */
@ -378,7 +378,7 @@ void do_statusbar_delete(void)
null_at(&answer, statusbar_x + line_len - char_buf_len); null_at(&answer, statusbar_x + line_len - char_buf_len);
update_statusbar_line(answer, statusbar_x); update_the_statusbar();
} }
} }
@ -398,7 +398,7 @@ void do_statusbar_cut_text(void)
statusbar_pww = statusbar_xplustabs(); statusbar_pww = statusbar_xplustabs();
} }
update_statusbar_line(answer, statusbar_x); update_the_statusbar();
} }
#ifndef NANO_TINY #ifndef NANO_TINY
@ -511,18 +511,16 @@ void reset_statusbar_cursor(void)
get_statusbar_page_start(start_col, start_col + xpt)); get_statusbar_page_start(start_col, start_col + xpt));
} }
/* Repaint the statusbar when getting a character in /* Repaint the statusbar. */
* get_prompt_string(). The statusbar text line will be displayed void update_the_statusbar(void)
* starting with curranswer[index]. */
void update_statusbar_line(const char *curranswer, size_t index)
{ {
size_t start_col, page_start; size_t start_col, index, page_start;
char *expanded; char *expanded;
assert(prompt != NULL && index <= strlen(curranswer)); assert(prompt != NULL && statusbar_x <= strlen(answer));
start_col = strlenpt(prompt) + 2; start_col = strlenpt(prompt) + 2;
index = strnlenpt(curranswer, index); index = strnlenpt(answer, statusbar_x);
page_start = get_statusbar_page_start(start_col, start_col + index); page_start = get_statusbar_page_start(start_col, start_col + index);
if (interface_color_pair[TITLE_BAR].bright) if (interface_color_pair[TITLE_BAR].bright)
@ -535,8 +533,7 @@ void update_statusbar_line(const char *curranswer, size_t index)
waddch(bottomwin, ':'); waddch(bottomwin, ':');
waddch(bottomwin, (page_start == 0) ? ' ' : '$'); waddch(bottomwin, (page_start == 0) ? ' ' : '$');
expanded = display_string(curranswer, page_start, COLS - start_col - expanded = display_string(answer, page_start, COLS - start_col - 1, FALSE);
1, FALSE);
waddstr(bottomwin, expanded); waddstr(bottomwin, expanded);
free(expanded); free(expanded);
@ -557,7 +554,7 @@ void update_the_bar(void)
if (get_statusbar_page_start(start_col, start_col + statusbar_pww) != if (get_statusbar_page_start(start_col, start_col + statusbar_pww) !=
get_statusbar_page_start(start_col, start_col + was_pww)) get_statusbar_page_start(start_col, start_col + was_pww))
update_statusbar_line(answer, statusbar_x); update_the_statusbar();
} }
/* Get a string of input at the statusbar prompt. */ /* Get a string of input at the statusbar prompt. */
@ -605,7 +602,7 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answer, (unsigned long) statusbar_x); fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answer, (unsigned long) statusbar_x);
#endif #endif
update_statusbar_line(answer, statusbar_x); update_the_statusbar();
/* Refresh the edit window and the statusbar before getting /* Refresh the edit window and the statusbar before getting
* input. */ * input. */
@ -624,7 +621,7 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
#ifndef NANO_TINY #ifndef NANO_TINY
if (kbinput == KEY_WINCH) { if (kbinput == KEY_WINCH) {
refresh_func(); refresh_func();
update_statusbar_line(answer, statusbar_x); update_the_statusbar();
continue; continue;
} }
#endif #endif
@ -655,7 +652,7 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
answer = input_tab(answer, allow_files, &statusbar_x, answer = input_tab(answer, allow_files, &statusbar_x,
&tabbed, refresh_func, list); &tabbed, refresh_func, list);
update_statusbar_line(answer, statusbar_x); update_the_statusbar();
} else } else
#endif /* !DISABLE_TABCOMP */ #endif /* !DISABLE_TABCOMP */
#ifndef DISABLE_HISTORIES #ifndef DISABLE_HISTORIES
@ -673,7 +670,7 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
statusbar_x = strlen(answer); statusbar_x = strlen(answer);
} }
update_statusbar_line(answer, statusbar_x); update_the_statusbar();
/* This key has a shortcut-list entry when it's used to /* This key has a shortcut-list entry when it's used to
* move to an older search, which means that finished has * move to an older search, which means that finished has
@ -699,7 +696,7 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
statusbar_x = strlen(answer); statusbar_x = strlen(answer);
} }
update_statusbar_line(answer, statusbar_x); update_the_statusbar();
/* This key has a shortcut-list entry when it's used to /* This key has a shortcut-list entry when it's used to
* move to a newer search, which means that finished has * move to a newer search, which means that finished has
@ -710,7 +707,7 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
} else } else
#endif /* !DISABLE_HISTORIES */ #endif /* !DISABLE_HISTORIES */
if (func == do_help_void) { if (func == do_help_void) {
update_statusbar_line(answer, statusbar_x); update_the_statusbar();
/* This key has a shortcut-list entry when it's used to go to /* This key has a shortcut-list entry when it's used to go to
* the help browser or display a message indicating that help * the help browser or display a message indicating that help

View File

@ -534,7 +534,7 @@ void do_statusbar_verbatim_input(bool *got_enter);
size_t statusbar_xplustabs(void); size_t statusbar_xplustabs(void);
size_t get_statusbar_page_start(size_t start_col, size_t column); size_t get_statusbar_page_start(size_t start_col, size_t column);
void reset_statusbar_cursor(void); void reset_statusbar_cursor(void);
void update_statusbar_line(const char *curranswer, size_t index); void update_the_statusbar(void);
void update_the_bar(void); void update_the_bar(void);
void total_statusbar_refresh(void (*refresh_func)(void)); void total_statusbar_refresh(void (*refresh_func)(void));
functionptrtype get_prompt_string(int *value, bool allow_tabs, functionptrtype get_prompt_string(int *value, bool allow_tabs,