mirror of git://git.sv.gnu.org/nano.git
refactor the low-level input routines into main routines that get the
input and state machines that interpret the input git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1773 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
parent
d12fd4b1fb
commit
48ae986730
11
ChangeLog
11
ChangeLog
|
@ -65,6 +65,17 @@ CVS code -
|
|||
suggested by Stephan T. Lavavej)
|
||||
- Minor tweaks to the punctuation in some statusbar messages.
|
||||
(DLR)
|
||||
- Overhaul the low-level input routines into main routines that
|
||||
actually get the input and state machines that interpret the
|
||||
input. This allows better handling of the input (e.g. ignored
|
||||
keys are now always ignored instead of just being ignored when
|
||||
there are no escapes prefixing them) and will make it easier
|
||||
to port to interfaces that don't have blocking input. New
|
||||
functions reset_kbinput(), get_translated_kbinput(),
|
||||
get_control_kbinput(), and get_untranslated_kbinput(); changes
|
||||
to do_verbatim_input(), handle_sigwinch(), get_kbinput(),
|
||||
get_ascii_kbinput(), get_escape_seq_kbinput(), and
|
||||
get_verbatim_kbinput(). (DLR)
|
||||
- files.c:
|
||||
add_open_file()
|
||||
- Rearrange the NANO_SMALL #ifdef so that the code to set the
|
||||
|
|
16
src/nano.c
16
src/nano.c
|
@ -982,22 +982,23 @@ void do_char(char ch)
|
|||
|
||||
int do_verbatim_input(void)
|
||||
{
|
||||
int *verbatim_kbinput; /* Used to hold verbatim input. */
|
||||
size_t verbatim_len; /* Length of verbatim input. */
|
||||
int *v_kbinput = NULL; /* Used to hold verbatim input. */
|
||||
size_t v_len; /* Length of verbatim input. */
|
||||
size_t i;
|
||||
|
||||
statusbar(_("Verbatim input"));
|
||||
verbatim_kbinput = get_verbatim_kbinput(edit, &verbatim_len, 1);
|
||||
|
||||
v_kbinput = get_verbatim_kbinput(edit, v_kbinput, &v_len, TRUE);
|
||||
|
||||
/* Turn on DISABLE_CURPOS while inserting character(s) and turn it
|
||||
* off afterwards, so that if constant cursor position display is
|
||||
* on, it will be updated properly. */
|
||||
SET(DISABLE_CURPOS);
|
||||
for (i = 0; i < verbatim_len; i++)
|
||||
do_char((char)verbatim_kbinput[i]);
|
||||
for (i = 0; i < v_len; i++)
|
||||
do_char((char)v_kbinput[i]);
|
||||
UNSET(DISABLE_CURPOS);
|
||||
|
||||
free(verbatim_kbinput);
|
||||
free(v_kbinput);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -2876,6 +2877,9 @@ void handle_sigwinch(int s)
|
|||
/* Restore the terminal to its previously saved state. */
|
||||
resetty();
|
||||
|
||||
/* Reset all the input routines that rely on character sequences. */
|
||||
reset_kbinput();
|
||||
|
||||
/* Jump back to the main loop. */
|
||||
siglongjmp(jmpbuf, 1);
|
||||
}
|
||||
|
|
30
src/proto.h
30
src/proto.h
|
@ -467,15 +467,31 @@ int check_wildcard_match(const char *text, const char *pattern);
|
|||
#endif
|
||||
|
||||
/* Public functions in winio.c */
|
||||
#ifndef NANO_SMALL
|
||||
void reset_kbinput(void);
|
||||
#endif
|
||||
int get_kbinput(WINDOW *win, int *meta_key);
|
||||
int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len, int
|
||||
allow_ascii);
|
||||
int get_ignored_kbinput(WINDOW *win);
|
||||
int get_accepted_kbinput(WINDOW *win, int kbinput, int *meta_key);
|
||||
int get_ascii_kbinput(WINDOW *win, int kbinput);
|
||||
int get_escape_seq_kbinput(WINDOW *win, int *escape_seq, size_t
|
||||
escape_seq_len);
|
||||
int get_translated_kbinput(int kbinput, int *es
|
||||
#ifndef NANO_SMALL
|
||||
, int reset
|
||||
#endif
|
||||
);
|
||||
int get_ascii_kbinput(int kbinput, size_t ascii_digits
|
||||
#ifndef NANO_SMALL
|
||||
, int reset
|
||||
#endif
|
||||
);
|
||||
int get_control_kbinput(int kbinput);
|
||||
int get_escape_seq_kbinput(int *escape_seq, size_t es_len);
|
||||
int get_escape_seq_abcd(int kbinput);
|
||||
int *get_verbatim_kbinput(WINDOW *win, int *verbatim_kbinput, size_t
|
||||
*verbatim_len, int allow_ascii);
|
||||
int get_untranslated_kbinput(int kbinput, size_t position, int
|
||||
allow_ascii
|
||||
#ifndef NANO_SMALL
|
||||
, int reset
|
||||
#endif
|
||||
);
|
||||
#ifndef DISABLE_MOUSE
|
||||
int get_mouseinput(int *mouse_x, int *mouse_y, int shortcut);
|
||||
#endif
|
||||
|
|
1046
src/winio.c
1046
src/winio.c
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue