public PerformTextInput ( System.Windows.Input.TextCompositionEventArgs e ) : void | ||
e | System.Windows.Input.TextCompositionEventArgs | |
리턴 | void |
static void OnEnter(object target, ExecutedRoutedEventArgs args) { TextArea textArea = GetTextArea(target); if (textArea != null && textArea.IsKeyboardFocused) { textArea.PerformTextInput("\n"); args.Handled = true; } }
static void OnEnter(object target, ExecutedRoutedEventArgs args) { TextArea textArea = GetTextArea(target); if (textArea != null && textArea.IsKeyboardFocused) { // [DIGITALRUNE] Enter MUST NOT be handled when another control has the focus. // Note: OnEnter is called via CommandBinding with KeyGesture = Enter. if (!textArea.IsKeyboardFocused) { return; } textArea.PerformTextInput("\n"); args.Handled = true; } }
private static void OnEnter(object target, ExecutedRoutedEventArgs args) { TextArea textArea = GetTextArea(target); if (textArea != null && textArea.IsKeyboardFocused) { textArea.PerformTextInput("\n"); var a = textArea.Document.GetLineByOffset(textArea.Caret.Offset); var b = a.PreviousLine; if (b == null) { return; } var c = b.PreviousLine; if (c == null) { return; } if (c.obs != null) { var obs = c.obs; var bs = textArea.Document.Text.Substring(b.Offset, b.Length + b.DelimiterLength); if (!string.IsNullOrWhiteSpace(bs)) { var cs = textArea.Document.Text.Substring(c.Offset, c.Length + c.DelimiterLength); textArea.Document.Remove(c.Offset, bs.Length + cs.Length); } else { var cs = textArea.Document.Text.Substring(c.Offset, c.Length + c.DelimiterLength); textArea.Document.Remove(c.Offset, bs.Length + cs.Length); textArea.Document.Insert(c.Offset, bs + cs); a = textArea.Document.GetLineByOffset(textArea.Caret.Offset); b = a.PreviousLine; b.obs = obs; } } args.Handled = true; } }