invalid, since the C library's multibyte functions don't seem
to. New function is_valid_unicode(); changes to mbrep() and
make_mbchar(). (DLR)
+ - Store Unicode values in longs instead of ints. Changes to
+ make_mbchar(), parse_kbinput(), get_unicode_kbinput(), and
+ parse_verbatim_kbinput(). (DLR)
- color.c:
- Remove unneeded fcntl.h include. (DLR)
- chars.c:
1;
}
-/* Convert the value in chr to a multibyte character with the same
- * wide character value as chr, if possible. If the conversion
+/* Convert the Unicode value in chr to a multibyte character with the
+ * same wide character value as chr, if possible. If the conversion
* succeeds, return the (dynamically allocated) multibyte character and
* its length. Otherwise, return an undefined (dynamically allocated)
* multibyte character and a length of zero. */
-char *make_mbchar(int chr, int *chr_mb_len)
+char *make_mbchar(long chr, int *chr_mb_len)
{
char *chr_mb;
char *mbrep(const char *c, char *crep, int *crep_len);
int mbwidth(const char *c);
int mb_cur_max(void);
-char *make_mbchar(int chr, int *chr_mb_len);
+char *make_mbchar(long chr, int *chr_mb_len);
int parse_mbchar(const char *buf, char *chr, size_t *col);
size_t move_mbleft(const char *buf, size_t pos);
size_t move_mbright(const char *buf, size_t pos);
, bool reset
#endif
);
-int get_unicode_kbinput(int kbinput
+long get_unicode_kbinput(int kbinput
#ifndef NANO_SMALL
, bool reset
#endif
/* Put back the multibyte equivalent of the
* byte value. */
- byte_mb = make_mbchar(byte, &byte_mb_len);
+ byte_mb = make_mbchar((long)byte,
+ &byte_mb_len);
seq = (int *)nmalloc(byte_mb_len *
sizeof(int));
}
/* Translate a Unicode sequence: turn a four-digit hexadecimal number
- * from 0000 to FFFF(case-insensitive) into its corresponding multibyte
+ * from 0000 to FFFF (case-insensitive) into its corresponding multibyte
* value. */
-int get_unicode_kbinput(int kbinput
+long get_unicode_kbinput(int kbinput
#ifndef NANO_SMALL
, bool reset
#endif
)
{
- static int uni_digits = 0, uni = 0;
- int retval = ERR;
+ static int uni_digits = 0;
+ static long uni = 0;
+ long retval = ERR;
#ifndef NANO_SMALL
if (reset) {
}
#ifdef DEBUG
- fprintf(stderr, "get_unicode_kbinput(): kbinput = %d, uni_digits = %d, uni = %d, retval = %d\n", kbinput, uni_digits, uni, retval);
+ fprintf(stderr, "get_unicode_kbinput(): kbinput = %d, uni_digits = %d, uni = %ld, retval = %ld\n", kbinput, uni_digits, uni, retval);
#endif
return retval;
* that, leave the input as-is. */
int *parse_verbatim_kbinput(WINDOW *win, size_t *kbinput_len)
{
- int *kbinput, uni, *retval;
+ int *kbinput, *retval;
+ long uni;
/* Read in the first keystroke. */
while ((kbinput = get_input(win, 1)) == NULL);