From 7af8c22e99e8c13bf92beb7319464d0bf8b213ee Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Fri, 13 Aug 2010 21:04:23 +1000 Subject: Fix for bug #3043419 Unfolding incorrectly. When new line characters are inserted on a folded fold header line, the fold is unfolded. --- src/Editor.cxx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src') 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); } -- cgit v1.2.3