Author: mesyeti <mesyeti@mesyeti.uk>
resizing working
source/interpreter/vt100.c | 88 ++++++++++++++++++++------------------- source/terminal.c | 7 ++
diff --git a/source/interpreter/vt100.c b/source/interpreter/vt100.c index a6516b8e5f4f4f0511727b4cbc468feed0d06acc..44ba4c3df78aba47a9f152eafa06c44fd44f64de 100644 --- a/source/interpreter/vt100.c +++ b/source/interpreter/vt100.c @@ -500,58 +500,62 @@ } case 'h': { if (!q || (num < 1)) break; - int param = atoi(parts[0]); + for (int i = 0; i < num; ++ i) { + int param = atoi(parts[i]); - switch (param) { - case 9: this->mouseMode = MOUSE_PRESS; break; - case 12: terminal->blinkCursor = true; break; - case 25: terminal->showCursor = true; break; - case 1047: - case 47: break; // TODO: show alternate screen buffer - case 1000: this->mouseMode = MOUSE_BOTH; break; - case 1001: break; // TODO: use hilite motion mouse tracking - case 1002: break; // TODO: use cell motion mouse tracking - case 1003: break; // TODO: use all motion mouse tracking - case 1048: { - this->savedCursor = terminal->cursor; - break; - } - case 1049: { - this->savedCursor = terminal->cursor; - break; - // TODO: switch to alternate screen buffer + switch (param) { + case 9: this->mouseMode = MOUSE_PRESS; break; + case 12: terminal->blinkCursor = true; break; + case 25: terminal->showCursor = true; break; + case 1047: + case 47: break; // TODO: show alternate screen buffer + case 1000: this->mouseMode = MOUSE_BOTH; break; + case 1001: break; // TODO: use hilite motion mouse tracking + case 1002: break; // TODO: use cell motion mouse tracking + case 1003: break; // TODO: use all motion mouse tracking + case 1048: { + this->savedCursor = terminal->cursor; + break; + } + case 1049: { + this->savedCursor = terminal->cursor; + break; + // TODO: switch to alternate screen buffer + } + case 2004: break; // TODO: bracketed paste mode + default: printf("Unsupported: %dh\n", param); } - case 2004: break; // TODO: bracketed paste mode - default: printf("Unsupported: %dh\n", param); } break; } case 'l': { if (!q || (num < 1)) break; - int param = atoi(parts[0]); + for (int i = 0; i < num; ++ i) { + int param = atoi(parts[i]); - switch (param) { - case 9: this->mouseMode = MOUSE_OFF; break; - case 12: terminal->blinkCursor = false; break; - case 25: terminal->showCursor = false; break; - case 1047: - case 47: break; // TODO: use normal screen buffer - case 1000: this->mouseMode = MOUSE_OFF; break; - case 1001: break; // TODO: do not use hilite motion mouse tracking - case 1002: break; // TODO: do not use cell motion mouse tracking - case 1003: break; // TODO: do not use all motion mouse tracking - case 1048: { - terminal->cursor = this->savedCursor; - break; - } - case 1049: { - terminal->cursor = this->savedCursor; - break; - // TODO: switch to normal screen buffer + switch (param) { + case 9: this->mouseMode = MOUSE_OFF; break; + case 12: terminal->blinkCursor = false; break; + case 25: terminal->showCursor = false; break; + case 1047: + case 47: break; // TODO: use normal screen buffer + case 1000: this->mouseMode = MOUSE_OFF; break; + case 1001: break; // TODO: do not use hilite motion mouse tracking + case 1002: break; // TODO: do not use cell motion mouse tracking + case 1003: break; // TODO: do not use all motion mouse tracking + case 1048: { + terminal->cursor = this->savedCursor; + break; + } + case 1049: { + terminal->cursor = this->savedCursor; + break; + // TODO: switch to normal screen buffer + } + case 2004: break; // TODO: bracketed paste mode + default: printf("Unsupported: %dl\n", param); } - case 2004: break; // TODO: bracketed paste mode - default: printf("Unsupported: %dl\n", param); } break; } diff --git a/source/terminal.c b/source/terminal.c index 7bf0e0e78e2c415d8ef34d999e06bb2fae98533a..e791b979855b03fe0313720fe7f7c174a0a488dd 100644 --- a/source/terminal.c +++ b/source/terminal.c @@ -57,8 +57,11 @@ } } void Terminal_Resize(Terminal* terminal, int w, int h) { - terminal->height = h; + int diff = h - terminal->height; + + terminal->scroll -= diff; + terminal->height = h; Buffer_Resize(&terminal->buffer, w, terminal->buffer.height); - SysTerm_UpdateSize(&terminal->term, w, terminal->buffer.height); + SysTerm_UpdateSize(&terminal->term, w, h); }