This could simply contain two lines:

```
moveCursorToDocumentStart();
extendSelectionToDocumentEnd();
```
which clean and is not slow compared to the current approach, considering that the first call is near-instantaneous.
Better code reuse, lesser chance of bugs in the future.