From: David Lawrence Ramsey Date: Tue, 14 Jun 2005 23:38:08 +0000 (+0000) Subject: revert the changes to the behavior of Esc Esc [3-digit number from 000 X-Git-Tag: v1.3.8~140 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=ce9d299c47c47ddfb8848045137a617a415fdab3;p=nano.git revert the changes to the behavior of Esc Esc [3-digit number from 000 to 255], as it still won't let us type all possible bytes git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2663 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index 881bc9b7..53862c7d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -69,13 +69,6 @@ CVS code - make_valid_mbstring()), mbstrncasecmp(), mbstrcasestr(), mbrevstrcasestr(), etc.; removal of is_alnum_char() and is_alnum_wchar(). (DLR) - - Change the behavior of Esc Esc [3-digit number from 000 to - 255] so that it enters the byte with that value regardless of - whether we're in UTF-8 mode or not, and update the help text - to mention this. This will allow searching for and replacing - raw bytes with their equivalent multibyte sequences as entered - using verbatim input. Changes to help_init() and - parse_kbinput(). (DLR) - Implement word count via Meta-D at the main window. Note that this is disabled when NANO_SMALL is defined. New functions do_word_count() and do_next_word_void(); changes to diff --git a/src/nano.c b/src/nano.c index 73639505..366bba17 100644 --- a/src/nano.c +++ b/src/nano.c @@ -419,9 +419,10 @@ void help_init(void) "or Meta key depending on your keyboard setup. "); htx[2] = N_("Also, pressing Esc twice and then typing a " "three-digit decimal number from 000 to 255 will enter " - "the byte with the corresponding value. The following " - "keystrokes are available in the main editor window. " - "Alternative keys are shown in parentheses:\n\n"); + "the character with the corresponding value. The " + "following keystrokes are available in the main editor " + "window. Alternative keys are shown in " + "parentheses:\n\n"); } htx[0] = _(htx[0]); diff --git a/src/winio.c b/src/winio.c index b3949263..d0c6e5fc 100644 --- a/src/winio.c +++ b/src/winio.c @@ -550,6 +550,9 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key ); if (byte != ERR) { + char *byte_mb; + int byte_mb_len, *seq, i; + /* If we've read in a complete byte * sequence, reset the byte sequence counter * and the escape counter, and put back the @@ -557,8 +560,20 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key byte_digits = 0; escapes = 0; - /* Put back the byte value. */ - unget_input(&byte, 1); + /* Put back the multibyte equivalent of the + * byte value. */ + byte_mb = make_mbchar(byte, &byte_mb_len); + + seq = (int *)nmalloc(byte_mb_len * + sizeof(int)); + + for (i = 0; i < byte_mb_len; i++) + seq[i] = (unsigned char)byte_mb[i]; + + unget_input(seq, byte_mb_len); + + free(byte_mb); + free(seq); } } else { /* Reset the escape counter. */