refactor editor resize functions

pull/8546/head
Termina94 2 years ago
parent e4c90548e1
commit 6891014241

@ -37,7 +37,7 @@ use helix_view::{
info::Info,
input::KeyEvent,
keyboard::KeyCode,
tree,
tree::{Dimension, Resize},
view::View,
Document, DocumentId, Editor, ViewId,
};
@ -773,18 +773,18 @@ fn goto_line_start(cx: &mut Context) {
}
fn grow_buffer_width(cx: &mut Context) {
cx.editor.grow_buffer_width();
cx.editor.resize_buffer(Resize::Grow, Dimension::Width);
}
fn shrink_buffer_width(cx: &mut Context) {
cx.editor.shrink_buffer_width();
cx.editor.resize_buffer(Resize::Shrink, Dimension::Width);
}
fn grow_buffer_height(cx: &mut Context) {
cx.editor.grow_buffer_height();
cx.editor.resize_buffer(Resize::Grow, Dimension::Height);
}
fn shrink_buffer_height(cx: &mut Context) {
cx.editor.shrink_buffer_height();
cx.editor.resize_buffer(Resize::Shrink, Dimension::Height);
}
fn buffer_expand_mode(cx: &mut Context) {

@ -1645,20 +1645,8 @@ impl Editor {
self.tree.transpose();
}
pub fn grow_buffer_width(&mut self) {
self.tree.resize_buffer(Resize::Grow, Dimension::Width);
}
pub fn shrink_buffer_width(&mut self) {
self.tree.resize_buffer(Resize::Shrink, Dimension::Width);
}
pub fn grow_buffer_height(&mut self) {
self.tree.resize_buffer(Resize::Grow, Dimension::Height);
}
pub fn shrink_buffer_height(&mut self) {
self.tree.resize_buffer(Resize::Shrink, Dimension::Height);
pub fn resize_buffer(&mut self, resize_type: Resize, dimension: Dimension) {
self.tree.resize_buffer(resize_type, dimension);
}
pub fn buffer_expand_mode(&mut self) {

Loading…
Cancel
Save