Mono.TextEditor.TextEditorData.EnsureIsNotVirtual C# (CSharp) Method

EnsureIsNotVirtual() private method

private EnsureIsNotVirtual ( int line, int column ) : int
line int
column int
return int
		int EnsureIsNotVirtual (int line, int column)
		{
			DocumentLine documentLine = Document.GetLine (line);
			if (documentLine == null)
				return 0;
			if (column > documentLine.Length + 1) {
				string virtualSpace;
				if (HasIndentationTracker && documentLine.Length == 0) {
					virtualSpace = GetIndentationString (line, column);
				} else {
					virtualSpace = new string (' ', column - 1 - documentLine.Length);
				}
				var oldPreserve = Caret.PreserveSelection;
				Caret.PreserveSelection = true;
				Insert (documentLine.Offset, virtualSpace);
				Caret.PreserveSelection = oldPreserve;
				
				// No need to reposition the caret, because it's already at the correct position
				// The only difference is that the position is not virtual anymore.
				return virtualSpace.Length;
			}
			return 0;
		}

Same methods

TextEditorData::EnsureIsNotVirtual ( Mono.TextEditor.DocumentLocation loc ) : int