From 829cd2eaa1c2b2a73fc90b2f02be19ee556257ed Mon Sep 17 00:00:00 2001 From: venizelou andreas Date: Sat, 11 May 2024 20:22:18 +0300 Subject: [PATCH] Terminal, minor --- Protest/Front/terminal.js | 36 +++++++++++++++++++++++++++++------- Protest/Protocols/Telnet.cs | 5 ++++- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/Protest/Front/terminal.js b/Protest/Front/terminal.js index ef395c95..7b316e7a 100644 --- a/Protest/Front/terminal.js +++ b/Protest/Front/terminal.js @@ -44,7 +44,6 @@ class Terminal extends Window { this.cursorElement = document.createElement("div"); this.cursorElement.className = "terminal-cursor"; - this.content.appendChild(this.cursorElement); this.win.onclick = ()=> this.content.focus(); this.content.onfocus = ()=> this.BringToFront(); @@ -55,9 +54,7 @@ class Terminal extends Window { this.sendKeyButton.onclick = ()=> this.CustomKeyDialog(); this.pasteButton.onclick = ()=> this.ClipboardDialog(); - if (this.params.host.length > 0) { - this.ConnectDialog(this.params.host, true); - } + this.ConnectDialog(this.params.host, true); } Close() { //overrides @@ -297,8 +294,15 @@ class Terminal extends Window { this.connectButton.disabled = false; }; - this.ws.onmessage = event=> { - this.HandleMessage(event.data); + let ack = false; + this.ws.onmessage = ()=> { + if (!ack) { + ack = true; + } + else { + this.content.appendChild(this.cursorElement); + this.ws.onmessage = event=> this.HandleMessage(event.data); + } }; } @@ -605,7 +609,25 @@ class Terminal extends Window { break; case "P": //delete n chars - this.EraseLineFromCursorToEnd(); + if (values.length === 0) break; + + //find last character in current line + let x; + for (x=this.cursor.x; x