public void Bind_PutOverSelectio_ViaP() { Create(""); _commandUtil.SetupCommandVisual(VisualCommand.NewPutOverSelection(false)); _mode.Process('P'); _commandUtil.Verify(); }
public static void SetupCommandVisual(this Mock <ICommandUtil> commandUtil, VisualCommand visualCommand, int?count = null, RegisterName registerName = null, VisualSpan visualSpan = null) { var realCount = count.HasValue ? FSharpOption.Create(count.Value) : FSharpOption <int> .None; var realName = registerName != null?FSharpOption.Create(registerName) : FSharpOption <RegisterName> .None; var commandData = new CommandData(realCount, realName); if (visualSpan != null) { var command = Command.NewVisualCommand(visualCommand, commandData, visualSpan); commandUtil .Setup(x => x.RunCommand(command)) .Returns(CommandResult.NewCompleted(ModeSwitch.SwitchPreviousMode)) .Verifiable(); } else { commandUtil .Setup(x => x.RunCommand(It.Is <Command>(command => command.IsVisualCommand && command.AsVisualCommand().Item1.Equals(visualCommand) && command.AsVisualCommand().Item2.Equals(commandData)))) .Returns(CommandResult.NewCompleted(ModeSwitch.SwitchPreviousMode)) .Verifiable(); } }
public void Bind_PutPutOverSelection_WithCaretMoveViaP() { Create(""); _commandUtil.SetupCommandVisual(VisualCommand.NewPutOverSelection(true)); _mode.Process("gP"); _commandUtil.Verify(); }
public void Bind_ChangeLineSelection_ViaR() { Create(""); _commandUtil.SetupCommandVisual(VisualCommand.NewChangeLineSelection(false)); _mode.Process('R'); _commandUtil.Verify(); }
public void Bind_ChangeCase_Tilde() { Create("foo bar", "baz"); _commandUtil.SetupCommandVisual(VisualCommand.NewChangeCase(ChangeCharacterKind.ToggleCase)); _mode.Process('~'); _commandUtil.Verify(); }
public void Bind_FormatTextLinesPreservingCaretPosition() { Create(""); _commandUtil.SetupCommandVisual(VisualCommand.NewFormatTextLines(true)); _mode.Process("gw"); _commandUtil.Verify(); }
public void Bind_Join_KeepEmptySpaces() { Create(""); _commandUtil.SetupCommandVisual(VisualCommand.NewJoinSelection(JoinKind.KeepEmptySpaces)); _mode.Process("gJ"); _commandUtil.Verify(); }
public void Bind_FormatTextLines() { Create(""); _commandUtil.SetupCommandVisual(VisualCommand.NewFormatTextLines(false)); _mode.Process("gq"); _commandUtil.Verify(); }
public void Bind_ExtendSelectionToNextMatch_Backward() { Create(""); _commandUtil.SetupCommandVisual(VisualCommand.NewExtendSelectionToNextMatch(SearchPath.Backward)); _mode.Process("gN"); _commandUtil.Verify(); }
public void Bind_ReplaceSelection() { Create(""); var keyInput = KeyInputUtil.CharToKeyInput('c'); _commandUtil.SetupCommandVisual(VisualCommand.NewReplaceSelection(keyInput)); _mode.Process("rc"); _commandUtil.Verify(); }
public AppNumericKeyboard() : base() { this.Padding = new Thickness(0, 1, 0, 0); this.BackgroundColor = Color.FromHex("#D1D5DB"); var keyCommand = new VisualCommand(this.Key); var backspaceCommand = new VisualCommand(this.Backspace); var grid = new Grid { HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.Start, RowSpacing = 1, ColumnSpacing = 1, ColumnDefinitions = { new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) } }, RowDefinitions = { new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) } } }; grid.Children.Add(this.CreateKey("1", " ", keyCommand), 0, 0); grid.Children.Add(this.CreateKey("2", "ABC", keyCommand), 1, 0); grid.Children.Add(this.CreateKey("3", "DEF", keyCommand), 2, 0); grid.Children.Add(this.CreateKey("4", "GHI", keyCommand), 0, 1); grid.Children.Add(this.CreateKey("5", "JKL", keyCommand), 1, 1); grid.Children.Add(this.CreateKey("6", "MNO", keyCommand), 2, 1); grid.Children.Add(this.CreateKey("7", "PQRS", keyCommand), 0, 2); grid.Children.Add(this.CreateKey("8", "TUV", keyCommand), 1, 2); grid.Children.Add(this.CreateKey("9", "WXYZ", keyCommand), 2, 2); grid.Children.Add(this.CreateKey("0", "", keyCommand), 1, 3); grid.Children.Add(this.CreateBackspace(backspaceCommand), 2, 3); this.Content = grid; }
public TabPageViewModel() { HomeSearchViewModel = new HomeSearchViewModel(null); StarredPlacesViewModel = new StarredPlacesViewModel(null); HomeSearchCommand = new VisualCommand(NavigateToHomeSearch); StarredLocationCommand = new VisualCommand(NavigateToStarredLocations); State = 0; //TODO: Use Constants }
protected void RunVisualCommand(VisualCommand command, VisualSpan visualSpan) { var commandData = CommandData.Default; _commandUtil.RunVisualCommand(command, commandData, visualSpan); }