diff -u nano/nano.c nano-dietoosmall/nano.c --- nano/nano.c Thu Feb 6 19:38:10 2003 +++ nano-dietoosmall/nano.c Thu Feb 6 19:37:51 2003 @@ -199,7 +199,8 @@ current_x = 0; current_y = 0; - if ((editwinrows = LINES - 5 + no_help()) < MIN_EDITOR_ROWS) + editwinrows = LINES - 5 + no_help(); + if (editwinrows < MIN_EDITOR_ROWS || COLS < MIN_EDITOR_COLS) die_too_small(); fileage = NULL; @@ -216,8 +217,8 @@ fill = wrap_at; if (fill <= 0) fill += COLS; - if (fill < MIN_FILL_LENGTH) - die_too_small(); + if (fill < 0) + fill = 0; #endif hblank = charalloc(COLS + 1); @@ -227,7 +228,8 @@ void window_init(void) { - if ((editwinrows = LINES - 5 + no_help()) < MIN_EDITOR_ROWS) + editwinrows = LINES - 5 + no_help(); + if (editwinrows < MIN_EDITOR_ROWS) die_too_small(); if (edit != NULL) @@ -2864,15 +2866,16 @@ * But not in all cases, argh. */ COLS = win.ws_col; LINES = win.ws_row; - if ((editwinrows = LINES - 5 + no_help()) < MIN_EDITOR_ROWS) + editwinrows = LINES - 5 + no_help(); + if (editwinrows < MIN_EDITOR_ROWS || COLS < MIN_EDITOR_COLS) die_too_small(); #ifndef DISABLE_WRAPJUSTIFY fill = wrap_at; if (fill <= 0) fill += COLS; - if (fill < MIN_FILL_LENGTH) - die_too_small(); + if (fill < 0) + fill = 0; #endif hblank = nrealloc(hblank, COLS + 1); diff -u nano/nano.h nano-dietoosmall/nano.h --- nano/nano.h Thu Feb 6 19:38:10 2003 +++ nano-dietoosmall/nano.h Thu Feb 6 19:37:51 2003 @@ -417,14 +417,13 @@ /* Minimum editor window rows required for nano to work correctly */ #define MIN_EDITOR_ROWS 3 +/* Minimum editor window cols required for nano to work correctly */ +#define MIN_EDITOR_COLS 10 + /* Default number of characters from end-of-line where text wrapping occurs */ #define CHARS_FROM_EOL 8 -/* Minimum fill length (space available for text before wrapping - occurs) */ -#define MIN_FILL_LENGTH 10 - /* Maximum number of search history strings saved, same value used for replace history */ #define MAX_SEARCH_HISTORY 100