store Unicode values in longs instead of ints
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2977 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
815fb0a2a2
commit
8b006c2912
|
@ -138,6 +138,9 @@ CVS code -
|
|||
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:
|
||||
|
|
|
@ -315,12 +315,12 @@ int mb_cur_max(void)
|
|||
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;
|
||||
|
||||
|
|
|
@ -159,7 +159,7 @@ char *control_mbrep(const char *c, char *crep, int *crep_len);
|
|||
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);
|
||||
|
@ -592,7 +592,7 @@ int get_byte_kbinput(int kbinput
|
|||
, bool reset
|
||||
#endif
|
||||
);
|
||||
int get_unicode_kbinput(int kbinput
|
||||
long get_unicode_kbinput(int kbinput
|
||||
#ifndef NANO_SMALL
|
||||
, bool reset
|
||||
#endif
|
||||
|
|
17
src/winio.c
17
src/winio.c
|
@ -568,7 +568,8 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key
|
|||
|
||||
/* 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));
|
||||
|
@ -1232,16 +1233,17 @@ int get_byte_kbinput(int kbinput
|
|||
}
|
||||
|
||||
/* 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) {
|
||||
|
@ -1328,7 +1330,7 @@ int get_unicode_kbinput(int kbinput
|
|||
}
|
||||
|
||||
#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;
|
||||
|
@ -1415,7 +1417,8 @@ int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len)
|
|||
* 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);
|
||||
|
|
Loading…
Reference in New Issue