From da8fd8f89442dc74d6fe17b3b44e134a77b7ec61 Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Tue, 16 Sep 2003 01:22:31 +0000 Subject: [PATCH] a few minor fixes for low-level keyboard input git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1553 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 8 ++++++++ src/winio.c | 14 ++++---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2b6ce6e3..c8e94d0b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -110,6 +110,14 @@ CVS code - - Make sure all rcfile error messages are capitalized, for consistency. (DLR) - winio.c: + get_verbatim_kbinput() + - Fix a silly memory corruption bug that would occur when trying + to read a sequence of more than one key verbatim. (DLR) + get_accepted_kbinput() + Handle Ctrl-{ to Ctrl-~ correctly, and drop support for + converting Esc ` to Esc Space, since making Meta-[key] + correspond to Ctrl-[key] in all cases is inconsistent due to + the different natures of Contol and Meta key sequences. (DLR) do_first_line() - Call edit_update() with TOP instead of CENTER; both do the same thing, but it works faster with TOP. (DLR) diff --git a/src/winio.c b/src/winio.c index 74f368ba..8318c31b 100644 --- a/src/winio.c +++ b/src/winio.c @@ -67,7 +67,7 @@ char *get_verbatim_kbinput(WINDOW *win, int *kbinput_len) else { nodelay(win, TRUE); while ((kbinput = wgetch(win)) != ERR) { - *kbinput_len++; + (*kbinput_len)++; verbatim_kbinput = charealloc(verbatim_kbinput, *kbinput_len); verbatim_kbinput[*kbinput_len - 1] = (char)kbinput; } @@ -139,8 +139,8 @@ int get_accepted_kbinput(WINDOW *win, int kbinput, int *meta, /* Ctrl-A to Ctrl-_ */ else if (kbinput >= 'A' && kbinput <= '_') kbinput -= 64; - /* Ctrl-A to Ctrl-Z */ - else if (kbinput >= 'a' && kbinput <= 'z') + /* Ctrl-A to Ctrl-~ */ + else if (kbinput >= 'a' && kbinput <= '~') kbinput -= 96; break; /* Terminal breakage, part 1: We shouldn't get an escape @@ -160,14 +160,9 @@ int get_accepted_kbinput(WINDOW *win, int kbinput, int *meta, } nodelay(win, FALSE); break; - case '`': - /* Esc Space == Esc ` */ - kbinput = ' '; - break; default: /* Esc [character] == Meta-[character] */ - if (isupper(kbinput)) - kbinput = tolower(kbinput); + kbinput = tolower(kbinput); *meta = 1; } break; @@ -418,7 +413,6 @@ void blank_edit(void) mvwaddstr(edit, i, 0, hblank); } - void blank_statusbar(void) { mvwaddstr(bottomwin, 0, 0, hblank); -- 2.39.5