nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit a2313f499cbef7a6fa24a97e59413bb60c7692d2
parent cbda89766fe77e51ab29c06d0f5625af9effa668
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Wed, 12 Feb 2020 16:06:57 +0100

tweaks: move a function to after the one that it calls

Diffstat:
Msrc/proto.h | 1-
Msrc/winio.c | 76++++++++++++++++++++++++++++++++++++++--------------------------------------
2 files changed, 38 insertions(+), 39 deletions(-)

diff --git a/src/proto.h b/src/proto.h @@ -615,7 +615,6 @@ int get_kbinput(WINDOW *win, bool showcursor); int get_byte_kbinput(int kbinput); int get_control_kbinput(int kbinput); int *get_verbatim_kbinput(WINDOW *win, size_t *count); -int *parse_verbatim_kbinput(WINDOW *win, size_t *count); #ifdef ENABLE_MOUSE int get_mouseinput(int *mouse_row, int *mouse_col, bool allow_shortcuts); #endif diff --git a/src/winio.c b/src/winio.c @@ -1502,44 +1502,6 @@ int get_control_kbinput(int kbinput) return kbinput; } -/* Read in one control code, one character byte, or the leading escapes of - * an escape sequence, and return the resulting number of bytes in count. */ -int *get_verbatim_kbinput(WINDOW *win, size_t *count) -{ - int *input; - - /* Turn off flow control characters if necessary so that we can type - * them in verbatim, and turn the keypad off if necessary so that we - * don't get extended keypad values. */ - if (ISSET(PRESERVE)) - disable_flow_control(); - if (!ISSET(RAW_SEQUENCES)) - keypad(win, FALSE); - - /* Read in a single byte or two escapes. */ - input = parse_verbatim_kbinput(win, count); - - /* If the code is invalid in the current mode, discard it. */ - if (input != NULL && ((*input == '\n' && as_an_at) || - (*input == '\0' && !as_an_at))) { - *count = 0; - beep(); - } - - /* Turn flow control characters back on if necessary and turn the - * keypad back on if necessary now that we're done. */ - if (ISSET(PRESERVE)) - enable_flow_control(); - /* Use the global window pointers, because a resize may have freed - * the data that the win parameter points to. */ - if (!ISSET(RAW_SEQUENCES)) { - keypad(edit, TRUE); - keypad(bottomwin, TRUE); - } - - return input; -} - /* Read in one control character (or an iTerm/Eterm/rxvt double Escape), * or convert a series of six digits into a Unicode codepoint. Return * in count either 1 (for a control character or the first byte of a @@ -1614,6 +1576,44 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *count) return get_input(NULL, *count); } +/* Read in one control code, one character byte, or the leading escapes of + * an escape sequence, and return the resulting number of bytes in count. */ +int *get_verbatim_kbinput(WINDOW *win, size_t *count) +{ + int *input; + + /* Turn off flow control characters if necessary so that we can type + * them in verbatim, and turn the keypad off if necessary so that we + * don't get extended keypad values. */ + if (ISSET(PRESERVE)) + disable_flow_control(); + if (!ISSET(RAW_SEQUENCES)) + keypad(win, FALSE); + + /* Read in a single byte or two escapes. */ + input = parse_verbatim_kbinput(win, count); + + /* If the code is invalid in the current mode, discard it. */ + if (input != NULL && ((*input == '\n' && as_an_at) || + (*input == '\0' && !as_an_at))) { + *count = 0; + beep(); + } + + /* Turn flow control characters back on if necessary and turn the + * keypad back on if necessary now that we're done. */ + if (ISSET(PRESERVE)) + enable_flow_control(); + /* Use the global window pointers, because a resize may have freed + * the data that the win parameter points to. */ + if (!ISSET(RAW_SEQUENCES)) { + keypad(edit, TRUE); + keypad(bottomwin, TRUE); + } + + return input; +} + #ifdef ENABLE_MOUSE /* Handle any mouse event that may have occurred. We currently handle * releases/clicks of the first mouse button. If allow_shortcuts is