private void HandleQueryBoxKey(object sender, KeyEventArgs e) { if (e.Key == Key.F5) { RunQuery(); } else if (e.Key == Key.D && Keyboard.Modifiers == ModifierKeys.Control) { string text = _queryTextBox.Text; string[] lines = text.Split('\n'); int pos = 0; string lineToDuplicate = string.Empty; foreach (string line in lines) { pos += line.Length + 1; if (_queryTextBox.CaretOffset <= pos) { lineToDuplicate = line; } } _queryTextBox.AppendText(Environment.NewLine + lineToDuplicate); // TODO: put dup on next line instead of at the end } else if (e.Key == Key.F && Keyboard.Modifiers == ModifierKeys.Control) { _findDialog = new FindDialog(); _findDialog.Editor = _queryTextBox; _findDialog.Show(); } }