fagga/transmission-remote-cli — pull request #63 by Oddegamra (2012-04-29 06:40:04+00:00)
Title: Toggling compact mode does not update self.scrollpos.

self.scrollpos shows how many lines have been scrolled down, in
torrent line sizes. That is, five torrents are loaded and only four are
visible, scrolling down the the last torrent would set scrollpos to 3 in
normal mode (size of one torrent), but only 1 in compact mode.

Clearly, scrollpos should be updated whenever the user switches to
ensure that a) the previously focused torrent is still visible and b)
scrollpos doesn't cause invalid array access in e.g. visible torrents
calculation.

follow_list_focus() seems to be perfect for that, however, it depends on
manage_layout() to set self.torrents_per_page and self.tlist_item_height.

So, refactor torrents per page calculation out of manage_layout(), and call
new method within toggle_compact_mode() to ensure that self.scrollpos is
always valid.

This commit fixes fagga/transmission-remote-cli#62.