Fix bugs in autoscroll with 'fit' strategy
* Scroll to the newest cursor if all cursors can't fit in the viewport. * Refuse to layout an editor less tall than one line height. Co-authored-by: Nathan <nathan@zed.dev>
This commit is contained in:
parent
f798be6e27
commit
a3b2c03b17
3 changed files with 110 additions and 36 deletions
|
@ -2113,14 +2113,11 @@ impl Element<Editor> for EditorElement {
|
|||
scroll_height
|
||||
.min(constraint.max_along(Axis::Vertical))
|
||||
.max(constraint.min_along(Axis::Vertical))
|
||||
.max(line_height)
|
||||
.min(line_height * max_lines as f32),
|
||||
)
|
||||
} else if let EditorMode::SingleLine = snapshot.mode {
|
||||
size.set_y(
|
||||
line_height
|
||||
.min(constraint.max_along(Axis::Vertical))
|
||||
.max(constraint.min_along(Axis::Vertical)),
|
||||
)
|
||||
size.set_y(line_height.max(constraint.min_along(Axis::Vertical)))
|
||||
} else if size.y().is_infinite() {
|
||||
size.set_y(scroll_height);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue