Exemple #1
0
 public void GotoPosAndFocus(ScintillaNet.ScintillaControl sci, int position)
 {
     int pos = sci.MBSafePosition(position);
     int line = sci.LineFromPosition(pos);
     sci.EnsureVisible(line);
     sci.GotoPos(pos);
 }
Exemple #2
0
		private void GotoPosAndFocus(ScintillaNet.ScintillaControl sci, int position)
		{
			// don't correct to multi-byte safe position (assumed correct)
			sci.GotoPos(position);
			int line = sci.LineFromPosition(position);
			// TODO  The folding makes the line centering fail - solution: expand all folds / make it smarter.
			//sci.EnsureVisible(line);
			sci.ExpandAllFolds();
			int top = sci.FirstVisibleLine;
			int middle = top + sci.LinesOnScreen/2;
			sci.LineScroll(0, line-middle);
			((Control)sci).Focus();
		}