Clarify logic for Autoscroll::newest() and Autoscroll::fit() (#23048)

Release Notes:

- N/A
This commit is contained in:
Michael Sloan 2025-01-12 22:33:24 -07:00 committed by GitHub
parent 6aba3950d2
commit e08484840b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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()