titlebar: snip two superfluous tests for having enough space

If nano has less than four columns available, it will die,
so there will always be room for at least four characters.
master
Benno Schulenberg 2016-04-13 17:48:01 +02:00
parent 2246029447
commit 6414f9f000
2 changed files with 11 additions and 20 deletions

View File

@ -563,7 +563,7 @@ enum
#define MAIN_VISIBLE (((COLS + 40) / 20) * 2) #define MAIN_VISIBLE (((COLS + 40) / 20) * 2)
/* The minimum editor window columns and rows required for nano to work /* The minimum editor window columns and rows required for nano to work
* correctly. */ * correctly. Don't make these smaller than 4 and 1. */
#define MIN_EDITOR_COLS 4 #define MIN_EDITOR_COLS 4
#define MIN_EDITOR_ROWS 1 #define MIN_EDITOR_ROWS 1

View File

@ -1980,27 +1980,18 @@ void titlebar(const char *path)
blank_titlebar(); blank_titlebar();
/* space has to be at least 4: two spaces before the version message, /* Limit the length of the version message to a third of the width of
* at least one character of the version message, and one space * the screen, minus three columns for spaces. */
* after the version message. */ if (verlen > (COLS / 3) - 3)
if (space < 4) verlen = (COLS / 3) - 3;
space = 0;
else {
/* Limit verlen to 1/3 the length of the screen in columns,
* minus three columns for spaces. */
if (verlen > (COLS / 3) - 3)
verlen = (COLS / 3) - 3;
}
if (space >= 4) { /* Leave two spaces before the version message, and account also
/* Add a space after the version message, and account for both * for the space after it. */
* it and the two spaces before it. */ mvwaddnstr(topwin, 0, 2, BRANDING, actual_x(BRANDING, verlen));
mvwaddnstr(topwin, 0, 2, BRANDING, actual_x(BRANDING, verlen)); verlen += 3;
verlen += 3;
/* Account for the full length of the version message. */ /* Account for the full length of the version message. */
space -= verlen; space -= verlen;
}
#ifndef DISABLE_BROWSER #ifndef DISABLE_BROWSER
/* Don't display the state if we're in the file browser. */ /* Don't display the state if we're in the file browser. */