diff options
author | nyamatongwe <devnull@localhost> | 2010-08-13 21:04:23 +1000 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2010-08-13 21:04:23 +1000 |
commit | 9d6c44722a773cb26aea69746805b38326b1559d (patch) | |
tree | 89111b67111c1172e849071eb96865141560579a /src/Editor.cxx | |
parent | 553e325af1566a1b63312459de571c1879fa028c (diff) | |
download | scintilla-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/Editor.cxx')
-rw-r--r-- | src/Editor.cxx | 11 |
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); } |