Improve inputline speed

This commit is contained in:
Laura Hausmann 2023-01-18 21:09:21 +01:00
parent bd4fd3ec36
commit 2133c73491
Signed by: zotan
GPG key ID: D044E84C5BE01605

View file

@ -180,11 +180,6 @@ namespace tgcli {
public static void ScreenUpdate() {
lock (@lock) {
ClearCurrentConsoleLine();
messageQueue.ForEach(p => Console.WriteLine(p + Ansi.ResetAll));
if (messageQueue.Count > 0 && !silent)
Console.Write("\a"); //ring terminal bell
messageQueue.Clear();
var status = GetFormattedStatus(currentUserRead);
var output = prefix;
if (connectionState != "Ready")
@ -196,6 +191,12 @@ namespace tgcli {
output += " > ";
var prefixlen = GetActualStringWidth(output);
output += TruncateMessageStart(currentInputLine, Console.LargestWindowWidth - GetActualStringWidth(output));
ClearCurrentConsoleLine();
messageQueue.ForEach(p => Console.WriteLine(p + Ansi.ResetAll));
if (messageQueue.Count > 0 && !silent)
Console.Write("\a"); //ring terminal bell
messageQueue.Clear();
Console.Write(output);
Console.Write($"\u001b[{Math.Min(currentInputPos + prefixlen + 1, Console.LargestWindowWidth)}G");
}