Skip to content

Commit

Permalink
Clarify logic for Autoscroll::newest() and Autoscroll::fit() (zed…
Browse files Browse the repository at this point in the history
…-industries#23048)

Release Notes:

- N/A
  • Loading branch information
mgsloan authored Jan 13, 2025
1 parent 6aba395 commit e084848
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/editor/src/scroll/autoscroll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ impl Editor {
.next_row()
.as_f32();

// If the selections can't all fit on screen, scroll to the newest.
let selections_fit = target_bottom - target_top <= visible_lines;
if autoscroll == Autoscroll::newest()
|| autoscroll == Autoscroll::fit() && target_bottom - target_top > visible_lines
|| (autoscroll == Autoscroll::fit() && !selections_fit)
{
let newest_selection_top = selections
.iter()
Expand Down

0 comments on commit e084848

Please sign in to comment.