aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
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);
}