[kbd] escape keys

This commit is contained in:
Kevin Lange 2011-02-07 18:22:03 -06:00
parent 29ec9cce80
commit a633c34e39
2 changed files with 11 additions and 2 deletions

View File

@ -98,8 +98,12 @@ void norm(int scancode) {
if (keyboard_state.shift) {
putch(kbd_us_l2[scancode]);
} else if (keyboard_state.ctrl) {
putch('^');
putch(kbd_us_l2[scancode]);
int out = (int)(kbd_us_l2[scancode] - 0x40);
if (out < 0 || out > 0x1F) {
putch(kbd_us[scancode]);
} else {
putch((char)out);
}
} else {
putch(kbd_us[scancode]);
}

View File

@ -108,6 +108,7 @@ char * kgets_buffer = NULL;
int kgets_collected = 0;
int kgets_want = 0;
int kgets_newline = 0;
int kgets_cancel = 0;
void
kgets_handler(
@ -128,6 +129,10 @@ kgets_handler(
kgets_newline = 1;
writech('\n');
return;
} else if (ch < 0x20) {
writech('^');
writech(ch + 0x40);
return;
} else {
writech(ch);
}