aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Editor.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2015-12-31 14:38:45 +1100
committerNeil <nyamatongwe@gmail.com>2015-12-31 14:38:45 +1100
commit4d91625964eca21b5b9bc4a54f34529fe3d4c1e7 (patch)
tree25209794a484f2e0cd9d82ca3e4f35bf68f29dff /src/Editor.cxx
parent1ea05a3df97f9a733254ecde9e70b5827083b8e6 (diff)
downloadscintilla-mirror-4d91625964eca21b5b9bc4a54f34529fe3d4c1e7.tar.gz
Bug [#1796]. Expand folded areas before deleting fold header line.
Diffstat (limited to 'src/Editor.cxx')
-rw-r--r--src/Editor.cxx23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 58abc37fd..29799534e 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -2579,17 +2579,24 @@ void Editor::NotifyModified(Document *, DocModification mh, void *) {
}
if ((mh.modificationType & (SC_MOD_BEFOREINSERT | SC_MOD_BEFOREDELETE)) && cs.HiddenLines()) {
// Some lines are hidden so may need shown.
- // TODO: check if the modified area is hidden.
+ const int lineOfPos = pdoc->LineFromPosition(mh.position);
+ int endNeedShown = mh.position;
if (mh.modificationType & SC_MOD_BEFOREINSERT) {
- int lineOfPos = pdoc->LineFromPosition(mh.position);
- const bool insertingNewLine = pdoc->ContainsLineEnd(mh.text, mh.length);
- if (insertingNewLine && (mh.position != pdoc->LineStart(lineOfPos)))
- NeedShown(mh.position, pdoc->LineStart(lineOfPos+1) - mh.position);
- else
- NeedShown(mh.position, 0);
+ if (pdoc->ContainsLineEnd(mh.text, mh.length) && (mh.position != pdoc->LineStart(lineOfPos)))
+ endNeedShown = pdoc->LineStart(lineOfPos+1);
} else if (mh.modificationType & SC_MOD_BEFOREDELETE) {
- NeedShown(mh.position, mh.length);
+ // Extend the need shown area over any folded lines
+ endNeedShown = mh.position + mh.length;
+ int lineLast = pdoc->LineFromPosition(mh.position+mh.length);
+ for (int line = lineOfPos; line <= lineLast; line++) {
+ const int lineMaxSubord = pdoc->GetLastChild(line, -1, -1);
+ if (lineLast < lineMaxSubord) {
+ lineLast = lineMaxSubord;
+ endNeedShown = pdoc->LineEnd(lineLast);
+ }
+ }
}
+ NeedShown(mh.position, endNeedShown - mh.position);
}
if (mh.linesAdded != 0) {
// Update contraction state for inserted and removed lines