aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <unknown>2010-08-13 21:04:23 +1000
committernyamatongwe <unknown>2010-08-13 21:04:23 +1000
commit7af8c22e99e8c13bf92beb7319464d0bf8b213ee (patch)
tree510d226a9f4b43a424bef79815687f097ccc7391
parent32a06e32cb6567f2a4cae87fcd92765b8dfc8216 (diff)
downloadscintilla-mirror-7af8c22e99e8c13bf92beb7319464d0bf8b213ee.tar.gz
Fix for bug #3043419 Unfolding incorrectly.
When new line characters are inserted on a folded fold header line, the fold is unfolded.
-rw-r--r--src/Editor.cxx11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 50d666a60..504cf5446 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -4364,7 +4364,16 @@ void Editor::NotifyModified(Document *, DocModification mh, void *) {
// Some lines are hidden so may need shown.
// TODO: check if the modified area is hidden.
if (mh.modificationType & SC_MOD_BEFOREINSERT) {
- NotifyNeedShown(mh.position, 0);
+ int lineOfPos = pdoc->LineFromPosition(mh.position);
+ bool insertingNewLine = false;
+ for (int i=0; i < mh.length; i++) {
+ if ((mh.text[i] == '\n') || (mh.text[i] == '\r'))
+ insertingNewLine = true;
+ }
+ if (insertingNewLine && (mh.position != pdoc->LineStart(lineOfPos)))
+ NotifyNeedShown(mh.position, pdoc->LineStart(lineOfPos+1) - mh.position);
+ else
+ NotifyNeedShown(mh.position, 0);
} else if (mh.modificationType & SC_MOD_BEFOREDELETE) {
NotifyNeedShown(mh.position, mh.length);
}