MCPcopy Create free account
hub / github.com/cxasm/notepad-- / ScrollTo

Method ScrollTo

src/qscint/scintilla/src/Editor.cpp:945–973  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

943}
944
945void Editor::ScrollTo(Sci::Line line, bool moveThumb) {
946 const Sci::Line topLineNew = Sci::clamp(line, static_cast<Sci::Line>(0), MaxScrollPos());
947 if (topLineNew != topLine) {
948 // Try to optimise small scrolls
949#ifndef UNDER_CE
950 const Sci::Line linesToMove = topLine - topLineNew;
951 const bool performBlit = (std::abs(linesToMove) <= 10) && (paintState == notPainting);
952 willRedrawAll = !performBlit;
953#endif
954 SetTopLine(topLineNew);
955 // Optimize by styling the view as this will invalidate any needed area
956 // which could abort the initial paint if discovered later.
957 StyleAreaBounded(GetClientRectangle(), true);
958#ifndef UNDER_CE
959 // Perform redraw rather than scroll if many lines would be redrawn anyway.
960 if (performBlit) {
961 ScrollText(linesToMove);
962 } else {
963 Redraw();
964 }
965 willRedrawAll = false;
966#else
967 Redraw();
968#endif
969 if (moveThumb) {
970 SetVerticalScrollPos();
971 }
972 }
973}
974
975void Editor::ScrollText(Sci::Line /* linesToMove */) {
976 //Platform::DebugPrintf("Editor::ScrollText %d\n", linesToMove);

Callers 1

handleVSbMethod · 0.80

Calls 1

clampFunction · 0.85

Tested by

no test coverage detected