From 79ab1285c523bc6f8393ca0ee6def3b576f43b4b Mon Sep 17 00:00:00 2001 From: itzMiney Date: Tue, 17 Mar 2026 20:33:33 +0100 Subject: [PATCH 1/2] made some slight improvements to the terminal emulator --- src/app/about/about.component.css | 37 ++++----- src/app/about/about.component.html | 36 ++++----- .../terminal-emulator.component.css | 50 ++++++++---- .../terminal-emulator.component.html | 47 +++++++---- .../terminal-emulator.component.ts | 78 ++++++++++++++++++- 5 files changed, 170 insertions(+), 78 deletions(-) diff --git a/src/app/about/about.component.css b/src/app/about/about.component.css index fdb8b27..1a8c273 100644 --- a/src/app/about/about.component.css +++ b/src/app/about/about.component.css @@ -14,21 +14,13 @@ a { color: inherit; } -.height-container { - min-height: 100vh; - align-content: center; - justify-content: center; - display: flex; - flex-direction: column; -} - .content-bg { position: relative; display: block; } -.about-header { +.landing-container { display: flex; color: white; width: 100%; @@ -38,11 +30,7 @@ a { text-align: center; } -.title-box { - display: block; -} - -.about-header h1 { +.landing-container h1 { margin-bottom: 0; font-weight: 700; background: linear-gradient(45deg, #c3acff 0%, #a6ffb0 100%); @@ -51,7 +39,7 @@ a { color: transparent; } -.about-header .subtitle { +.landing-container .subtitle { font-size: 1.2rem; font-style: italic; margin-top: 5px; @@ -105,11 +93,10 @@ a { } .about-container { max-width: 100%; + height: 100%; overflow: clip; - min-height: calc(100vh - 80px); color: white; background: #2e2940; - padding: 80px 0 80px 0; font-family: 'Roboto', sans-serif; z-index: 1; display: flex; @@ -125,30 +112,31 @@ a { } -.terminal-title { +.titlebar { background: #26242e; + max-width: 900px; padding: 4px 8px 2px 8px; margin: auto 0; - border-radius: 20px 20px 0 0; + border-radius: 15px 15px 0 0; } .window-title { display: inline-flex; width: calc(100% - 85px); + justify-content: center; } .window-title p { margin: 0 0 0 85px; - width: 100%; text-align: center; } -.window-buttons { +.window-actions { display: inline-flex; width: 85px; } -.window-buttons p { +.window-actions p { margin: 0; width: 100%; text-align: right; @@ -156,11 +144,12 @@ a { .terminal-window { background: #1b1920; - height: 540px; + height: 520px; + max-width: 900px; margin: 0; overflow-y: auto; overflow-x: hidden; - border-radius: 0 0 20px 20px; + border-radius: 0 0 15px 15px; } @media (max-width: 768px) { diff --git a/src/app/about/about.component.html b/src/app/about/about.component.html index 780dd5c..47d84f7 100644 --- a/src/app/about/about.component.html +++ b/src/app/about/about.component.html @@ -5,26 +5,24 @@ 'linear-gradient(180deg,#1b172c 0%, #0b0b0f 100%);' "> -
-
-
-

itzMiney

-

{{ 'ABOUT_SUB' | translate}}

-
-
- -
+
+
+

itzMiney

+

{{ 'ABOUT_SUB' | translate}}

-
-
-
-
-
-

Konsole

🟡 🟣 🔴

-
-
- -
+
+ +
+
+
+
+
+
+
+

Konsole

🟡 🟣 🔴

+
+
+
diff --git a/src/app/shared/terminal-emulator/terminal-emulator.component.css b/src/app/shared/terminal-emulator/terminal-emulator.component.css index b11dbb8..c64120d 100644 --- a/src/app/shared/terminal-emulator/terminal-emulator.component.css +++ b/src/app/shared/terminal-emulator/terminal-emulator.component.css @@ -1,6 +1,6 @@ .terminal-container { padding: 0 22px; - height: 526px; + height: 498px; overflow-y: auto; overflow-x: hidden; scroll-behavior: smooth; @@ -23,23 +23,19 @@ h2 { .input-shell { position: relative; display: inline-block; - min-width: 0; } .input-mirror { display: inline-block; + white-space: none; + font: inherit; line-height: inherit; } -.input-placeholder { - display: inline; -} - .terminal-field { position: absolute; inset: 0; width: 100%; - min-width: 0; padding: 0; margin: 0; border: none; @@ -51,21 +47,39 @@ h2 { letter-spacing: inherit; } -.cursorblink { - margin-left: -12px; - animation: cursorBlink 1.25s infinite; +.input-mirror, +.terminal-field { + font-family: monospace; +} + +.cursor-block { + display: inline-block; + width: 1ch; + height: 1.2em; + background: white; + color: #1b1920; + vertical-align: baseline; +} + +.cursor-block.blink { + animation: cursorBlink 1.05s steps(1) infinite; +} + +@keyframes cursorBlink { + 0%, 50% { + background: white; + color: #1b1920; + } + 50.01%, 100% { + background: transparent; + color: white; + } } .terminal-error { color: #ff7a7a; } -@keyframes cursorBlink { - 0% { opacity: 1; } - 50% { opacity: 0; } - 100% { opacity: 1; } -} - .category { max-width: 200px; } @@ -106,7 +120,8 @@ a.green { } img { - max-width: 30%; + width: 30%; + height: auto; border-radius: 15px; } @@ -125,6 +140,7 @@ img { } .tech-stack li { + font-size: 1rem; color: #649aff; margin-bottom: 5px; } diff --git a/src/app/shared/terminal-emulator/terminal-emulator.component.html b/src/app/shared/terminal-emulator/terminal-emulator.component.html index 53ddb27..6c33ffc 100644 --- a/src/app/shared/terminal-emulator/terminal-emulator.component.html +++ b/src/app/shared/terminal-emulator/terminal-emulator.component.html @@ -43,23 +43,30 @@ $ - - {{ command }} - @if (!command) { -   - } - █ - - + + + + } @@ -69,7 +76,13 @@ - cat + cat +

lil goober

diff --git a/src/app/shared/terminal-emulator/terminal-emulator.component.ts b/src/app/shared/terminal-emulator/terminal-emulator.component.ts index 99f5881..874a80e 100644 --- a/src/app/shared/terminal-emulator/terminal-emulator.component.ts +++ b/src/app/shared/terminal-emulator/terminal-emulator.component.ts @@ -42,6 +42,11 @@ export class TerminalEmulatorComponent implements OnInit, OnChanges { booting = true; private hasBooted = false; + caretIndex = 0; + isFocused = false; + shouldBlink = true; + private blinkResumeTimer: ReturnType | null = null; + private rootEntries: TerminalEntry[] = [ { name: 'about.txt', type: 'file' }, { name: 'tools', type: 'dir' }, @@ -108,6 +113,11 @@ export class TerminalEmulatorComponent implements OnInit, OnChanges { } } + onEnter(event: Event): void { + event.preventDefault(); + this.runCommand(); + } + runCommand() { const cmd = this.command.trim(); if (!cmd || this.booting) return; @@ -185,6 +195,7 @@ export class TerminalEmulatorComponent implements OnInit, OnChanges { } this.command = ''; + this.caretIndex = 0; this.scrollToBottom(); } @@ -261,13 +272,78 @@ export class TerminalEmulatorComponent implements OnInit, OnChanges { } } + get beforeCursor(): string { + return this.command.slice(0, this.caretIndex); + } + + get cursorChar(): string { + const ch = this.command[this.caretIndex]; + + if (ch === ' ') return '\u00A0'; + return ch ?? '\u00A0'; + } + + get afterCursor(): string { + return this.command.slice(this.caretIndex + (this.caretIndex < this.command.length ? 1 : 0)); + } + + handleCursorActivity(): void { + this.syncCursor(); + this.restartBlink(); + } + focusInput() { if (!this.booting && this.terminalInput) { this.terminalInput.nativeElement.focus(); + this.syncCursor(); } } - private scrollToBottom() { + onFocus(): void { + this.isFocused = true; + this.restartBlink(); + this.syncCursor(); + } + + onBlur(): void { + this.isFocused = false; + this.shouldBlink = false; + + if (this.blinkResumeTimer) { + clearTimeout(this.blinkResumeTimer); + this.blinkResumeTimer = null; + } + + this.syncCursor(); + } + + onKeydown(_: KeyboardEvent): void { + queueMicrotask(() => { + this.syncCursor(); + this.restartBlink(); + }); + } + + syncCursor(): void { + const input = this.terminalInput?.nativeElement; + if (!input) return; + + this.caretIndex = input.selectionStart ?? this.command.length; + } + + private restartBlink(): void { + this.shouldBlink = false; + + if (this.blinkResumeTimer) { + clearTimeout(this.blinkResumeTimer); + } + + this.blinkResumeTimer = setTimeout(() => { + this.shouldBlink = true; + }, 10); + } + + protected scrollToBottom() { setTimeout(() => { if (!this.terminalOutput) return; const el = this.terminalContainer.nativeElement; From d43cbcc5c9cfc9d18cc6696bd3921cf6e3fe0243 Mon Sep 17 00:00:00 2001 From: itzMiney Date: Tue, 17 Mar 2026 20:35:26 +0100 Subject: [PATCH 2/2] another small improvement --- .../terminal-emulator/terminal-emulator.component.html | 2 +- .../shared/terminal-emulator/terminal-emulator.component.ts | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/app/shared/terminal-emulator/terminal-emulator.component.html b/src/app/shared/terminal-emulator/terminal-emulator.component.html index 6c33ffc..f437dde 100644 --- a/src/app/shared/terminal-emulator/terminal-emulator.component.html +++ b/src/app/shared/terminal-emulator/terminal-emulator.component.html @@ -61,7 +61,7 @@ (click)="handleCursorActivity()" (keyup)="handleCursorActivity()" (keydown)="onKeydown($event)" - (keydown.enter)="onEnter($event)" + (keydown.enter)="$event.preventDefault(); runCommand()" (focus)="onFocus()" (blur)="onBlur()" class="terminal-field" diff --git a/src/app/shared/terminal-emulator/terminal-emulator.component.ts b/src/app/shared/terminal-emulator/terminal-emulator.component.ts index 874a80e..397dc56 100644 --- a/src/app/shared/terminal-emulator/terminal-emulator.component.ts +++ b/src/app/shared/terminal-emulator/terminal-emulator.component.ts @@ -113,11 +113,6 @@ export class TerminalEmulatorComponent implements OnInit, OnChanges { } } - onEnter(event: Event): void { - event.preventDefault(); - this.runCommand(); - } - runCommand() { const cmd = this.command.trim(); if (!cmd || this.booting) return;