diff --git a/src/nano.c b/src/nano.c index 55c01216c090b3401a7a304002b03dfa57a2dbf3..8458a4752b41a47ccf3dad476e3f1d40bb7e5d15 100644 --- a/src/nano.c +++ b/src/nano.c @@ -692,9 +692,11 @@ void die_save_file(const char *die_filename, struct stat *die_stat) /* Initialize the three window portions nano uses. */ void window_init(void) { - /* If the screen height is too small, get out. */ + /* Compute how many lines the edit subwindow will have. */ editwinrows = LINES - TOP_ROWS - BOTTOM_ROWS; - if (COLS < MIN_EDITOR_COLS || editwinrows < MIN_EDITOR_ROWS) + + /* If there is no room to show anything, give up. */ + if (editwinrows <= 0) die(_("Window size is too small for nano...\n")); #ifndef DISABLE_WRAPJUSTIFY diff --git a/src/nano.h b/src/nano.h index 08996499d658a41302b12ccbb5e97e394a329982..2c7dee47a1fb1594e5201fe3e291366f02e83477 100644 --- a/src/nano.h +++ b/src/nano.h @@ -576,11 +576,6 @@ enum /* The maximum number of entries displayed in the main shortcut list. */ #define MAIN_VISIBLE (((COLS + 40) / 20) * 2) -/* The minimum editor window columns and rows required for nano to work - * correctly. Don't make these smaller than 4 and 1. */ -#define MIN_EDITOR_COLS 4 -#define MIN_EDITOR_ROWS 1 - /* The default number of characters from the end of the line where * wrapping occurs. */ #define CHARS_FROM_EOL 8 diff --git a/src/winio.c b/src/winio.c index 1f31195af5d381acdc5c5b4887b5a7c9a1ba8ecb..faf69b34e27400bdc063d854787d073d3faed618 100644 --- a/src/winio.c +++ b/src/winio.c @@ -2048,12 +2048,13 @@ void bottombars(int menu) slen = MAIN_VISIBLE; } - /* There will be this many characters per column, except for the - * last two, which will be longer by (COLS % colwidth) columns so as - * to not waste space. We need at least three columns to display - * anything properly. */ + /* Compute the width of each keyname-plus-explanation pair. */ colwidth = COLS / ((slen / 2) + (slen % 2)); + /* If there is no room, don't print anything. */ + if (colwidth == 0) + return; + blank_bottombars(); #ifdef DEBUG