From 415e55ff373233f581b6da84fe6243090fe6ab6d Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Mon, 16 Mar 2020 10:17:15 +0100 Subject: [PATCH] tweaks: move a function to before the one that calls it --- src/winio.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/winio.c b/src/winio.c index 3d432304..63f359cc 100644 --- a/src/winio.c +++ b/src/winio.c @@ -2280,6 +2280,26 @@ void warn_and_shortly_pause(const char *msg) napms(1500); } +/* Write a key's representation plus a minute description of its function + * to the screen. For example, the key could be "^C" and its tag "Cancel". + * Key plus tag may occupy at most width columns. */ +void post_one_key(const char *keystroke, const char *tag, int width) +{ + wattron(bottomwin, interface_color_pair[KEY_COMBO]); + waddnstr(bottomwin, keystroke, actual_x(keystroke, width)); + wattroff(bottomwin, interface_color_pair[KEY_COMBO]); + + /* If the remaning space is too small, skip the description. */ + width -= breadth(keystroke); + if (width < 2) + return; + + waddch(bottomwin, ' '); + wattron(bottomwin, interface_color_pair[FUNCTION_TAG]); + waddnstr(bottomwin, tag, actual_x(tag, width - 1)); + wattroff(bottomwin, interface_color_pair[FUNCTION_TAG]); +} + /* Display the shortcut list corresponding to menu on the last two rows * of the bottom portion of the window. */ void bottombars(int menu) @@ -2329,26 +2349,6 @@ void bottombars(int menu) wrefresh(bottomwin); } -/* Write a key's representation plus a minute description of its function - * to the screen. For example, the key could be "^C" and its tag "Cancel". - * Key plus tag may occupy at most width columns. */ -void post_one_key(const char *keystroke, const char *tag, int width) -{ - wattron(bottomwin, interface_color_pair[KEY_COMBO]); - waddnstr(bottomwin, keystroke, actual_x(keystroke, width)); - wattroff(bottomwin, interface_color_pair[KEY_COMBO]); - - /* If the remaning space is too small, skip the description. */ - width -= breadth(keystroke); - if (width < 2) - return; - - waddch(bottomwin, ' '); - wattron(bottomwin, interface_color_pair[FUNCTION_TAG]); - waddnstr(bottomwin, tag, actual_x(tag, width - 1)); - wattroff(bottomwin, interface_color_pair[FUNCTION_TAG]); -} - /* Redetermine current_y from the position of current relative to edittop, * and put the cursor in the edit window at (current_y, "current_x"). */ void place_the_cursor(void)