update keyboard shortcuts

This commit is contained in:
Laura Hausmann 2019-12-12 21:22:22 +01:00
parent 58bab110cb
commit bce56bdc53
Signed by: zotan
GPG key ID: 5EC1D38FFC321311

View file

@ -6,11 +6,13 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Td = TdLib; using Td = TdLib;
using static telegram.Util; using static telegram.Util;
// ReSharper disable SwitchStatementMissingSomeEnumCasesNoDefault
namespace telegram namespace telegram
{ {
/* /*
* TODO: * TODO:
* make the command system not shit (classes & manager & /help etc)
* reply to x messages ago * reply to x messages ago
* cap length & truncate extremely long chat names! * cap length & truncate extremely long chat names!
* replace emoji on send & un-replace on edit, two-way dictionary!! * replace emoji on send & un-replace on edit, two-way dictionary!!
@ -18,7 +20,6 @@ namespace telegram
* make typing newlines actually good (inputline as list?) * make typing newlines actually good (inputline as list?)
* waaay more error messages instead of just doing nothing * waaay more error messages instead of just doing nothing
* make Util.getActualStringWidth better * make Util.getActualStringWidth better
* make the command system not shit (classes & manager & /help etc)
* refactor everything * refactor everything
* add option to disable terminal bell * add option to disable terminal bell
* command /s /search -> list matching chats, option 1-n, archived indicator * command /s /search -> list matching chats, option 1-n, archived indicator
@ -235,24 +236,39 @@ namespace telegram
break; break;
default: default:
{ {
if (key.Key == ConsoleKey.N && key.Modifiers.HasFlag(ConsoleModifiers.Control)) switch (key.Key)
{ {
currentInputLine += "⏎"; case ConsoleKey.N when key.Modifiers.HasFlag(ConsoleModifiers.Control):
ScreenUpdate(); currentInputLine += "⏎";
return; ScreenUpdate();
} return;
if (key.Key == ConsoleKey.D && key.Modifiers.HasFlag(ConsoleModifiers.Control)) case ConsoleKey.D when key.Modifiers.HasFlag(ConsoleModifiers.Control):
{ Command.ParseCommand("q");
Command.ParseCommand("q"); ScreenUpdate();
ScreenUpdate(); return;
return; case ConsoleKey.Q when key.Modifiers.HasFlag(ConsoleModifiers.Control):
} Command.ParseCommand("q");
if (key.Key == ConsoleKey.L && key.Modifiers.HasFlag(ConsoleModifiers.Control)) ScreenUpdate();
{ return;
Command.ParseCommand("cl"); case ConsoleKey.E when key.Modifiers.HasFlag(ConsoleModifiers.Control):
ScreenUpdate(); Command.ParseCommand("c");
return; ScreenUpdate();
return;
case ConsoleKey.U when key.Modifiers.HasFlag(ConsoleModifiers.Control):
Command.ParseCommand("u");
ScreenUpdate();
return;
case ConsoleKey.O when key.Modifiers.HasFlag(ConsoleModifiers.Control):
if (string.IsNullOrWhiteSpace(currentInputLine))
currentInputLine = "/o ";
ScreenUpdate();
return;
case ConsoleKey.L when key.Modifiers.HasFlag(ConsoleModifiers.Control):
Command.ParseCommand("cl");
ScreenUpdate();
return;
} }
if (!SpecialKeys.Contains(key.Key)) if (!SpecialKeys.Contains(key.Key))
{ {
currentInputLine += key.KeyChar; currentInputLine += key.KeyChar;