mirror of https://github.com/zulip/zulip.git
Restore centering when using the down arrow (or "j").
This restores the feature that hitting down when you are at the last message automatically centers the last message. This is not a pure revert, because some additional code now goes through navigate.down. (imported from commit 2db1f247692ba068613a2d6c93f18ca7c13a16b8)
This commit is contained in:
parent
1b1f80f3d7
commit
b3f60faf3f
|
@ -266,7 +266,7 @@ function process_hotkey(e) {
|
|||
switch (event_name) {
|
||||
case 'down_arrow':
|
||||
case 'vim_down':
|
||||
navigate.down();
|
||||
navigate.down(true); // with_centering
|
||||
return true;
|
||||
case 'up_arrow':
|
||||
case 'vim_up':
|
||||
|
|
|
@ -17,12 +17,22 @@ exports.up = function () {
|
|||
}
|
||||
};
|
||||
|
||||
exports.down = function () {
|
||||
exports.down = function (with_centering) {
|
||||
last_viewport_movement_direction = 1;
|
||||
var next_row = rows.next_visible(current_msg_list.selected_row());
|
||||
if (next_row.length !== 0) {
|
||||
go_to_row(next_row);
|
||||
}
|
||||
if (with_centering && (next_row.length === 0)) {
|
||||
// At the last message, scroll to the bottom so we have
|
||||
// lots of nice whitespace for new messages coming in.
|
||||
//
|
||||
// FIXME: this doesn't work for End because rows.last_visible()
|
||||
// always returns a message.
|
||||
var current_msg_table = rows.get_table(current_msg_list.table_name);
|
||||
viewport.scrollTop(current_msg_table.outerHeight(true) - viewport.height() * 0.1);
|
||||
mark_current_list_as_read();
|
||||
}
|
||||
};
|
||||
|
||||
exports.to_home = function () {
|
||||
|
|
Loading…
Reference in New Issue