From 3925bdafda978e8e2ae69d3593b39be9eed0f38e Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Tue, 7 Jun 2005 03:20:35 +0000 Subject: [PATCH] fix erroneous #ifdef that caused a compilation problem when --enable-nanorc wasn't used and --enable-extra was, and make sure we put back the keystroke that breaks us out of the credits (if any) git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2607 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 10 ++++++++++ src/chars.c | 2 +- src/winio.c | 11 +++++++---- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8de5249e..8da44a97 100644 --- a/ChangeLog +++ b/ChangeLog @@ -54,6 +54,11 @@ CVS code - and NANO_APPEND_KEY are. Changes to shortcut_init(), usage(), main(), search_init(), nanorc.sample, nano.1, nanorc.5, nano.texi, etc. (DLR) +- chars.c: + make_mbstring() + - Change erroneous ENABLE_EXTRA #ifdef to NANO_EXTRA to fix a + compilation problem when --enable-nanorc isn't used and + --enable-extra is. (DLR) - cut.c: cut_line() - Set placewewant properly after cutting a line, to avoid a @@ -178,6 +183,11 @@ CVS code - total_update() - Simplify to call clearok(TRUE) and wrefresh() on edit, which updates the entire screen in fewer function calls. (DLR) + do_credits() + - Save the keystroke that breaks us out of the credits (if any) + and put it back so that it isn't lost. This is especially + needed if the keystroke is part of a multibyte character. + (DLR) - configure.ac: - Minor tweaks to some of the test blocks to avoid XSI:isms. (DLR, adapted from a Debian patch for GNU ed by David diff --git a/src/chars.c b/src/chars.c index f46c5df4..549ea0da 100644 --- a/src/chars.c +++ b/src/chars.c @@ -301,7 +301,7 @@ char *make_mbchar(int chr, int *chr_mb_len) return chr_mb; } -#if defined(ENABLE_NANORC) || defined(ENABLE_EXTRA) +#if defined(ENABLE_NANORC) || defined(NANO_EXTRA) /* Convert the string str to a valid multibyte string with the same wide * character values as str. Return the (dynamically allocated) * multibyte string. */ diff --git a/src/winio.c b/src/winio.c index 4875f5fa..a792eef5 100644 --- a/src/winio.c +++ b/src/winio.c @@ -4020,7 +4020,7 @@ void dump_buffer_reverse(void) /* Easter egg: Display credits. Assume nodelay(edit) is FALSE. */ void do_credits(void) { - int crpos = 0, xlpos = 0; + int kbinput = ERR, crpos = 0, xlpos = 0; const char *credits[CREDIT_LEN] = { NULL, /* "The nano text editor" */ NULL, /* "version" */ @@ -4101,7 +4101,7 @@ void do_credits(void) wrefresh(bottomwin); for (crpos = 0; crpos < CREDIT_LEN + editwinrows / 2; crpos++) { - if (wgetch(edit) != ERR) + if ((kbinput = wgetch(edit)) != ERR) break; if (crpos < CREDIT_LEN) { @@ -4129,16 +4129,19 @@ void do_credits(void) napms(700); scroll(edit); wrefresh(edit); - if (wgetch(edit) != ERR) + if ((kbinput = wgetch(edit)) != ERR) break; napms(700); scroll(edit); wrefresh(edit); } + if (kbinput != ERR) + ungetch(kbinput); + + curs_set(1); scrollok(edit, FALSE); nodelay(edit, FALSE); - curs_set(1); total_refresh(); } #endif -- 2.39.5