view: Reposition cursors on tree resize.

pull/8/head
Blaž Hrastnik 4 years ago
parent ad58286dc7
commit 6336c1da20

@ -350,7 +350,6 @@ impl Component for EditorView {
Event::Resize(width, height) => { Event::Resize(width, height) => {
// HAXX: offset the render area height by 1 to account for prompt/commandline // HAXX: offset the render area height by 1 to account for prompt/commandline
cx.editor.tree.resize(Rect::new(0, 0, width, height - 1)); cx.editor.tree.resize(Rect::new(0, 0, width, height - 1));
// TODO: restore view.ensure_cursor_in_view();
EventResult::Consumed(None) EventResult::Consumed(None)
} }
Event::Key(event) => { Event::Key(event) => {

@ -231,6 +231,7 @@ impl Tree {
Content::View(view) => { Content::View(view) => {
// debug!!("setting view area {:?}", area); // debug!!("setting view area {:?}", area);
view.area = area; view.area = area;
view.ensure_cursor_in_view();
} // TODO: call f() } // TODO: call f()
Content::Container(container) => { Content::Container(container) => {
// debug!!("setting container area {:?}", area); // debug!!("setting container area {:?}", area);

Loading…
Cancel
Save