From e4c90548e15d91549e7930076ce2d933210ea387 Mon Sep 17 00:00:00 2001 From: Termina94 Date: Tue, 12 Jul 2022 22:05:22 +0100 Subject: [PATCH] rename focus to expand --- helix-term/src/commands.rs | 6 +++--- helix-term/src/keymap/default.rs | 2 +- helix-view/src/editor.rs | 4 ++-- helix-view/src/tree.rs | 20 ++++++++++---------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index cdba93f5f..ff906fef5 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -355,7 +355,7 @@ impl MappableCommand { shrink_buffer_width, "Shrink focused container width", grow_buffer_height, "Grow focused container height", shrink_buffer_height, "Shrink focused container height", - buffer_focus_mode, "Enable focus mode on buffer", + buffer_expand_mode, "Enable expand mode on buffer", goto_line_start, "Goto line start", goto_line_end, "Goto line end", goto_next_buffer, "Goto next buffer", @@ -787,8 +787,8 @@ fn shrink_buffer_height(cx: &mut Context) { cx.editor.shrink_buffer_height(); } -fn buffer_focus_mode(cx: &mut Context) { - cx.editor.buffer_focus_mode(); +fn buffer_expand_mode(cx: &mut Context) { + cx.editor.buffer_expand_mode(); } fn goto_next_buffer(cx: &mut Context) { diff --git a/helix-term/src/keymap/default.rs b/helix-term/src/keymap/default.rs index 849bbabfc..47182a04b 100644 --- a/helix-term/src/keymap/default.rs +++ b/helix-term/src/keymap/default.rs @@ -31,7 +31,7 @@ pub fn default() -> HashMap { "A-l"|"A-right" => grow_buffer_width, "A-j"|"A-down" => shrink_buffer_height, "A-k"|"A-up" => grow_buffer_height, - "A-f" => buffer_focus_mode, + "A-f" => buffer_expand_mode, }, "w" => move_next_word_start, diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index 900b330b5..03753345c 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -1661,8 +1661,8 @@ impl Editor { self.tree.resize_buffer(Resize::Shrink, Dimension::Height); } - pub fn buffer_focus_mode(&mut self) { - self.tree.buffer_focus_mode(); + pub fn buffer_expand_mode(&mut self) { + self.tree.buffer_expand_mode(); } pub fn should_close(&self) -> bool { diff --git a/helix-view/src/tree.rs b/helix-view/src/tree.rs index aa7de6a5d..afc051eb0 100644 --- a/helix-view/src/tree.rs +++ b/helix-view/src/tree.rs @@ -82,7 +82,7 @@ pub struct Container { pub struct ContainerBounds { width: usize, height: usize, - focus: bool, + expand: bool, } impl Container { @@ -124,7 +124,7 @@ impl Container { self.node_bounds.push(ContainerBounds { width: 10, height: 10, - focus: false, + expand: false, }); self } @@ -135,7 +135,7 @@ impl Container { ContainerBounds { width: 10, height: 10, - focus: false, + expand: false, }, ); self @@ -149,7 +149,7 @@ impl Container { fn calculate_slots_width(&self) -> usize { self.node_bounds .iter() - .map(|bounds| match bounds.focus { + .map(|bounds| match bounds.expand { true => 40, false => bounds.width, }) @@ -159,7 +159,7 @@ impl Container { fn calculate_slots_height(&self) -> usize { self.node_bounds .iter() - .map(|bounds| match bounds.focus { + .map(|bounds| match bounds.expand { true => 40, false => bounds.height, }) @@ -455,7 +455,7 @@ impl Tree { for (i, child) in container.children.iter().enumerate() { let bounds = container.node_bounds[i]; - let height = match bounds.focus { + let height = match bounds.expand { true => (40.0 * slot_height) as u16, false => (slot_height * bounds.height as f32).floor() as u16, }; @@ -488,7 +488,7 @@ impl Tree { for (i, child) in container.children.iter().enumerate() { let bounds = container.node_bounds[i]; - let width = match bounds.focus { + let width = match bounds.expand { true => (40.0 * slot_width) as u16, false => (slot_width * bounds.width as f32).floor() as u16, }; @@ -736,13 +736,13 @@ impl Tree { } } - pub fn buffer_focus_mode(&mut self) { + pub fn buffer_expand_mode(&mut self) { if let Some(bounds) = self.get_active_node_bounds_mut(Layout::Horizontal) { - bounds.focus = !bounds.focus; + bounds.expand = !bounds.expand; } if let Some(bounds) = self.get_active_node_bounds_mut(Layout::Vertical) { - bounds.focus = !bounds.focus; + bounds.expand = !bounds.expand; } self.recalculate();