| 1227 | } |
| 1228 | |
| 1229 | void Editor::MoveCaretInsideView ( bool ensureVisible ) |
| 1230 | { |
| 1231 | PRectangle rcClient = GetTextRectangle(); |
| 1232 | Point pt = PointMainCaret(); |
| 1233 | if ( pt.y < rcClient.top ) { |
| 1234 | MovePositionTo ( SPositionFromLocation ( |
| 1235 | Point ( lastXChosen - xOffset, rcClient.top ), |
| 1236 | false, false, UserVirtualSpace() ), |
| 1237 | Selection::noSel, ensureVisible ); |
| 1238 | } else if ( ( pt.y + vs.lineHeight - 1 ) > rcClient.bottom ) { |
| 1239 | int yOfLastLineFullyDisplayed = rcClient.top + ( LinesOnScreen() - 1 ) * vs.lineHeight; |
| 1240 | MovePositionTo ( SPositionFromLocation ( |
| 1241 | Point ( lastXChosen - xOffset, rcClient.top + yOfLastLineFullyDisplayed ), |
| 1242 | false, false, UserVirtualSpace() ), |
| 1243 | Selection::noSel, ensureVisible ); |
| 1244 | } |
| 1245 | } |
| 1246 | |
| 1247 | int Editor::DisplayFromPosition ( int pos ) |
| 1248 | { |