From b9e83fe9f853403764913c243fc1d0f72e0a95b7 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Wed, 13 Jul 2016 17:38:28 +0200 Subject: [PATCH] tweaks: move some debugging stuff, and move modified editing keys too Again, just for preapring an easier return from the parsing routine. --- src/winio.c | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/src/winio.c b/src/winio.c index 0d4dd958..fff6bbe7 100644 --- a/src/winio.c +++ b/src/winio.c @@ -315,6 +315,22 @@ int get_kbinput(WINDOW *win) while ((kbinput = parse_kbinput(win)) == ERR) ; +#ifdef DEBUG + fprintf(stderr, "after parsing: kbinput = %d, meta_key = %s\n", + kbinput, meta_key ? "TRUE" : "FALSE"); +#endif + +#ifndef NANO_TINY + if (kbinput == controlleft) + kbinput = sc_seq_or(do_prev_word_void, 0); + else if (kbinput == controlright) + kbinput = sc_seq_or(do_next_word_void, 0); + else if (kbinput == controlup) + kbinput = sc_seq_or(do_prev_block, 0); + else if (kbinput == controldown) + kbinput = sc_seq_or(do_next_block, 0); +#endif + /* If we read from the edit window, blank the statusbar if needed. */ if (win == edit) check_statusblank(); @@ -348,6 +364,11 @@ int parse_kbinput(WINDOW *win) keycode = *kbinput; free(kbinput); +#ifdef DEBUG + fprintf(stderr, "before parsing: keycode = %d, escapes = %d, byte_digits = %d\n", + keycode, escapes, byte_digits); +#endif + if (keycode == NANO_CONTROL_3) { /* Increment the escape counter. */ escapes++; @@ -620,24 +641,8 @@ int parse_kbinput(WINDOW *win) break; #endif } - -#ifndef NANO_TINY - if (retval == controlleft) - retval = sc_seq_or(do_prev_word_void, 0); - else if (retval == controlright) - retval = sc_seq_or(do_next_word_void, 0); - else if (retval == controlup) - retval = sc_seq_or(do_prev_block, 0); - else if (retval == controldown) - retval = sc_seq_or(do_next_block, 0); -#endif } -#ifdef DEBUG - fprintf(stderr, "parse_kbinput(): kbinput = %d, meta_key = %s, escapes = %d, byte_digits = %d, retval = %d\n", - keycode, meta_key ? "TRUE" : "FALSE", escapes, byte_digits, retval); -#endif - /* Return the result. */ return retval; }