Implement common emacs bindings (closes #3)
This commit is contained in:
parent
6382f10dae
commit
9dd2f06160
|
@ -413,7 +413,7 @@ namespace tgcli {
|
|||
}
|
||||
|
||||
public class CloseCommand : Command {
|
||||
public CloseCommand() : base("c", "^E", "closes a chat", "", 0) { }
|
||||
public CloseCommand() : base("c", "^D", "closes a chat", "", 0) { }
|
||||
|
||||
public override void Handler(List<string> inputParams) {
|
||||
if (currentChatId == 0) {
|
||||
|
@ -486,7 +486,7 @@ namespace tgcli {
|
|||
}
|
||||
|
||||
public class UnreadsCommand : Command {
|
||||
public UnreadsCommand() : base("u", "^U", "displays unread chat", "[all]", -1) { }
|
||||
public UnreadsCommand() : base("u", "", "displays unread chat", "[all]", -1) { }
|
||||
|
||||
public override void Handler(List<string> inputParams) {
|
||||
var unreads = GetUnreadChats(inputParams.Count == 1 && inputParams[0].Equals("all"));
|
||||
|
|
|
@ -289,22 +289,11 @@ namespace tgcli {
|
|||
// InsertToInputLine("⏎ ");
|
||||
// ScreenUpdate();
|
||||
// return;
|
||||
case ConsoleKey.D when key.Modifiers.HasFlag(ConsoleModifiers.Control):
|
||||
HandleCommand(currentChatId == 0 ? "q" : "c");
|
||||
ScreenUpdate();
|
||||
return;
|
||||
|
||||
case ConsoleKey.Q when key.Modifiers.HasFlag(ConsoleModifiers.Control):
|
||||
HandleCommand("q");
|
||||
ScreenUpdate();
|
||||
return;
|
||||
case ConsoleKey.E when key.Modifiers.HasFlag(ConsoleModifiers.Control):
|
||||
HandleCommand("c");
|
||||
ScreenUpdate();
|
||||
return;
|
||||
case ConsoleKey.U when key.Modifiers.HasFlag(ConsoleModifiers.Control):
|
||||
HandleCommand("u");
|
||||
ScreenUpdate();
|
||||
return;
|
||||
case ConsoleKey.O when key.Modifiers.HasFlag(ConsoleModifiers.Control):
|
||||
SetInputLine(currentInputLine switch {
|
||||
"/o " => "/os ",
|
||||
|
@ -314,10 +303,30 @@ namespace tgcli {
|
|||
});
|
||||
ScreenUpdate();
|
||||
return;
|
||||
|
||||
// standard terminal commands
|
||||
case ConsoleKey.L when key.Modifiers.HasFlag(ConsoleModifiers.Control):
|
||||
HandleCommand("cl");
|
||||
ScreenUpdate();
|
||||
return;
|
||||
case ConsoleKey.D when key.Modifiers.HasFlag(ConsoleModifiers.Control):
|
||||
HandleCommand(currentChatId == 0 ? "q" : "c");
|
||||
ScreenUpdate();
|
||||
return;
|
||||
|
||||
// input navigation
|
||||
case ConsoleKey.U when key.Modifiers.HasFlag(ConsoleModifiers.Control):
|
||||
SetInputLine("");
|
||||
ScreenUpdate();
|
||||
return;
|
||||
case ConsoleKey.A when key.Modifiers.HasFlag(ConsoleModifiers.Control):
|
||||
currentInputPos = 0;
|
||||
ScreenUpdate();
|
||||
return;
|
||||
case ConsoleKey.E when key.Modifiers.HasFlag(ConsoleModifiers.Control):
|
||||
currentInputPos = currentInputLine.Length;
|
||||
ScreenUpdate();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!SpecialKeys.Contains(key.Key)) {
|
||||
|
|
Loading…
Reference in a new issue