From e63ad7124356e0dc27c152d6bc417e57a6bde4d0 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Sat, 18 Feb 2012 20:13:47 +1100 Subject: Wrap lines if needed when moving to a position. Bug #3487397. From Marko Njezic. --- src/Editor.cxx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/Editor.cxx b/src/Editor.cxx index 58271db47..e9b66fcce 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -909,7 +909,12 @@ int Editor::MovePositionTo(SelectionPosition newPos, Selection::selTypes selt, b SetEmptySelection(newPos); } ShowCaretAtCurrentPosition(); + + int currentLine = pdoc->LineFromPosition(newPos.Position()); if (ensureVisible) { + // In case in need of wrapping to ensure DisplayFromDoc works. + if (currentLine >= wrapStart) + WrapLines(true, -1); XYScrollPosition newXY = XYScrollToMakeVisible(true, true, true); if (simpleCaret && (newXY.xOffset == xOffset)) { // simple vertical scroll then invalidate @@ -920,8 +925,6 @@ int Editor::MovePositionTo(SelectionPosition newPos, Selection::selTypes selt, b } } - int currentLine = pdoc->LineFromPosition(newPos.Position()); - if (highlightDelimiter.NeedsDrawing(currentLine)) { RedrawSelMargin(); } @@ -6891,7 +6894,8 @@ int Editor::ContractedFoldNext(int lineStart) { void Editor::EnsureLineVisible(int lineDoc, bool enforcePolicy) { // In case in need of wrapping to ensure DisplayFromDoc works. - WrapLines(true, -1); + if (lineDoc >= wrapStart) + WrapLines(true, -1); if (!cs.GetVisible(lineDoc)) { int lookLine = lineDoc; -- cgit v1.2.3