diff options
author | nyamatongwe <unknown> | 2011-10-10 12:24:59 +1100 |
---|---|---|
committer | nyamatongwe <unknown> | 2011-10-10 12:24:59 +1100 |
commit | 6789174f8bd1f796d718e728667d08c337d9149a (patch) | |
tree | 9632cc1a2f8b092742a833e9ee17351c60220823 /src | |
parent | 8b5f8f671091661982bd77c2cd71f39e8c8f88d2 (diff) | |
download | scintilla-mirror-6789174f8bd1f796d718e728667d08c337d9149a.tar.gz |
Fix for wrong line heights when using annotations and wrapping. Bug #3388159.
Diffstat (limited to 'src')
-rw-r--r-- | src/Editor.cxx | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx index 01f55b333..fb7f4c636 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -4513,14 +4513,12 @@ void Editor::NotifySavePoint(Document *, void *, bool atSavePoint) { void Editor::CheckModificationForWrap(DocModification mh) { if (mh.modificationType & (SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT)) { llc.Invalidate(LineLayout::llCheckTextAndStyle); + int lineDoc = pdoc->LineFromPosition(mh.position); + int lines = Platform::Maximum(0, mh.linesAdded); if (wrapState != eWrapNone) { - int lineDoc = pdoc->LineFromPosition(mh.position); - int lines = Platform::Maximum(0, mh.linesAdded); NeedWrapping(lineDoc, lineDoc + lines + 1); } // Fix up annotation heights - int lineDoc = pdoc->LineFromPosition(mh.position); - int lines = Platform::Maximum(0, mh.linesAdded); SetAnnotationHeights(lineDoc, lineDoc + lines + 2); } } @@ -6724,8 +6722,22 @@ void Editor::SetBraceHighlight(Position pos0, Position pos1, int matchStyle) { void Editor::SetAnnotationHeights(int start, int end) { if (vs.annotationVisible) { + bool changedHeight = false; for (int line=start; line<end; line++) { - cs.SetHeight(line, pdoc->AnnotationLines(line) + 1); + int linesWrapped = 1; + if (wrapState != eWrapNone) { + AutoSurface surface(this); + AutoLineLayout ll(llc, RetrieveLineLayout(line)); + if (surface && ll) { + LayoutLine(line, surface, vs, ll, wrapWidth); + linesWrapped = ll->lines; + } + } + if (cs.SetHeight(line, pdoc->AnnotationLines(line) + linesWrapped)) + changedHeight = true; + } + if (changedHeight) { + Redraw(); } } } |