refactor: Remove brittle check for !select_first_unread.

When we are deciding whether to preserve scroll position, we
mainly care that then_select_offset is set to a value.  If
we had no intention of preserving scroll offset, we would have
never bothered to set it.  The check for !select_first_unread
is always redundant, as verified by lots of clicking around
with some print debugging.  And it's a brittle check,
because it couples the decision of scrolling destination to
the mechanism by which we decide our selection.  While those
things are closely related, it's possible in the future that
we'll decide to advance to an unread message and still want
to set then_select_offset, but we might forget to mutate
select_first_unread.

Long story short, the code is simpler and safer now.
This commit is contained in:
Steve Howell 2018-05-03 10:44:38 +00:00 committed by Tim Abbott
parent 3e08270d48
commit df0e4a73fa
1 changed files with 0 additions and 1 deletions

View File

@ -168,7 +168,6 @@ exports.activate = function (raw_operators, opts) {
}
var preserve_pre_narrowing_screen_position =
!select_first_unread &&
(message_list.narrowed.get(then_select_id) !== undefined) &&
(then_select_offset !== undefined);