aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Editor.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/Editor.cxx')
-rw-r--r--src/Editor.cxx24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 838f1830e..342e7de1c 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -1500,8 +1500,10 @@ bool Editor::WrapOneLine(Surface *surface, Sci::Line lineToWrap) {
view.LayoutLine(*this, surface, vs, ll.get(), wrapWidth);
linesWrapped = ll->lines;
}
- return pcs->SetHeight(lineToWrap, linesWrapped +
- ((vs.annotationVisible != AnnotationVisible::Hidden) ? pdoc->AnnotationLines(lineToWrap) : 0));
+ if (vs.annotationVisible != AnnotationVisible::Hidden) {
+ linesWrapped += pdoc->AnnotationLines(lineToWrap);
+ }
+ return pcs->SetHeight(lineToWrap, linesWrapped);
}
// Perform wrapping for a subset of the lines needing wrapping.
@@ -1516,8 +1518,11 @@ bool Editor::WrapLines(WrapScope ws) {
if (wrapWidth != LineLayout::wrapWidthInfinite) {
wrapWidth = LineLayout::wrapWidthInfinite;
for (Sci::Line lineDoc = 0; lineDoc < pdoc->LinesTotal(); lineDoc++) {
- pcs->SetHeight(lineDoc, 1 +
- ((vs.annotationVisible != AnnotationVisible::Hidden) ? pdoc->AnnotationLines(lineDoc) : 0));
+ int linesWrapped = 1;
+ if (vs.annotationVisible != AnnotationVisible::Hidden) {
+ linesWrapped += pdoc->AnnotationLines(lineDoc);
+ }
+ pcs->SetHeight(lineDoc, linesWrapped);
}
wrapOccurred = true;
}
@@ -1934,6 +1939,7 @@ void Editor::InsertCharacter(std::string_view sv, CharacterSource charSource) {
return;
}
FilterSelections();
+ bool wrapOccurred = false;
{
UndoGroup ug(pdoc, (sel.Count() > 1) || !sel.Empty() || inOverstrike);
@@ -1981,17 +1987,17 @@ void Editor::InsertCharacter(std::string_view sv, CharacterSource charSource) {
AutoSurface surface(this);
if (surface) {
if (WrapOneLine(surface, pdoc->SciLineFromPosition(positionInsert))) {
- SetScrollBars();
- SetVerticalScrollPos();
- Redraw();
+ wrapOccurred = true;
}
}
}
}
}
}
- if (Wrapping()) {
+ if (wrapOccurred) {
SetScrollBars();
+ SetVerticalScrollPos();
+ Redraw();
}
ThinRectangularRange();
// If in wrap mode rewrap current line so EnsureCaretVisible has accurate information
@@ -2944,8 +2950,8 @@ void Editor::PageMove(int direction, Selection::SelTypes selt, bool stuttered) {
if (topLineNew != topLine) {
SetTopLine(topLineNew);
MovePositionTo(newPos, selt);
- Redraw();
SetVerticalScrollPos();
+ Redraw();
} else {
MovePositionTo(newPos, selt);
}