view: Reposition cursors on tree resize.
commit6336c1da20fcb1bad60147255e2805d5699a6401
authorBlaž Hrastnik <blaz@mxxn.io>
dateFri 26 Feb 2021, 15:53 (6 years ago)
parentad58286
helix-term/src/ui/editor.rs−1
@@ -350,7 +350,6 @@ impl Component for EditorView {
350350 Event::Resize(width, height) => {
351351 // HAXX: offset the render area height by 1 to account for prompt/commandline
352352 cx.editor.tree.resize(Rect::new(0, 0, width, height - 1));
353− // TODO: restore view.ensure_cursor_in_view();
354353 EventResult::Consumed(None)
355354 }
356355 Event::Key(event) => {
helix-view/src/tree.rs+1
@@ -231,6 +231,7 @@ impl Tree {
231231 Content::View(view) => {
232232 // debug!!("setting view area {:?}", area);
233233 view.area = area;
234+ view.ensure_cursor_in_view();
234235 } // TODO: call f()
235236 Content::Container(container) => {
236237 // debug!!("setting container area {:?}", area);