Lock input line to bottom of terminal

This commit is contained in:
Laura Hausmann 2023-01-23 20:52:16 +01:00
parent f3372f39e4
commit 60ad19e914
Signed by: zotan
GPG key ID: D044E84C5BE01605
2 changed files with 7 additions and 2 deletions

View file

@ -482,6 +482,8 @@ public class ClearCommand : Command {
public override void Handler(List<string> inputParams) { public override void Handler(List<string> inputParams) {
lock (@lock) { lock (@lock) {
Console.Clear(); Console.Clear();
if (lockInputToBottom)
Console.SetCursorPosition(0, Console.LargestWindowHeight);
} }
} }
} }

View file

@ -26,8 +26,9 @@ namespace tgcli;
// ReSharper disable once InconsistentNaming // ReSharper disable once InconsistentNaming
public static class tgcli { public static class tgcli {
public static volatile Td.TdClient client = new(); public const bool lockInputToBottom = true;
public static string dbdir = ""; public static volatile Td.TdClient client = new();
public static string dbdir = "";
public static volatile bool authorized; public static volatile bool authorized;
public static volatile string connectionState = "Connecting"; public static volatile string connectionState = "Connecting";
public static long currentChatId = 0; public static long currentChatId = 0;
@ -67,6 +68,8 @@ public static class tgcli {
Thread.Sleep(1); Thread.Sleep(1);
} }
if (lockInputToBottom)
Console.SetCursorPosition(0, Console.LargestWindowHeight);
ScreenUpdate(); ScreenUpdate();
while (!quitting) while (!quitting)
MainLoop(); MainLoop();