Commit 6f84fb87 authored by deuce's avatar deuce
Browse files

Support 0xe0 (enhanced keyboard) doorway codes on input.

Add support for the abort key.
parent 16e2739d
......@@ -664,7 +664,37 @@ static void ansi_keyparse(void *par)
sem_wait(&got_key);
ch=ansi_raw_inch;
if(gotnull) {
if(ch==-2) {
ansi_inch=0x0100;
sem_post(&got_input);
/* Two-byte code, need to post twice times and wait for one to
be received */
sem_wait(&used_input);
sem_wait(&goahead);
sem_post(&got_input);
sem_wait(&used_input);
}
if(gotnull==2) {
// 0xe0 enhanced keyboard key... translate to 0x00 key for now.
ansi_inch=ch<<8; // (ch<<8)|0xe0;
sem_post(&got_input);
/* Two-byte code, need to post twice times and wait for one to
be received */
sem_wait(&used_input);
sem_wait(&goahead);
sem_post(&got_input);
sem_wait(&used_input);
gotnull=0;
continue;
}
if(gotnull==1) {
if(ch==0xe0) {
gotnull=2;
// Need another key... keep looping.
sem_post(&goahead);
continue;
}
ansi_inch=ch<<8;
sem_post(&got_input);
/* Two-byte code, need to post twice and wait for one to
......@@ -781,7 +811,7 @@ static void ansi_keythread(void *params)
sem_getvalue(&got_key,&sval);
if(!sval) {
ansi_raw_inch=ciolib_ansi_readbyte_cb();
if(ansi_raw_inch >= 0)
if(ansi_raw_inch >= 0 || ansi_raw_inch==-2)
sem_post(&got_key);
else
SLEEP(1);
......
......@@ -404,12 +404,13 @@ CIOLIBEXPORT int CIOLIBCALL ciolib_getche(void)
else {
while(1) {
ch=ciolib_getch();
if(ch) {
if(ch != 0 && ch != 0xe0) {
ciolib_putch(ch);
return(ch);
}
/* Eat extended chars */
ciolib_getch();
/* Eat extended chars - except ESC which is an abort */
if(ciolib_getch()==1)
return(EOF);
}
}
}
......@@ -466,8 +467,10 @@ CIOLIBEXPORT char * CIOLIBCALL ciolib_cgets(char *str)
maxlen=*(unsigned char *)str;
while((ch=ciolib_getch())!='\n' && ch !='\r') {
switch(ch) {
case 0: /* Skip extended keys */
ciolib_getche();
case 0: /* Skip extended keys */
case 0xe0: /* Skip extended keys */
if(ciolib_getche()==1)
goto early_return;
break;
case '\r': /* Skip \r (ToDo: Should this be treated as a \n? */
break;
......@@ -492,6 +495,7 @@ CIOLIBEXPORT char * CIOLIBCALL ciolib_cgets(char *str)
break;
}
}
early_return;
str[len+2]=0;
*((unsigned char *)(str+1))=(unsigned char)len;
ciolib_putch('\r');
......@@ -563,8 +567,10 @@ CIOLIBEXPORT char * CIOLIBCALL ciolib_getpass(const char *prompt)
ciolib_cputs((char *)prompt);
while((ch=ciolib_getch())!='\n') {
switch(ch) {
case 0: /* Skip extended keys */
ciolib_getch();
case 0: /* Skip extended keys */
case 0xe0: /* Skip extended keys */
if(ciolib_getch()==1)
goto early_return;
break;
case '\r': /* Skip \r (ToDo: Should this be treeated as a \n? */
break;
......@@ -583,6 +589,7 @@ CIOLIBEXPORT char * CIOLIBCALL ciolib_getpass(const char *prompt)
break;
}
}
early_return:
pass[len]=0;
return(pass);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment