Fix scrolling sticking to top (#13874)

Stanislav Alekseev and Piotr created

The problem seemingly was that scrolling only started after autoscroll
has finished. I have added a function to forcefully stop it, which I
call when scroll event happens
Release Notes:

- Fixed delay when changing scrolling direction (#13720)

---------

Co-authored-by: Piotr <piotr@zed.dev>

Change summary

crates/editor/src/element.rs | 5 +++++
1 file changed, 5 insertions(+)

Detailed changes

crates/editor/src/element.rs 🔗

@@ -3660,6 +3660,11 @@ impl EditorElement {
                         if scroll_position != current_scroll_position {
                             editor.scroll(scroll_position, axis, cx);
                             cx.stop_propagation();
+                        } else if y < 0. {
+                            // Due to clamping, we may fail to detect cases of overscroll to the top;
+                            // We want the scroll manager to get an update in such cases and detect the change of direction
+                            // on the next frame.
+                            cx.notify();
                         }
                     });
                 }