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 Td = TdLib;
using static telegram.Util;
// ReSharper disable SwitchStatementMissingSomeEnumCasesNoDefault
namespace telegram
{
/*
* TODO:
* make the command system not shit (classes & manager & /help etc)
* reply to x messages ago
* cap length & truncate extremely long chat names!
* 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?)
* waaay more error messages instead of just doing nothing
* make Util.getActualStringWidth better
* make the command system not shit (classes & manager & /help etc)
* refactor everything
* add option to disable terminal bell
* command /s /search -> list matching chats, option 1-n, archived indicator
@ -235,24 +236,39 @@ namespace telegram
break;
default:
{
if (key.Key == ConsoleKey.N && key.Modifiers.HasFlag(ConsoleModifiers.Control))
switch (key.Key)
{
currentInputLine += "⏎";
ScreenUpdate();
return;
}
if (key.Key == ConsoleKey.D && key.Modifiers.HasFlag(ConsoleModifiers.Control))
{
Command.ParseCommand("q");
ScreenUpdate();
return;
}
if (key.Key == ConsoleKey.L && key.Modifiers.HasFlag(ConsoleModifiers.Control))
{
Command.ParseCommand("cl");
ScreenUpdate();
return;
case ConsoleKey.N when key.Modifiers.HasFlag(ConsoleModifiers.Control):
currentInputLine += "⏎";
ScreenUpdate();
return;
case ConsoleKey.D when key.Modifiers.HasFlag(ConsoleModifiers.Control):
Command.ParseCommand("q");
ScreenUpdate();
return;
case ConsoleKey.Q when key.Modifiers.HasFlag(ConsoleModifiers.Control):
Command.ParseCommand("q");
ScreenUpdate();
return;
case ConsoleKey.E when key.Modifiers.HasFlag(ConsoleModifiers.Control):
Command.ParseCommand("c");
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))
{
currentInputLine += key.KeyChar;