mirror of
git://git.sv.gnu.org/nano.git
synced 2024-12-25 03:46:52 +03:00
DB's fill and window length fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1442 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
parent
3a78406d56
commit
f8f2d586dc
@ -3,6 +3,12 @@ CVS code
|
||||
- Translation updates (see po/ChangeLog for details).
|
||||
- Fix globals and externs such that nano will compile with
|
||||
DISABLE_SPELLER (David Benbennick).
|
||||
- Fix unreasonable fill values by wrapping at length 0 instead
|
||||
of erroring out, and don't start up if the window size is too
|
||||
small but fill is set reasonably. Changes to
|
||||
nano.c:global_init(), window_init(), and handle_sigwinch().
|
||||
New macro MIN_EDITOR_COLS replaces MIN_FILL_LENGTH
|
||||
(David Benbennick).
|
||||
- files.c:
|
||||
cwd_tab_completion()
|
||||
- Memory leak fix (David Benbennick).
|
||||
|
17
nano.c
17
nano.c
@ -199,7 +199,8 @@ void global_init(int save_cutbuffer)
|
||||
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 @@ void global_init(int save_cutbuffer)
|
||||
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 global_init(int save_cutbuffer)
|
||||
|
||||
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)
|
||||
@ -2867,15 +2869,16 @@ void handle_sigwinch(int s)
|
||||
* 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);
|
||||
|
7
nano.h
7
nano.h
@ -417,14 +417,13 @@ typedef enum {
|
||||
/* 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
|
||||
|
Loading…
Reference in New Issue
Block a user