private void XKeyDown(object sender, KeyEventArgs e) { string line = null; if (e.KeyCode == Keys.Enter) { if (SelectionLength == 0) { int lineNo = GetLineFromCharIndex(SelectionStart); if (lineNo < Lines.Length) { line = Lines[lineNo]; } } else { // line = SelectedText.Replace("\n>", " "); // ?? this should be done where prompt is set and use prompt line = SelectedText; } if (line != null) { parent.DelayedExecute(line); if (SelectionStart != Text.Length) { e.Handled = true; // do not let Enter insert CR unless at very end } } } }
protected override bool IsInputKey(Keys keyData) { if (keyData == Keys.Enter) { int lineNo = GetLineFromCharIndex(SelectionStart); if (lineNo < Lines.Length) { string line = Lines[lineNo]; parent.DelayedExecute(line); } } return(base.IsInputKey(keyData)); }