text and the first and last file in the file browser via
Meta-\ (Meta-|) and Meta-/ (Meta-?). Changes to do_browser(),
shortcut_init(), and do_help(). (DLR)
+ - Allow unjustifying if we resize the window immediately after
+ justifying, as Pico does, and make input handling across
+ resizes more consistent. Changes to handle_sigwinch(),
+ main(), get_kbinput(), parse_kbinput(), get_byte_kbinput(),
+ and get_unicode_kbinput(); removal of reset_kbinput(). (DLR)
- browser.c:
do_browser()
- Reference NANO_GOTODIR_(ALT|F)?KEY instead of
#include "proto.h"
-/* Global variables */
+/* Global variables. */
+#ifndef NANO_TINY
+sigjmp_buf jmpbuf;
+ /* Used to return to main() or the unjustify routine in
+ * do_justify() after a SIGWINCH. */
+#endif
+
#ifndef DISABLE_WRAPJUSTIFY
ssize_t fill = 0;
/* The column where we will wrap lines. */
/* The bottom of the replace string history list. */
#endif
-/* Regular expressions */
+/* Regular expressions. */
#ifdef HAVE_REGEX_H
regex_t search_regexp;
/* The compiled regular expression to use in searches. */
#include <getopt.h>
#endif
-#ifndef NANO_TINY
-#include <setjmp.h>
-#endif
-
#ifdef ENABLE_NANORC
static bool no_rcfiles = FALSE;
/* Should we ignore all rcfiles? */
static struct sigaction act;
/* For all our fun signal handlers. */
-#ifndef NANO_TINY
-static sigjmp_buf jmpbuf;
- /* Used to return to main() after a SIGWINCH. */
-#endif
-
/* Create a new filestruct node. Note that we specifically do not set
* prevnode->next equal to the new line. */
filestruct *make_new_node(filestruct *prevnode)
if (filepart != NULL)
unpartition_filestruct(&filepart);
-#ifndef DISABLE_JUSTIFY
- /* If the justify buffer isn't empty, blow away the text in it and
- * display the shortcut list with UnCut. */
- if (jusbuffer != NULL) {
- free_filestruct(jusbuffer);
- jusbuffer = NULL;
- shortcut_init(FALSE);
- }
-#endif
-
#ifdef USE_SLANG
/* Slang curses emulation brain damage, part 1: If we just do what
* curses does here, it'll only work properly if the resize made the
currshortcut = main_list;
total_refresh();
- /* Reset all the input routines that rely on character sequences. */
- reset_kbinput();
-
/* Jump back to the main loop. */
siglongjmp(jmpbuf, 1);
}
display_main_list();
-#ifndef NANO_TINY
- /* Return here after a SIGWINCH. */
- sigsetjmp(jmpbuf, 1);
-#endif
-
display_buffer();
while (TRUE) {
/* Make sure the cursor is in the edit window. */
reset_cursor();
+#ifndef NANO_TINY
+ /* Return here after a SIGWINCH. */
+ sigsetjmp(jmpbuf, 1);
+#endif
+
/* If constant cursor position display is on, and there are no
* keys waiting in the input buffer, display the current cursor
* position on the statusbar. */
#ifdef HAVE_REGEX_H
#include <regex.h>
#endif
+#ifndef NANO_TINY
+#include <setjmp.h>
+#endif
#include <assert.h>
/* If no vsnprintf(), use the version from glib 2.x. */
#define NANO_CONTROL_7 31
#define NANO_CONTROL_8 127
+/* Meta key sequences. */
#define NANO_ALT_SPACE ' '
#define NANO_ALT_LPARENTHESIS '('
#define NANO_ALT_RPARENTHESIS ')'
#define TOGGLE_MAC_KEY NANO_ALT_M
#endif /* !NANO_TINY */
-#define MAIN_VISIBLE 12
-
#define VIEW TRUE
#define NOVIEW FALSE
+/* The maximum number of entries displayed in the main shortcut list. */
+#define MAIN_VISIBLE 12
+
/* The minimum editor window columns and rows required for nano to work
* correctly. */
#define MIN_EDITOR_COLS 4
#include "nano.h"
/* Public externs. See global.c for descriptions of them. */
+#ifndef NANO_TINY
+extern sigjmp_buf jmpbuf;
+#endif
+
#ifndef DISABLE_WRAPJUSTIFY
extern ssize_t fill;
extern ssize_t wrap_at;
#endif
/* Public functions in winio.c. */
-#ifndef NANO_TINY
-void reset_kbinput(void);
-#endif
void get_key_buffer(WINDOW *win);
size_t get_key_buffer_len(void);
void unget_input(int *input, size_t input_len);
void unget_kbinput(int kbinput, bool meta_key, bool func_key);
int *get_input(WINDOW *win, size_t input_len);
int get_kbinput(WINDOW *win, bool *meta_key, bool *func_key);
-int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key
-#ifndef NANO_TINY
- , bool reset
-#endif
- );
+int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key);
int get_escape_seq_kbinput(const int *seq, size_t seq_len, bool
*ignore_seq);
int get_escape_seq_abcd(int kbinput);
-int get_byte_kbinput(int kbinput
-#ifndef NANO_TINY
- , bool reset
-#endif
- );
-long get_unicode_kbinput(int kbinput
-#ifndef NANO_TINY
- , bool reset
-#endif
- );
+int get_byte_kbinput(int kbinput);
+long get_unicode_kbinput(int kbinput);
int get_control_kbinput(int kbinput);
void unparse_kbinput(char *output, size_t output_len);
int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
edit_refresh();
+#ifndef NANO_TINY
+ /* Return here after a SIGWINCH. */
+ sigsetjmp(jmpbuf, 1);
+#endif
+
statusbar(_("Can now UnJustify!"));
/* If constant cursor position display is on, make sure the current
* Note that Center (5) on the numeric keypad with NumLock off can also
* be the Begin key. */
-#ifndef NANO_TINY
-/* Reset all the input routines that rely on character sequences. */
-void reset_kbinput(void)
-{
- parse_kbinput(NULL, NULL, NULL, TRUE);
- get_byte_kbinput(0, TRUE);
- get_unicode_kbinput(0, TRUE);
-}
-#endif
-
/* Read in a sequence of keystrokes from win and save them in the
* default keystroke buffer. This should only be called when the
* default keystroke buffer is empty. */
/* Read in a character and interpret it. Continue doing this until
* we get a recognized value or sequence. */
- while ((kbinput = parse_kbinput(win, meta_key, func_key
-#ifndef NANO_TINY
- , FALSE
-#endif
- )) == ERR);
+ while ((kbinput = parse_kbinput(win, meta_key, func_key)) == ERR);
return kbinput;
}
* sequences into their corresponding key values. Set meta_key to TRUE
* when we get a meta key sequence, and set func_key to TRUE when we get
* a function key. Assume nodelay(win) is FALSE. */
-int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key
-#ifndef NANO_TINY
- , bool reset
-#endif
- )
-
+int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key)
{
static int escapes = 0, byte_digits = 0;
int *kbinput, retval = ERR;
-#ifndef NANO_TINY
- if (reset) {
- escapes = 0;
- byte_digits = 0;
- return ERR;
- }
-#endif
-
*meta_key = FALSE;
*func_key = FALSE;
int byte;
byte_digits++;
- byte = get_byte_kbinput(*kbinput
-#ifndef NANO_TINY
- , FALSE
-#endif
- );
+ byte = get_byte_kbinput(*kbinput);
if (byte != ERR) {
char *byte_mb;
/* Translate a byte sequence: turn a three-digit decimal number from
* 000 to 255 into its corresponding byte value. */
-int get_byte_kbinput(int kbinput
-#ifndef NANO_TINY
- , bool reset
-#endif
- )
+int get_byte_kbinput(int kbinput)
{
static int byte_digits = 0, byte = 0;
int retval = ERR;
-#ifndef NANO_TINY
- if (reset) {
- byte_digits = 0;
- byte = 0;
- return ERR;
- }
-#endif
-
/* Increment the byte digit counter. */
byte_digits++;
/* Translate a Unicode sequence: turn a six-digit hexadecimal number
* from 000000 to 10FFFF (case-insensitive) into its corresponding
* multibyte value. */
-long get_unicode_kbinput(int kbinput
-#ifndef NANO_TINY
- , bool reset
-#endif
- )
+long get_unicode_kbinput(int kbinput)
{
static int uni_digits = 0;
static long uni = 0;
long retval = ERR;
-#ifndef NANO_TINY
- if (reset) {
- uni_digits = 0;
- uni = 0;
- return ERR;
- }
-#endif
-
/* Increment the Unicode digit counter. */
uni_digits++;
while ((kbinput = get_input(win, 1)) == NULL);
/* Check whether the first keystroke is a hexadecimal digit. */
- uni = get_unicode_kbinput(*kbinput
-#ifndef NANO_TINY
- , FALSE
-#endif
- );
+ uni = get_unicode_kbinput(*kbinput);
/* If the first keystroke isn't a hexadecimal digit, put back the
* first keystroke. */
while (uni == ERR) {
while ((kbinput = get_input(win, 1)) == NULL);
- uni = get_unicode_kbinput(*kbinput
-#ifndef NANO_TINY
- , FALSE
-#endif
- );
+ uni = get_unicode_kbinput(*kbinput);
}
/* Put back the multibyte equivalent of the Unicode value. */