Eliding an unneeded 'if' and unneeded variable.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5765 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
344fe558b6
commit
7f3dc2de46
|
@ -7,6 +7,7 @@
|
|||
* src/winio.c (reset_cursor): Remove a pointless condition, and make
|
||||
use of an existing intermediary variable.
|
||||
* src/winio.c (reset_cursor): Tidy up and rename a variable.
|
||||
* src/winio.c (onekey): Elide an unneeded 'if' and unneeded variable.
|
||||
|
||||
2016-03-22 Thomas Rosenau <thomasr@fantasymail.de>
|
||||
* configure.ac, src/*.c: Check for the existence of the REG_ENHANCED
|
||||
|
|
|
@ -788,7 +788,7 @@ void titlebar(const char *path);
|
|||
extern void set_modified(void);
|
||||
void statusbar(const char *msg, ...);
|
||||
void bottombars(int menu);
|
||||
void onekey(const char *keystroke, const char *desc, size_t len);
|
||||
void onekey(const char *keystroke, const char *desc, int length);
|
||||
void reset_cursor(void);
|
||||
void edit_draw(filestruct *fileptr, const char *converted, int
|
||||
line, size_t start);
|
||||
|
|
17
src/winio.c
17
src/winio.c
|
@ -2238,33 +2238,28 @@ void bottombars(int menu)
|
|||
|
||||
/* Write a shortcut key to the help area at the bottom of the window.
|
||||
* keystroke is e.g. "^G" and desc is e.g. "Get Help". We are careful
|
||||
* to write at most len characters, even if len is very small and
|
||||
* to write at most length characters, even if length is very small and
|
||||
* keystroke and desc are long. Note that waddnstr(,,(size_t)-1) adds
|
||||
* the whole string! We do not bother padding the entry with blanks. */
|
||||
void onekey(const char *keystroke, const char *desc, size_t len)
|
||||
void onekey(const char *keystroke, const char *desc, int length)
|
||||
{
|
||||
size_t keystroke_len = strlenpt(keystroke) + 1;
|
||||
|
||||
assert(keystroke != NULL && desc != NULL);
|
||||
|
||||
if (interface_color_pair[KEY_COMBO].bright)
|
||||
wattron(bottomwin, A_BOLD);
|
||||
wattron(bottomwin, interface_color_pair[KEY_COMBO].pairnum);
|
||||
waddnstr(bottomwin, keystroke, actual_x(keystroke, len));
|
||||
waddnstr(bottomwin, keystroke, actual_x(keystroke, length));
|
||||
wattroff(bottomwin, A_BOLD);
|
||||
wattroff(bottomwin, interface_color_pair[KEY_COMBO].pairnum);
|
||||
|
||||
if (len > keystroke_len)
|
||||
len -= keystroke_len;
|
||||
else
|
||||
len = 0;
|
||||
length -= strlenpt(keystroke) + 1;
|
||||
|
||||
if (len > 0) {
|
||||
if (length > 0) {
|
||||
waddch(bottomwin, ' ');
|
||||
if (interface_color_pair[FUNCTION_TAG].bright)
|
||||
wattron(bottomwin, A_BOLD);
|
||||
wattron(bottomwin, interface_color_pair[FUNCTION_TAG].pairnum);
|
||||
waddnstr(bottomwin, desc, actual_x(desc, len));
|
||||
waddnstr(bottomwin, desc, actual_x(desc, length));
|
||||
wattroff(bottomwin, A_BOLD);
|
||||
wattroff(bottomwin, interface_color_pair[FUNCTION_TAG].pairnum);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue