Fix #43 alternate shortcut for copy (Ctrl+Ins) not working if Options.AllowToggleOverstrikeMode is enabled.
Based on @nippur72's fix in #44.
This commit is contained in:
Родитель
0e8be49c76
Коммит
379439bac1
|
@ -26,6 +26,16 @@ namespace ICSharpCode.AvalonEdit
|
|||
/// </summary>
|
||||
public static class AvalonEditCommands
|
||||
{
|
||||
/// <summary>
|
||||
/// Toggles Overstrike mode
|
||||
/// The default shortcut is Ins.
|
||||
/// </summary>
|
||||
public static readonly RoutedCommand ToggleOverstrike = new RoutedCommand(
|
||||
"ToggleOverstrike", typeof(TextEditor),
|
||||
new InputGestureCollection {
|
||||
new KeyGesture(Key.Insert)
|
||||
});
|
||||
|
||||
/// <summary>
|
||||
/// Deletes the current line.
|
||||
/// The default shortcut is Ctrl+D.
|
||||
|
|
|
@ -78,6 +78,7 @@ namespace ICSharpCode.AvalonEdit.Editing
|
|||
CommandBindings.Add(new CommandBinding(ApplicationCommands.Cut, OnCut, CanCutOrCopy));
|
||||
CommandBindings.Add(new CommandBinding(ApplicationCommands.Paste, OnPaste, CanPaste));
|
||||
|
||||
CommandBindings.Add(new CommandBinding(AvalonEditCommands.ToggleOverstrike, OnToggleOverstrike));
|
||||
CommandBindings.Add(new CommandBinding(AvalonEditCommands.DeleteLine, OnDeleteLine));
|
||||
|
||||
CommandBindings.Add(new CommandBinding(AvalonEditCommands.RemoveLeadingWhitespace, OnRemoveLeadingWhitespace));
|
||||
|
@ -484,6 +485,15 @@ namespace ICSharpCode.AvalonEdit.Editing
|
|||
}
|
||||
#endregion
|
||||
|
||||
#region Toggle Overstrike
|
||||
static void OnToggleOverstrike(object target, ExecutedRoutedEventArgs args)
|
||||
{
|
||||
TextArea textArea = GetTextArea(target);
|
||||
if (textArea != null && textArea.Options.AllowToggleOverstrikeMode)
|
||||
textArea.OverstrikeMode = !textArea.OverstrikeMode;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region DeleteLine
|
||||
static void OnDeleteLine(object target, ExecutedRoutedEventArgs args)
|
||||
{
|
||||
|
|
|
@ -971,13 +971,6 @@ namespace ICSharpCode.AvalonEdit.Editing
|
|||
protected override void OnPreviewKeyDown(KeyEventArgs e)
|
||||
{
|
||||
base.OnPreviewKeyDown(e);
|
||||
|
||||
if (!e.Handled && e.Key == Key.Insert && this.Options.AllowToggleOverstrikeMode) {
|
||||
this.OverstrikeMode = !this.OverstrikeMode;
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (TextAreaStackedInputHandler h in stackedInputHandlers) {
|
||||
if (e.Handled)
|
||||
break;
|
||||
|
|
Загрузка…
Ссылка в новой задаче