aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2010-08-13 21:04:23 +1000
committernyamatongwe <devnull@localhost>2010-08-13 21:04:23 +1000
commit9d6c44722a773cb26aea69746805b38326b1559d (patch)
tree89111b67111c1172e849071eb96865141560579a /src
parent553e325af1566a1b63312459de571c1879fa028c (diff)
downloadscintilla-mirror-9d6c44722a773cb26aea69746805b38326b1559d.tar.gz
Fix for bug #3043419 Unfolding incorrectly.
When new line characters are inserted on a folded fold header line, the fold is unfolded.
Diffstat (limited to 'src')
-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);
}