fix(table): last row out of viewport
When a table cannot display all its rows, the viewport allows scrolling. However, the last row isn't visible.
For example for a table size of 7, the viewport height will be 5 (-2 because of the header). When setting the cursor at position 5, the 6th row should be visible, but isn't. This PR fixes this.
Because cursor is an index (starts at 0), we need to substract 1 to the viewport height to get the correct start position. Otherwise the viewport thinks it can display one more row than it can actually fit when rendering.
Wait before merging this. It looks like it introduces undesirable behavior in some cases.
Ready for re-review. I removed unecessary code related to the viewport Y offset. I didn't see any difference after removing it because we only render the relevant rows in UpdateViewport() already.
There is one bug remaining: the selector stays at the bottom when moving up. I tested it on master as well just to be sure I didn't introduce it with these changes. I can confirm it's already happening on master.
@caarlos0 Can you have another look at it when you have time please?