mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-22 12:51:23 +03:00
screen: don't die when the window is narrower than four columns
This fixes https://savannah.gnu.org/bugs/?48520.
This commit is contained in:
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. */
|
||||
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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user