/// <summary> /// If we're in command mode and a key is processed which effects the edit we should handle /// it here /// </summary> private void CheckEnableCommandLineEdit(KeyInputStartEventArgs args) { if (_vimBuffer.ModeKind != ModeKind.Command) { return; } switch (args.KeyInput.Key) { case VimKey.Home: // Enable command line edition _margin.FocusCommandLine(moveCaretToEnd: false); args.Handled = true; break; case VimKey.Left: _margin.FocusCommandLine(moveCaretToEnd: true); args.Handled = true; break; case VimKey.Up: case VimKey.Down: // User is navigation through history, move caret to the end of the entry _margin.UpdateCaretPosition(true); break; } }
private void OnBufferKeyInputStart(object sender, KeyInputStartEventArgs e) { if (e.KeyInput.Key == VimKey.Escape) { _bufferSawEscape = true; } }
private void OnKeyInputStart(object sender, KeyInputStartEventArgs args) { // If we generated a virtual key event, mark the event as handled // to prevent the buffer's mode from processing it. if (_processingVirtualKeyInputs) { args.Handled = true; return; } _vimBufferKeyEventState.KeyInputEventCount++; CheckEnableCommandLineEdit(args); }
/// <summary> /// If we're in command mode and a key is processed which effects the edit we should handle /// it here /// </summary> private void CheckEnableCommandLineEdit(KeyInputStartEventArgs args) { if (_editKind != EditKind.None) { return; } var commandLineEditKind = CalculateCommandLineEditKind(); if (commandLineEditKind == EditKind.None) { return; } switch (args.KeyInput.Key) { case VimKey.Home: // Enable command line edition ChangeEditKind(commandLineEditKind); _margin.UpdateCaretPosition(EditPosition.Start); args.Handled = true; break; case VimKey.Left: ChangeEditKind(commandLineEditKind); _margin.UpdateCaretPosition(EditPosition.BeforeLastCharacter); args.Handled = true; break; case VimKey.Up: case VimKey.Down: // User is navigation through history, move caret to the end of the entry _margin.UpdateCaretPosition(EditPosition.End); break; } }
private void OnKeyInputStart(object sender, KeyInputStartEventArgs args) { _inKeyInputEvent = true; CheckEnableCommandLineEdit(args); }
private void OnKeyInputStart(object sender, KeyInputStartEventArgs args) { _vimBufferKeyEventState.KeyInputEventCount++; CheckEnableCommandLineEdit(args); }