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 | 60cd87963a771c22eda56365f4059c1fa117e3a3 (patch) | |
| tree | 640b935cdb4b5587ee9b0c1de08f42560c0ba387 /src/PerLine.cxx | |
| parent | 69db1ffbcab52381b4f6e04bb5cb64eeba838225 (diff) | |
| download | scintilla-mirror-60cd87963a771c22eda56365f4059c1fa117e3a3.tar.gz | |
Backport: 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.
Backport of changeset 8227:9fc611fc6848.
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 b729386a5..3c8272372 100644 --- a/src/PerLine.cxx +++ b/src/PerLine.cxx @@ -101,6 +101,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()) { @@ -218,7 +224,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); } } @@ -280,6 +293,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); @@ -350,6 +371,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(); @@ -466,6 +494,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(); |
