diff --git a/ChangeLog b/ChangeLog index 46337df5..931c74e3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -61,6 +61,9 @@ CVS code - get_untranslated_kbinput() - Make the ascii_digits variables ints instead of size_t's, since they will only hold very small values. (DLR) + get_verbatim_kbinput() + - Don't pass v_kbinput in as a parameter, since we're + dynamically allocating it and then returning it. (DLR) get_shortcut(), get_toggle() - Add debug messages. (DLR) diff --git a/src/nano.c b/src/nano.c index dbbdca9f..91819646 100644 --- a/src/nano.c +++ b/src/nano.c @@ -1225,8 +1225,7 @@ void do_verbatim_input(void) statusbar(_("Verbatim input")); - v_kbinput = get_verbatim_kbinput(edit, ERR, v_kbinput, &v_len, - TRUE); + v_kbinput = get_verbatim_kbinput(edit, ERR, &v_len, TRUE); /* Turn on DISABLE_CURPOS while inserting character(s) and turn it * off afterwards, so that if constant cursor position display is diff --git a/src/proto.h b/src/proto.h index bd7b952f..d2559480 100644 --- a/src/proto.h +++ b/src/proto.h @@ -540,8 +540,8 @@ int get_control_kbinput(int kbinput); int get_escape_seq_kbinput(const int *escape_seq, size_t es_len, bool *ignore_seq); int get_escape_seq_abcd(int kbinput); -int *get_verbatim_kbinput(WINDOW *win, int first, int *v_kbinput, size_t - *v_len, bool allow_ascii); +int *get_verbatim_kbinput(WINDOW *win, int v_first, size_t *v_len, bool + allow_ascii); int get_untranslated_kbinput(int kbinput, size_t position, bool allow_ascii #ifndef NANO_SMALL diff --git a/src/winio.c b/src/winio.c index 2ac375d8..b6caa518 100644 --- a/src/winio.c +++ b/src/winio.c @@ -190,8 +190,8 @@ int get_kbinput(WINDOW *win, bool *meta_key, bool *func_key) int *sequence = NULL; size_t seq_len; - sequence = get_verbatim_kbinput(win, kbinput, sequence, - &seq_len, FALSE); + sequence = get_verbatim_kbinput(win, kbinput, &seq_len, + FALSE); /* Handle escape sequences. */ if (seq == ESCAPE_SEQ) { @@ -1168,13 +1168,13 @@ int get_escape_seq_abcd(int kbinput) } /* Read in a string of input characters (e.g. an escape sequence) - * verbatim. If first isn't ERR, make it the first character of the - * string. Store the string in v_kbinput and return the length of the - * string in v_len. Assume nodelay(win) is FALSE. */ -int *get_verbatim_kbinput(WINDOW *win, int first, int *v_kbinput, size_t - *v_len, bool allow_ascii) + * verbatim. If v_first isn't ERR, make it the first character of the + * string. Return the length of the string in v_len. Assume + * nodelay(win) is FALSE. */ +int *get_verbatim_kbinput(WINDOW *win, int v_first, size_t *v_len, bool + allow_ascii) { - int kbinput; + int kbinput, *v_kbinput; size_t i = 0, v_newlen = 0; #ifndef NANO_SMALL @@ -1193,12 +1193,12 @@ int *get_verbatim_kbinput(WINDOW *win, int first, int *v_kbinput, size_t /* If first is ERR, read the first character using blocking input, * since using non-blocking input will eat up all unused CPU. - * Otherwise, treat first as the first character. Then increment + * Otherwise, treat v_first as the first character. Then increment * v_len and save the character in v_kbinput. */ - if (first == ERR) + if (v_first == ERR) kbinput = wgetch(win); else - kbinput = first; + kbinput = v_first; (*v_len)++; v_kbinput[0] = kbinput; #ifdef DEBUG