MCPcopy Create free account
hub / github.com/ProgerXP/Notepad2e / PageMove

Method PageMove

scintilla/src/Editor.cxx:5029–5063  ·  view source on GitHub ↗

* Force scroll and keep position relative to top of window. * * If stuttered = true and not already at first/last row, move to first/last row of window. * If stuttered = true and already at first/last row, scroll as normal. */

Source from the content-addressed store, hash-verified

5027 * If stuttered = true and already at first/last row, scroll as normal.
5028 */
5029void Editor::PageMove ( int direction, Selection::selTypes selt, bool stuttered )
5030{
5031 int topLineNew;
5032 SelectionPosition newPos;
5033 int currentLine = pdoc->LineFromPosition ( sel.MainCaret() );
5034 int topStutterLine = topLine + caretYSlop;
5035 int bottomStutterLine =
5036 pdoc->LineFromPosition ( PositionFromLocation (
5037 Point ( lastXChosen - xOffset, direction * vs.lineHeight * LinesToScroll() ) ) )
5038 - caretYSlop - 1;
5039 if ( stuttered && ( direction < 0 && currentLine > topStutterLine ) ) {
5040 topLineNew = topLine;
5041 newPos = SPositionFromLocation ( Point ( lastXChosen - xOffset, vs.lineHeight * caretYSlop ),
5042 false, false, UserVirtualSpace() );
5043 } else if ( stuttered && ( direction > 0 && currentLine < bottomStutterLine ) ) {
5044 topLineNew = topLine;
5045 newPos = SPositionFromLocation ( Point ( lastXChosen - xOffset, vs.lineHeight * ( LinesToScroll() - caretYSlop ) ),
5046 false, false, UserVirtualSpace() );
5047 } else {
5048 Point pt = LocationFromPosition ( sel.MainCaret() );
5049 topLineNew = Platform::Clamp (
5050 topLine + direction * LinesToScroll(), 0, MaxScrollPos() );
5051 newPos = SPositionFromLocation (
5052 Point ( lastXChosen - xOffset, pt.y + direction * ( vs.lineHeight * LinesToScroll() ) ),
5053 false, false, UserVirtualSpace() );
5054 }
5055 if ( topLineNew != topLine ) {
5056 SetTopLine ( topLineNew );
5057 MovePositionTo ( newPos, selt );
5058 Redraw();
5059 SetVerticalScrollPos();
5060 } else {
5061 MovePositionTo ( newPos, selt );
5062 }
5063}
5064
5065void Editor::ChangeCaseOfSelection ( int caseMapping )
5066{

Callers

nothing calls this directly

Calls 3

PointClass · 0.85
MainCaretMethod · 0.80
LineFromPositionMethod · 0.45

Tested by

no test coverage detected