internal void DeleteInBounds(SelectedTextBounds bounds) { var startStr = bounds.RealStart.Str; var startNum = bounds.RealStart.Chr; var endStr = bounds.RealEnd.Str; var endNum = bounds.RealEnd.Chr; if (bounds.IsOnOneLine) { _textLines[startStr] = _textLines[startStr].Remove(startNum, endNum - startNum); } else { if (startNum != _textLines[startStr].Length) { _textLines[startStr] = _textLines[startStr].Remove(startNum); } _textLines[startStr] += _textLines[endStr].Substring(endNum); var from = startStr + 1; var count = endStr - startStr; _textLines.RemoveRange(from, count); RemoveLineEvent?.Invoke(this, new TextLineEventArgs(from, count)); } UpdateLineEvent?.Invoke(this, new TextLineEventArgs(startStr)); }
public void RemoveInLine(int lineIndex, int startIndex) { _textLines[lineIndex] = _textLines[lineIndex].Remove(startIndex); UpdateLineEvent?.Invoke(this, new TextLineEventArgs(lineIndex)); }
public void AddInLine(int lineIndex, string toAdd) { _textLines[lineIndex] += toAdd; UpdateLineEvent?.Invoke(this, new TextLineEventArgs(lineIndex)); }
public void InsertInLine(int lineIndex, string toInsert, int startIndex) { _textLines[lineIndex] = _textLines[lineIndex].Insert(startIndex, toInsert); UpdateLineEvent?.Invoke(this, new TextLineEventArgs(lineIndex)); }