* 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. */
| 5027 | * If stuttered = true and already at first/last row, scroll as normal. |
| 5028 | */ |
| 5029 | void 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 | |
| 5065 | void Editor::ChangeCaseOfSelection ( int caseMapping ) |
| 5066 | { |
nothing calls this directly
no test coverage detected