diff options
author | Alex AUVOLAT <alexis211@gmail.com> | 2013-06-08 23:09:52 +0200 |
---|---|---|
committer | Alex AUVOLAT <alexis211@gmail.com> | 2013-06-08 23:09:52 +0200 |
commit | 4d65fcb9a8b6c7c6fd5a3390c46a96d11b6a80d4 (patch) | |
tree | c193acf64ff2db985f6664f161cf586c3caeb684 /src/kernel/ui | |
parent | eae9997d3c2dbaef53022ddabe61c1800a619499 (diff) | |
download | TCE-4d65fcb9a8b6c7c6fd5a3390c46a96d11b6a80d4.tar.gz TCE-4d65fcb9a8b6c7c6fd5a3390c46a96d11b6a80d4.zip |
All FWIK is deleted. YOSH is now pure C. Not-working KBASIC included.
Diffstat (limited to 'src/kernel/ui')
-rw-r--r-- | src/kernel/ui/vt.cpp | 41 | ||||
-rw-r--r-- | src/kernel/ui/vt.h | 2 |
2 files changed, 10 insertions, 33 deletions
diff --git a/src/kernel/ui/vt.cpp b/src/kernel/ui/vt.cpp index 3bed897..6876806 100644 --- a/src/kernel/ui/vt.cpp +++ b/src/kernel/ui/vt.cpp @@ -18,7 +18,6 @@ vt::vt(node* parent, int ww, int hh) : node(parent, FT_TERMINAL) { bgcolor = TC_BLACK; output = 0; cursor_visible = true; - keyboard_echo = false; csr_l = csr_c = 0; kbd_buffer_filled = 0; @@ -194,9 +193,12 @@ void vt::keyboardInput(keypress kp, keyboard* from) { if ((kp.command == 0 || kp.command == KB_ENTER || kp.command == KB_TAB || kp.command == KB_BACKSPACE) && kp.character != 0 && kp.pressed) { b[n++] = (char)kp.character; - } else if (kp.command == KB_CMD_ALT && kp.character >= 64 && kp.character <= 126 && kp.pressed) { + } else if ((kp.command & KB_CMD_ALT) && kp.character >= 64 && kp.character <= 126 && kp.pressed) { b[n++] = 27; b[n++] = kp.character; + } else if ((kp.command & KB_CMD_CTRL) && kp.character >= 'A' && kp.character <= 'z' && kp.pressed) { + if (kp.character >= 'A' && kp.character <= 'Z') b[n++] = 1 + kp.character - 'A'; + if (kp.character >= 'a' && kp.character <= 'z') b[n++] = 1 + kp.character - 'a'; } else if (kb_cmd_esc[kp.command & 0x3F] != 0 && kp.pressed) { int i; for (i = 0; kb_cmd_esc[kp.command & 0x3F][i] != 0; i++) { @@ -330,10 +332,6 @@ int vt::write(size_t offset, size_t len, char* buffer) { } else if (buffer[i] == 'p') { // restore cursor position csr_l = save_csr_l; csr_c = save_csr_c; - } else if (buffer[i] == 'e') { // CUSTOM : enable keyboard echo - keyboard_echo = true; - } else if (buffer[i] == 'h') { // CUSTOM : disable keyboard echo - keyboard_echo = false; } else if (buffer[i] == '?') { if (buffer[++i] == '2' && buffer[++i] == '5') { if (buffer[++i] == 'l') cursor_visible = false; @@ -361,38 +359,17 @@ int vt::read(size_t offset, size_t len, char* buffer) { unsigned c = 0; while (true) { - bool end = false; if (kbd_buffer_filled > 0) { int r = 0; - if (keyboard_echo) { - for (; r < kbd_buffer_filled; r++) { - if (kbd_buffer[r] == '\b') { - if (c > 0) { - c--; - put('\b'); - } - } else if (kbd_buffer[r] == '\n') { - buffer[c++] = '\n'; - c++; - put('\n'); - end = true; - break; - } else if (kbd_buffer[r] >= ' ') { - buffer[c++] = kbd_buffer[r]; - put(buffer[c]); - } - if (c == len) break; - } - } else { - while (r < kbd_buffer_filled && c < len) { - buffer[c++] = kbd_buffer[r++]; - } - end = true; + while (r < kbd_buffer_filled && c < len) { + buffer[c++] = kbd_buffer[r++]; } + memcpy(kbd_buffer + r, kbd_buffer, (kbd_buffer_filled - r)); kbd_buffer_filled -= r; + + return c; } - if (end || c == len) return c; if (kbd_waiter != 0) return c; kbd_waiter = current_thread; diff --git a/src/kernel/ui/vt.h b/src/kernel/ui/vt.h index a29716f..8a169b4 100644 --- a/src/kernel/ui/vt.h +++ b/src/kernel/ui/vt.h @@ -19,7 +19,7 @@ class vt : public node { vt_char *text; void put_at(int l, int c, int ch); - bool cursor_visible, keyboard_echo; + bool cursor_visible; int kbd_buffer_filled; char kbd_buffer[KBD_BUFFER_SIZE]; |