diff options
author | Neil <nyamatongwe@gmail.com> | 2020-05-03 19:40:15 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2020-05-03 19:40:15 +1000 |
commit | 4b450a69452a14fd9af6c426b91d04165fedc94a (patch) | |
tree | 47c4806178b43f175f56433b7ed1ebafb0446f1e /src/PerLine.cxx | |
parent | b24183b5a90b4ebeb951668d48f0e95a1a2819dd (diff) | |
download | scintilla-mirror-4b450a69452a14fd9af6c426b91d04165fedc94a.tar.gz |
Feature [feature-requests:1347]. Add InsertLines method to PerLine interface and
all implementations. This will allow insertion of lines in batches in a future
change set.
Added tests for PerLine implementations.
Diffstat (limited to 'src/PerLine.cxx')
-rw-r--r-- | src/PerLine.cxx | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/src/PerLine.cxx b/src/PerLine.cxx index 47556f3ae..c7204e31a 100644 --- a/src/PerLine.cxx +++ b/src/PerLine.cxx @@ -102,6 +102,12 @@ void LineMarkers::InsertLine(Sci::Line line) { } } +void LineMarkers::InsertLines(Sci::Line line, Sci::Line lines) { + if (markers.Length()) { + markers.InsertEmpty(line, lines); + } +} + void LineMarkers::RemoveLine(Sci::Line line) { // Retain the markers from the deleted line by oring them into the previous line if (markers.Length()) { @@ -219,7 +225,14 @@ void LineLevels::Init() { void LineLevels::InsertLine(Sci::Line line) { if (levels.Length()) { const int level = (line < levels.Length()) ? levels[line] : SC_FOLDLEVELBASE; - levels.InsertValue(line, 1, level); + levels.Insert(line, level); + } +} + +void LineLevels::InsertLines(Sci::Line line, Sci::Line lines) { + if (levels.Length()) { + const int level = (line < levels.Length()) ? levels[line] : SC_FOLDLEVELBASE; + levels.InsertValue(line, lines, level); } } @@ -281,6 +294,14 @@ void LineState::InsertLine(Sci::Line line) { } } +void LineState::InsertLines(Sci::Line line, Sci::Line lines) { + if (lineStates.Length()) { + lineStates.EnsureLength(line); + const int val = (line < lineStates.Length()) ? lineStates[line] : 0; + lineStates.InsertValue(line, lines, val); + } +} + void LineState::RemoveLine(Sci::Line line) { if (lineStates.Length() > line) { lineStates.Delete(line); @@ -343,6 +364,13 @@ void LineAnnotation::InsertLine(Sci::Line line) { } } +void LineAnnotation::InsertLines(Sci::Line line, Sci::Line lines) { + if (annotations.Length()) { + annotations.EnsureLength(line); + annotations.InsertEmpty(line, lines); + } +} + void LineAnnotation::RemoveLine(Sci::Line line) { if (annotations.Length() && (line > 0) && (line <= annotations.Length())) { annotations[line-1].reset(); @@ -459,6 +487,13 @@ void LineTabstops::InsertLine(Sci::Line line) { } } +void LineTabstops::InsertLines(Sci::Line line, Sci::Line lines) { + if (tabstops.Length()) { + tabstops.EnsureLength(line); + tabstops.InsertEmpty(line, lines); + } +} + void LineTabstops::RemoveLine(Sci::Line line) { if (tabstops.Length() > line) { tabstops[line].reset(); |