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
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
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 */
/* 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
/* 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);
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
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();
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();
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. */
#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
printf("\n");
}
+int no_more_space(void)
+{
+ return ISSET(MORE_SPACE) ? 1 : 0;
+}
+
int no_help(void)
{
return ISSET(NO_HELP) ? 2 : 0;
* 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();
/* 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. */
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
}
#endif
{"ignorercfiles", 0, 0, 'I'},
#endif
+ {"morespace", 0, 0, 'O'},
#ifndef DISABLE_JUSTIFY
{"quotestr", 1, 0, 'Q'},
#endif
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) {
SET(NO_CONVERT);
break;
#endif
+ case 'O':
+ SET(MORE_SPACE);
+ break;
#ifndef DISABLE_JUSTIFY
case 'Q':
quotestr = mallocstrcpy(quotestr, optarg);
#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)
#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
#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
*desc);
void usage(void);
void version(void);
+int no_more_space(void);
int no_help(void);
void nano_disabled_msg(void);
#ifndef NANO_SMALL
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);
#ifdef ENABLE_MULTIBUFFER
{"multibuffer", MULTIBUFFER},
#endif
+ {"morespace", MORE_SPACE},
#ifndef NANO_SMALL
{"noconvert", NO_CONVERT},
#endif
mvwaddstr(topwin, 0, 0, hblank);
}
+void blank_topbar(void)
+{
+ if (!ISSET(MORE_SPACE))
+ mvwaddstr(topwin, 1, 0, hblank);
+}
+
void blank_edit(void)
{
int i;
clearok(bottomwin, FALSE);
titlebar(NULL);
edit_refresh();
- /* FIXME: bottomwin needs to be refreshed too. */
+ bottombars(currshortcut);
}
void display_main_list(void)
UNSET(NO_HELP);
window_init();
}
+
bottombars(help_list);
do {
nodelay(edit, TRUE);
scrollok(edit, TRUE);
blank_titlebar();
+ blank_topbar();
blank_edit();
blank_statusbar();
blank_bottombars();
scrollok(edit, FALSE);
nodelay(edit, FALSE);
curs_set(1);
- display_main_list();
total_refresh();
}
#endif