add -O/--morespace command line option, plus a corresponding Meta-O

toggle and a "morespace" rcfile option; when these are used, the
normally-unused blank line below the titlebar will be treated as part of
the edit window


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2281 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2005-01-17 05:06:55 +00:00
parent 65658ef574
commit 637b8bb36c
7 changed files with 73 additions and 39 deletions

View File

@ -116,6 +116,13 @@ CVS code -
do_statusbar_verbatim_kbinput(), do_statusbar_output(), and
display_string(); removal of buffer_to_keys() and
keys_to_buffer(). (DLR)
- Add -O/--morespace command line option, plus a corresponding
Meta-O toggle and a "morespace" rcfile option. When these are
used, the normally-unused blank line below the titlebar will
be treated as part of the edit window. New functions
no_more_space() and blank_topbar(); changes to global_init(),
window_init(), handle_sigwinch(), do_toggle(), etc. (DLR;
suggested by Mike Frysinger, Rocco, and Robert Schultz)
- cut.c:
do_cut_text()
- If keep_cutbuffer is FALSE, only blow away the text in the
@ -227,6 +234,9 @@ CVS code -
bottombars()
- Initialize foo, in case a keystroke meets none of the handled
cases. (DLR)
total_refresh()
- Refresh bottomwin using the value of currshortcut, and change
the code around do_refresh() calls to accommodate this. (DLR)
- configure.ac:
- Remove specific references to control key shortcuts. (DLR)
- Check for the wide version of ncurses, without which multibyte

View File

@ -41,8 +41,8 @@ char *last_replace = NULL; /* Last replacement string */
int search_last_line; /* Is this the last search line? */
long flags = 0; /* Our flag containing many options */
WINDOW *topwin; /* Top buffer */
WINDOW *edit; /* The file portion of the editor */
WINDOW *topwin; /* Top line of screen */
WINDOW *bottomwin; /* Bottom buffer */
char *filename = NULL; /* Name of the file */
@ -1073,12 +1073,13 @@ void toggle_init(void)
/* If we're using restricted mode, the multibuffer toggle is
* disabled. It's useless since inserting files is disabled. */
if (!ISSET(RESTRICTED))
toggle_init_one(TOGGLE_MULTIBUFFER_KEY, N_("Multiple file buffers"),
MULTIBUFFER);
toggle_init_one(TOGGLE_MULTIBUFFER_KEY,
N_("Multiple file buffers"), MULTIBUFFER);
#endif
toggle_init_one(TOGGLE_CONST_KEY, N_("Constant cursor position"),
CONSTUPDATE);
toggle_init_one(TOGGLE_AUTOINDENT_KEY, N_("Auto indent"), AUTOINDENT);
toggle_init_one(TOGGLE_AUTOINDENT_KEY, N_("Auto indent"),
AUTOINDENT);
#ifndef DISABLE_WRAPPING
toggle_init_one(TOGGLE_WRAP_KEY, N_("Auto line wrap"), NO_WRAP);
#endif
@ -1098,9 +1099,12 @@ void toggle_init(void)
/* If we're using restricted mode, the backup toggle is disabled.
* It's useless since backups are disabled. */
if (!ISSET(RESTRICTED))
toggle_init_one(TOGGLE_BACKUP_KEY, N_("Backup files"), BACKUP_FILE);
toggle_init_one(TOGGLE_SMOOTH_KEY, N_("Smooth scrolling"), SMOOTHSCROLL);
toggle_init_one(TOGGLE_SMARTHOME_KEY, N_("Smart home key"), SMART_HOME);
toggle_init_one(TOGGLE_BACKUP_KEY, N_("Backup files"),
BACKUP_FILE);
toggle_init_one(TOGGLE_SMOOTH_KEY, N_("Smooth scrolling"),
SMOOTHSCROLL);
toggle_init_one(TOGGLE_SMARTHOME_KEY, N_("Smart home key"),
SMART_HOME);
#ifdef ENABLE_COLOR
toggle_init_one(TOGGLE_SYNTAX_KEY, N_("Color syntax highlighting"),
COLOR_SYNTAX);
@ -1109,6 +1113,8 @@ void toggle_init(void)
toggle_init_one(TOGGLE_WHITESPACE_KEY, N_("Whitespace display"),
WHITESPACE_DISPLAY);
#endif
toggle_init_one(TOGGLE_MORESPACE_KEY, N_("Use of more space for editing"),
MORE_SPACE);
}
#ifdef DEBUG

View File

@ -195,7 +195,7 @@ void global_init(bool save_cutbuffer)
current_x = 0;
current_y = 0;
editwinrows = LINES - 5 + no_help();
editwinrows = LINES - 5 + no_more_space() + no_help();
if (editwinrows < MIN_EDITOR_ROWS || COLS < MIN_EDITOR_COLS)
die_too_small();
@ -223,7 +223,7 @@ void global_init(bool save_cutbuffer)
void window_init(void)
{
editwinrows = LINES - 5 + no_help();
editwinrows = LINES - 5 + no_more_space() + no_help();
if (editwinrows < MIN_EDITOR_ROWS)
die_too_small();
@ -235,8 +235,8 @@ void window_init(void)
delwin(bottomwin);
/* Set up the windows. */
topwin = newwin(2, COLS, 0, 0);
edit = newwin(editwinrows, COLS, 2, 0);
topwin = newwin(2 - no_more_space(), COLS, 0, 0);
edit = newwin(editwinrows, COLS, 2 - no_more_space(), 0);
bottomwin = newwin(3 - no_help(), COLS, LINES - 3 + no_help(), 0);
/* Turn the keypad back on. */
@ -925,6 +925,7 @@ void usage(void)
#ifndef NANO_SMALL
print1opt("-N", "--noconvert", N_("Don't convert files from DOS/Mac format"));
#endif
print1opt("-O", "--morespace", N_("Use more space for editing"));
#ifndef DISABLE_JUSTIFY
print1opt(_("-Q [str]"), _("--quotestr=[str]"), N_("Quoting string, default \"> \""));
#endif
@ -1037,6 +1038,11 @@ void version(void)
printf("\n");
}
int no_more_space(void)
{
return ISSET(MORE_SPACE) ? 1 : 0;
}
int no_help(void)
{
return ISSET(NO_HELP) ? 2 : 0;
@ -3317,7 +3323,7 @@ void handle_sigwinch(int s)
* But not in all cases, argh. */
COLS = win.ws_col;
LINES = win.ws_row;
editwinrows = LINES - 5 + no_help();
editwinrows = LINES - 5 + no_more_space() + no_help();
if (editwinrows < MIN_EDITOR_ROWS || COLS < MIN_EDITOR_COLS)
die_too_small();
@ -3371,10 +3377,10 @@ void handle_sigwinch(int s)
/* Redraw the contents of the windows that need it. */
blank_statusbar();
display_main_list();
currshortcut = main_list;
total_refresh();
/* Turn cursor back on for sure. */
/* Turn the cursor back on for sure. */
curs_set(1);
/* Reset all the input routines that rely on character sequences. */
@ -3404,32 +3410,29 @@ void do_toggle(const toggle *which)
TOGGLE(which->flag);
switch (which->val) {
case TOGGLE_SUSPEND_KEY:
signal_init();
break;
#ifndef DISABLE_MOUSE
case TOGGLE_MOUSE_KEY:
mouse_init();
break;
#endif
case TOGGLE_MORESPACE_KEY:
case TOGGLE_NOHELP_KEY:
blank_statusbar();
blank_bottombars();
wrefresh(bottomwin);
window_init();
edit_refresh();
display_main_list();
total_refresh();
break;
#ifdef ENABLE_COLOR
case TOGGLE_SYNTAX_KEY:
edit_refresh();
case TOGGLE_SUSPEND_KEY:
signal_init();
break;
#endif
#ifdef ENABLE_NANORC
case TOGGLE_WHITESPACE_KEY:
titlebar(NULL);
edit_refresh();
break;
#endif
#ifdef ENABLE_COLOR
case TOGGLE_SYNTAX_KEY:
edit_refresh();
break;
#endif
}
@ -3849,6 +3852,7 @@ int main(int argc, char **argv)
#endif
{"ignorercfiles", 0, 0, 'I'},
#endif
{"morespace", 0, 0, 'O'},
#ifndef DISABLE_JUSTIFY
{"quotestr", 1, 0, 'Q'},
#endif
@ -3926,9 +3930,9 @@ int main(int argc, char **argv)
while ((optchr =
#ifdef HAVE_GETOPT_LONG
getopt_long(argc, argv, "h?ABE:FHINQ:RST:VY:Zabcdefgijklmo:pr:s:tvwxz", long_options, NULL)
getopt_long(argc, argv, "h?ABE:FHINOQ:RST:VY:Zabcdefgijklmo:pr:s:tvwxz", long_options, NULL)
#else
getopt(argc, argv, "h?ABE:FHINQ:RST:VY:Zabcdefgijklmo:pr:s:tvwxz")
getopt(argc, argv, "h?ABE:FHINOQ:RST:VY:Zabcdefgijklmo:pr:s:tvwxz")
#endif
) != -1) {
@ -3972,6 +3976,9 @@ int main(int argc, char **argv)
SET(NO_CONVERT);
break;
#endif
case 'O':
SET(MORE_SPACE);
break;
#ifndef DISABLE_JUSTIFY
case 'Q':
quotestr = mallocstrcpy(quotestr, optarg);

View File

@ -71,14 +71,14 @@
#endif /* CURSES_H */
#ifdef ENABLE_NLS
# ifdef HAVE_LIBINTL_H
# include <libintl.h>
# endif
# define _(string) gettext(string)
# define P_(singular, plural, number) ngettext(singular, plural, number)
#ifdef HAVE_LIBINTL_H
#include <libintl.h>
#endif
#define _(string) gettext(string)
#define P_(singular, plural, number) ngettext(singular, plural, number)
#else
# define _(string) (string)
# define P_(singular, plural, number) (number == 1 ? singular : plural)
#define _(string) (string)
#define P_(singular, plural, number) (number == 1 ? singular : plural)
#endif
#define gettext_noop(string) (string)
#define N_(string) gettext_noop(string)
@ -308,7 +308,8 @@ typedef struct historyheadtype {
#define RESTRICTED (1<<26)
#define SMART_HOME (1<<27)
#define WHITESPACE_DISPLAY (1<<28)
#define NO_UTF8 (1<<29)
#define MORE_SPACE (1<<29)
#define NO_UTF8 (1<<30)
/* Control key sequences, changing these would be very very bad. */
#define NANO_CONTROL_SPACE 0
@ -495,7 +496,7 @@ typedef struct historyheadtype {
#define TOGGLE_SYNTAX_KEY NANO_ALT_Y
#define TOGGLE_SMARTHOME_KEY NANO_ALT_H
#define TOGGLE_WHITESPACE_KEY NANO_ALT_P
#define TOGGLE_NOUTF8_KEY NANO_ALT_O
#define TOGGLE_MORESPACE_KEY NANO_ALT_O
#endif /* !NANO_SMALL */
#define MAIN_VISIBLE 12

View File

@ -375,6 +375,7 @@ void print1opt(const char *shortflag, const char *longflag, const char
*desc);
void usage(void);
void version(void);
int no_more_space(void);
int no_help(void);
void nano_disabled_msg(void);
#ifndef NANO_SMALL
@ -618,6 +619,7 @@ size_t actual_x(const char *str, size_t xplus);
size_t strnlenpt(const char *buf, size_t size);
size_t strlenpt(const char *buf);
void blank_titlebar(void);
void blank_topbar(void);
void blank_edit(void);
void blank_statusbar(void);
void check_statusblank(void);

View File

@ -63,6 +63,7 @@ const static rcoption rcopts[] = {
#ifdef ENABLE_MULTIBUFFER
{"multibuffer", MULTIBUFFER},
#endif
{"morespace", MORE_SPACE},
#ifndef NANO_SMALL
{"noconvert", NO_CONVERT},
#endif

View File

@ -2041,6 +2041,12 @@ void blank_titlebar(void)
mvwaddstr(topwin, 0, 0, hblank);
}
void blank_topbar(void)
{
if (!ISSET(MORE_SPACE))
mvwaddstr(topwin, 1, 0, hblank);
}
void blank_edit(void)
{
int i;
@ -3604,7 +3610,7 @@ void total_refresh(void)
clearok(bottomwin, FALSE);
titlebar(NULL);
edit_refresh();
/* FIXME: bottomwin needs to be refreshed too. */
bottombars(currshortcut);
}
void display_main_list(void)
@ -3742,6 +3748,7 @@ void do_help(void)
UNSET(NO_HELP);
window_init();
}
bottombars(help_list);
do {
@ -3982,6 +3989,7 @@ void do_credits(void)
nodelay(edit, TRUE);
scrollok(edit, TRUE);
blank_titlebar();
blank_topbar();
blank_edit();
blank_statusbar();
blank_bottombars();
@ -4018,7 +4026,6 @@ void do_credits(void)
scrollok(edit, FALSE);
nodelay(edit, FALSE);
curs_set(1);
display_main_list();
total_refresh();
}
#endif