mirror of
https://github.com/zed-industries/zed.git
synced 2024-09-20 02:47:34 +03:00
Request autoscroll when undoing/redoing
This commit is contained in:
parent
20a77f4c5e
commit
258b89bb70
@ -1527,10 +1527,12 @@ impl Editor {
|
|||||||
|
|
||||||
pub fn undo(&mut self, _: &Undo, cx: &mut ViewContext<Self>) {
|
pub fn undo(&mut self, _: &Undo, cx: &mut ViewContext<Self>) {
|
||||||
self.buffer.update(cx, |buffer, cx| buffer.undo(cx));
|
self.buffer.update(cx, |buffer, cx| buffer.undo(cx));
|
||||||
|
self.request_autoscroll(cx);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn redo(&mut self, _: &Redo, cx: &mut ViewContext<Self>) {
|
pub fn redo(&mut self, _: &Redo, cx: &mut ViewContext<Self>) {
|
||||||
self.buffer.update(cx, |buffer, cx| buffer.redo(cx));
|
self.buffer.update(cx, |buffer, cx| buffer.redo(cx));
|
||||||
|
self.request_autoscroll(cx);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn move_left(&mut self, _: &MoveLeft, cx: &mut ViewContext<Self>) {
|
pub fn move_left(&mut self, _: &MoveLeft, cx: &mut ViewContext<Self>) {
|
||||||
@ -2344,10 +2346,8 @@ impl Editor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if autoscroll {
|
if autoscroll {
|
||||||
self.autoscroll_requested = true;
|
self.request_autoscroll(cx);
|
||||||
cx.notify();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
self.pause_cursor_blinking(cx);
|
self.pause_cursor_blinking(cx);
|
||||||
|
|
||||||
self.buffer.update(cx, |buffer, cx| {
|
self.buffer.update(cx, |buffer, cx| {
|
||||||
@ -2357,6 +2357,11 @@ impl Editor {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn request_autoscroll(&mut self, cx: &mut ViewContext<Self>) {
|
||||||
|
self.autoscroll_requested = true;
|
||||||
|
cx.notify();
|
||||||
|
}
|
||||||
|
|
||||||
fn start_transaction(&self, cx: &mut ViewContext<Self>) {
|
fn start_transaction(&self, cx: &mut ViewContext<Self>) {
|
||||||
self.buffer.update(cx, |buffer, _| {
|
self.buffer.update(cx, |buffer, _| {
|
||||||
buffer
|
buffer
|
||||||
|
Loading…
Reference in New Issue
Block a user