Fix bugs in autoscroll with 'fit' strategy (#2893)
This fixes a bug where text moved up and down by one pixel in the buffer search query editor, while typing. Release notes: * Fixed a bug where editors didn't auto-scroll when typing if all cursors could not fit within the viewport.
This commit is contained in:
commit
d6ffb68305
3 changed files with 110 additions and 36 deletions
|
@ -2177,14 +2177,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