switch(key) {
case 27:
demo_quit();
- break;
+ return;
case 127:
debug_break();
- break;
+ return;
case '`':
console_active = !console_active;
} else {
putchar('\n');
}
- break;
+ return;
case '\b':
- if(console_active && wr != rd) {
- printf("\b \b");
- fflush(stdout);
- wr = (wr + CBUF_SIZE - 1) & CBUF_MASK;
+ if(console_active) {
+ if(wr != rd) {
+ printf("\b \b");
+ fflush(stdout);
+ wr = (wr + CBUF_SIZE - 1) & CBUF_MASK;
+ }
+ return;
}
break;
}
}
console_active = 0;
+ return;
}
break;
change_screen(9);
}
- if(console_active && key < 256 && isprint(key)) {
- putchar(key);
- fflush(stdout);
-
- cbuf[wr] = key;
- wr = (wr + 1) & CBUF_MASK;
- if(wr == rd) { /* overflow */
- rd = (rd + 1) & CBUF_MASK;
+ if(console_active) {
+ if(key < 256 && isprint(key)) {
+ putchar(key);
+ fflush(stdout);
+
+ cbuf[wr] = key;
+ wr = (wr + 1) & CBUF_MASK;
+ if(wr == rd) { /* overflow */
+ rd = (rd + 1) & CBUF_MASK;
+ }
}
+ return;
}
break;
}
+
+ scr_keypress(key);
}
}