aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Editor.cxx
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2011-10-10 12:24:59 +1100
committernyamatongwe <devnull@localhost>2011-10-10 12:24:59 +1100
commitf83e4caeee5452d9ba23075b665287a872db6615 (patch)
tree89f9287c036b1d4d6979f61577c7bf2342ade78b /src/Editor.cxx
parent4dd351628ed6f220ed88c05e07c03a1c808d6fed (diff)
downloadscintilla-mirror-f83e4caeee5452d9ba23075b665287a872db6615.tar.gz
Fix for wrong line heights when using annotations and wrapping. Bug #3388159.
Diffstat (limited to 'src/Editor.cxx')
-rw-r--r--src/Editor.cxx22
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();
}
}
}