refactor editor resize functions

This commit is contained in:
Termina94 2022-07-12 22:33:34 +01:00
parent e4c90548e1
commit 6891014241
2 changed files with 7 additions and 19 deletions

View File

@ -37,7 +37,7 @@
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) {

View File

@ -1645,20 +1645,8 @@ pub fn transpose_view(&mut self) {
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) {