void OnKeyPressed(object source, KeyEventArgs args) { if (ActionMap.Consume(args)) { args.Consume(); return; } var isControlDown = args.Flags.IsControlDown(); var isShiftDown = args.Flags.IsShiftDown(); // ReSharper disable once SwitchStatementMissingSomeCases switch (args.Key) { case Keys.Left: { NavigateTo(Navigate(Direction.Left, isControlDown), isShiftDown); args.Consume(); break; } case Keys.Right: { NavigateTo(Navigate(Direction.Right, isControlDown), isShiftDown); args.Consume(); break; } case Keys.Up: { NavigateTo(Navigate(Direction.Up, isControlDown), isShiftDown); args.Consume(); break; } case Keys.Down: { NavigateTo(Navigate(Direction.Down, isControlDown), isShiftDown); args.Consume(); break; } case Keys.End: { NavigateTo(isControlDown ? Content.Document.TextLength : NavigateToEndOfLine(), isShiftDown); args.Consume(); break; } case Keys.Home: { NavigateTo(isControlDown ? 0 : NavigateToStartOfLine(), isShiftDown); args.Consume(); break; } default: { break; } } }