status: improve the selection behavior
commitd8dca14cd40f27b81d33af0071a71eee51bd3e23
authorDavid Aguilar <davvid@gmail.com>
Sun, 11 Jul 2021 20:24:35 +0000 (11 13:24 -0700)
committerDavid Aguilar <davvid@gmail.com>
Sun, 11 Jul 2021 22:25:09 +0000 (11 15:25 -0700)
tree89c5ae17737ee878b862ec289c5f5165ed592fed
parent2e13b35a64870348221b8890e9f9196006fb5a46
status: improve the selection behavior

Extend the _store_selection() logic to handle the cases where an item
was previously selected and moved to a new category.

Detect when the selection would become empty and apply some intuitive
rules to reselect items so that the user's selection is preserved in
more scenarios.

Attempt to select Unmerged, Modified and Untracked files when a Staged
file was previously selected and no longer exists in the Staged
category.

Attempt to select Staged, Modified and Untracked files when an Umerged
file was previously selected and no longer exists in the Unmerged
category.

Attempt to select Staged and Untracked files when a Modified file was
previously selected and no longer exists in the Modified category.

Attempt to select Staged, Unmerged and Modified files when an Untracked
file was previously selected and no longer exists in the Untracked
category.

Closes #1130 #1131
Suggested-by: @birgersp on github.com
Signed-off-by: David Aguilar <davvid@gmail.com>
cola/widgets/status.py