ICSharpCode.TextEditor.Caret.ValidateCaretPos C# (CSharp) Метод

ValidateCaretPos() публичный Метод

If the caret position is outside the document text bounds it is set to the correct position by calling ValidateCaretPos.
public ValidateCaretPos ( ) : void
Результат void
		public void ValidateCaretPos()
		{
			line = Math.Max(0, Math.Min(textArea.Document.TotalNumberOfLines - 1, line));
			column = Math.Max(0, column);
			
			if (column == int.MaxValue || !textArea.TextEditorProperties.AllowCaretBeyondEOL) {
				LineSegment lineSegment = textArea.Document.GetLineSegment(line);
				column = Math.Min(column, lineSegment.Length);
			}
		}
		

Usage Example

Пример #1
0
 protected override void OnEnter(EventArgs e)
 {
     // SD2-1072 - Make sure the caret line is valid if anyone
     // has handlers for the Enter event.
     Caret.ValidateCaretPos();
     base.OnEnter(e);
 }
All Usage Examples Of ICSharpCode.TextEditor.Caret::ValidateCaretPos