to remove redundant code. New function add_unicode_digit();
changes to get_unicode_kbinput() and parse_verbatim_kbinput().
(Benno Schulenberg, minor tweaks by DLR)
+ - Allow normal typing of high-bit control characters, as Pico
+ does. Changes to do_output() and do_statusbar_output(). (DLR)
- browser.c:
do_browser()
- Reference NANO_GOTODIR_(ALT|F)?KEY instead of
do_verbatim_input()
- Add a translator comment explaining the "Verbatim Input"
statusbar message. (Benno Schulenberg)
+ - Unconditionally blank the statusbar as soon as we're finished
+ getting input. (DLR, suggested by Benno Schulenberg)
- winio.c:
parse_kbinput()
- If we get NANO_CONTROL_8, properly handle it in all cases.
- Add Ctrl-/ as an alias for Ctrl-_. (DLR, found by Benno
Schulenberg)
- Simplify the if blocks wherever possible. (DLR)
+ parse_verbatim_kbinput()
+ - Don't include the ability to enter a Unicode sequence via
+ verbatim input mode if ENABLE_UTF8 isn't defined. (DLR)
display_string()
- Properly display double-column characters if they're past the
first virtual page and their first column is covered by the
#endif /* !DISABLE_MOUSE */
/* The user typed output_len multibyte characters. Add them to the edit
- * buffer, filtering out all control characters if allow_cntrls is
+ * buffer, filtering out all ASCII control characters if allow_cntrls is
* TRUE. */
void do_output(char *output, size_t output_len, bool allow_cntrls)
{
while (i < output_len) {
/* If allow_cntrls is FALSE, filter out nulls and newlines,
- * since they're control characters. */
+ * since they're ASCII control characters. */
if (allow_cntrls) {
/* Null to newline, if needed. */
if (output[i] == '\0')
i += char_buf_len;
- /* If allow_cntrls is FALSE, filter out a control character. */
- if (!allow_cntrls && is_cntrl_mbchar(output + i - char_buf_len))
+ /* If allow_cntrls is FALSE, filter out an ASCII control
+ * character. */
+ if (!allow_cntrls && is_ascii_cntrl_char(*(output + i -
+ char_buf_len)))
continue;
/* If the NO_NEWLINES flag isn't set, when a character is
/* The user typed output_len multibyte characters. Add them to the
* statusbar prompt, setting got_enter to TRUE if we get a newline, and
- * filtering out all control characters if allow_cntrls is TRUE. */
+ * filtering out all ASCII control characters if allow_cntrls is
+ * TRUE. */
void do_statusbar_output(char *output, size_t output_len, bool
*got_enter, bool allow_cntrls)
{
while (i < output_len) {
/* If allow_cntrls is FALSE, filter out nulls and newlines,
- * since they're control characters. */
+ * since they're ASCII control characters. */
if (allow_cntrls) {
/* Null to newline, if needed. */
if (output[i] == '\0')
i += char_buf_len;
- /* If allow_cntrls is FALSE, filter out a control character. */
- if (!allow_cntrls && is_cntrl_mbchar(output + i - char_buf_len))
+ /* If allow_cntrls is FALSE, filter out an ASCII control
+ * character. */
+ if (!allow_cntrls && is_ascii_cntrl_char(*(output + i -
+ char_buf_len)))
continue;
/* More dangerousness fun =) */
int get_escape_seq_abcd(int kbinput);
int parse_escape_seq_kbinput(int kbinput);
int get_byte_kbinput(int kbinput);
+#ifdef ENABLE_UTF8
long get_unicode_kbinput(int kbinput);
long add_unicode_digit(int kbinput, long factor, long *uni);
+#endif
int get_control_kbinput(int kbinput);
void unparse_kbinput(char *output, size_t output_len);
int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
/* Read in all the verbatim characters. */
kbinput = get_verbatim_kbinput(edit, &kbinput_len);
+ /* Blank the statusbar. */
+ blank_statusbar();
+ wnoutrefresh(bottomwin);
+
/* Display all the verbatim characters at once, not filtering out
* control characters. */
output = charalloc(kbinput_len + 1);
do_output(output, kbinput_len, TRUE);
free(output);
-
- /* Blank the statusbar if we need to. */
- check_statusblank();
}
return retval;
}
+#ifdef ENABLE_UTF8
/* Translate a Unicode sequence: turn a six-digit hexadecimal number
* (from 000000 to 10FFFF, case-insensitive) into its corresponding
* multibyte value. */
return retval;
}
+#endif /* ENABLE_UTF8 */
/* Translate a control character sequence: turn an ASCII non-control
* character into its corresponding control character. */
int *parse_verbatim_kbinput(WINDOW *win, size_t *kbinput_len)
{
int *kbinput, *retval;
+#ifdef ENABLE_UTF8
long uni;
+#endif
/* Read in the first keystroke. */
while ((kbinput = get_input(win, 1)) == NULL);
+#ifdef ENABLE_UTF8
/* Check whether the first keystroke is a valid hexadecimal
* digit. */
uni = get_unicode_kbinput(*kbinput);
/* If the first keystroke isn't a valid hexadecimal digit, put back
* the first keystroke. */
if (uni != ERR)
+#endif /* ENABLE_UTF8 */
+
unget_input(kbinput, 1);
+
+#ifdef ENABLE_UTF8
/* Otherwise, read in keystrokes until we have a complete Unicode
* sequence, and put back the corresponding Unicode value. */
else {
free(seq);
free(uni_mb);
}
+#endif /* ENABLE_UTF8 */
/* Get the complete sequence, and save the characters in it as the
* result. */