screen: don't die when the window is narrower than four columns
This fixes https://savannah.gnu.org/bugs/?48520.master
parent
49fc528d88
commit
0dd2a55284
|
@ -692,9 +692,11 @@ void die_save_file(const char *die_filename, struct stat *die_stat)
|
||||||
/* Initialize the three window portions nano uses. */
|
/* Initialize the three window portions nano uses. */
|
||||||
void window_init(void)
|
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;
|
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"));
|
die(_("Window size is too small for nano...\n"));
|
||||||
|
|
||||||
#ifndef DISABLE_WRAPJUSTIFY
|
#ifndef DISABLE_WRAPJUSTIFY
|
||||||
|
|
|
@ -576,11 +576,6 @@ enum
|
||||||
/* The maximum number of entries displayed in the main shortcut list. */
|
/* The maximum number of entries displayed in the main shortcut list. */
|
||||||
#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
|
|
||||||
* 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
|
/* The default number of characters from the end of the line where
|
||||||
* wrapping occurs. */
|
* wrapping occurs. */
|
||||||
#define CHARS_FROM_EOL 8
|
#define CHARS_FROM_EOL 8
|
||||||
|
|
|
@ -2048,12 +2048,13 @@ void bottombars(int menu)
|
||||||
slen = MAIN_VISIBLE;
|
slen = MAIN_VISIBLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* There will be this many characters per column, except for the
|
/* Compute the width of each keyname-plus-explanation pair. */
|
||||||
* 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. */
|
|
||||||
colwidth = COLS / ((slen / 2) + (slen % 2));
|
colwidth = COLS / ((slen / 2) + (slen % 2));
|
||||||
|
|
||||||
|
/* If there is no room, don't print anything. */
|
||||||
|
if (colwidth == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
blank_bottombars();
|
blank_bottombars();
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|
Loading…
Reference in New Issue