private void button1_Click(object sender, EventArgs e) { int line; if (!int.TryParse(textBox1.Text, out line)) { return; } editor.EnsureVisible(line - 1); editor.GotoLine(line - 1); editor.GrabFocus(); }
private void GotoSelectedSection() { Editor = new ScintillaGateway(PluginBase.GetCurrentScintilla()); SourceNavigationItem selectedItem = (SourceNavigationItem)SNListBox.SelectedItem; int line = selectedItem.LineNumber; int linesOnScreen = Editor.LinesOnScreen(); string sectionName = selectedItem.Name.Trim().Split(' ')[0]; string lineText = Editor.GetLine(line).ToUpper(); Editor.GotoLine(line); Editor.SetFirstVisibleLine(line - linesOnScreen / 2 + 1 < 0 ? 0 : line - linesOnScreen / 2 + 1); Editor.SetSelection(Editor.PositionFromLine(line).Value + lineText.IndexOf(sectionName) + sectionName.Length, Editor.PositionFromLine(line).Value + lineText.IndexOf(sectionName)); Editor.GrabFocus(); }
private void FrmSNDlg_SNListBox_Context_Click(object sender, EventArgs e) { Editor = new ScintillaGateway(PluginBase.GetCurrentScintilla()); int line = int.Parse(((ToolStripItem)sender).Text.Split(':')[0]) - 1; int linesOnScreen = Editor.LinesOnScreen(); string lineText = Editor.GetLine(line); Editor.GotoLine(line); Editor.SetFirstVisibleLine(line - linesOnScreen / 2 + 1 < 0 ? 0 : line - linesOnScreen / 2 + 1); string sectionName = lineText.Trim().Split(' ')[1]; Editor.SetSelection(Editor.WordEndPosition(new Position(Editor.PositionFromLine(line).Value + lineText.IndexOf(sectionName)), true), Editor.PositionFromLine(line).Value + lineText.IndexOf(sectionName)); Editor.GrabFocus(); ((ToolStripItem)sender).Owner.Dispose(); }
private void frmLexerSettings_KeyDown(object sender, KeyEventArgs e) { if ((e.KeyData == Keys.Return) || (e.Alt && (e.KeyCode == Keys.G))) { btnApply.PerformClick(); e.Handled = true; } else if (e.KeyData == Keys.Escape) { editor.GrabFocus(); } else if (e.KeyCode == Keys.Tab) { Control next = GetNextControl((Control)sender, !e.Shift); while ((next == null) || (!next.TabStop)) { next = GetNextControl(next, !e.Shift); } next.Focus(); e.Handled = true; } }