1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-06-17 00:05:23 +00:00

describe-key displays keycode in hexadecimal.

mlwrite assume parameter is unsigned int when doing %x format.
ostring output bytes > 0x7F as unsigned char.
This commit is contained in:
Renaud 2015-02-09 19:27:49 +08:00
parent 3f1ac2596c
commit 7da7916b28
3 changed files with 12 additions and 7 deletions

4
bind.c
View File

@ -81,7 +81,9 @@ int deskey(int f, int n)
/* get the command sequence to describe /* get the command sequence to describe
change it to something we can print as well */ change it to something we can print as well */
cmdstr(c = getckey(FALSE), &outseq[0]); c = getckey( FALSE) ;
mlwrite( ": describe-key 0x%x, ", c) ;
cmdstr( c, &outseq[ 0]) ;
/* and dump it out */ /* and dump it out */
ostring(outseq); ostring(outseq);

View File

@ -1456,19 +1456,22 @@ static void mlputs( char *s) {
*/ */
static void mlputi( int i, int r) { static void mlputi( int i, int r) {
int q ; int q ;
unsigned u ;
static char hexdigits[] = "0123456789ABCDEF" ; static char hexdigits[] = "0123456789ABCDEF" ;
if( i < 0) { if( r == 16 || i >= 0)
i = -i ; u = i ;
else {
u = -i ;
mlputc( '-') ; mlputc( '-') ;
} }
q = i / r ; q = u / r ;
if( q != 0) if( q != 0)
mlputi( q, r) ; mlputi( q, r) ;
mlputc( hexdigits[ i % r]) ; mlputc( hexdigits[ u % r]) ;
} }
/* /*

View File

@ -737,9 +737,9 @@ void outstring(char *s)
* *
* char *s; string to output * char *s; string to output
*/ */
void ostring(char *s) void ostring( char *s)
{ {
if (discmd) if (discmd)
while (*s) while (*s)
TTputc(*s++); TTputc( *s++ & 0xFF) ;
} }