mirror of https://github.com/helix-editor/helix
rename focus to expand
parent
d8fbff3856
commit
e4c90548e1
|
@ -355,7 +355,7 @@ impl MappableCommand {
|
||||||
shrink_buffer_width, "Shrink focused container width",
|
shrink_buffer_width, "Shrink focused container width",
|
||||||
grow_buffer_height, "Grow focused container height",
|
grow_buffer_height, "Grow focused container height",
|
||||||
shrink_buffer_height, "Shrink 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_start, "Goto line start",
|
||||||
goto_line_end, "Goto line end",
|
goto_line_end, "Goto line end",
|
||||||
goto_next_buffer, "Goto next buffer",
|
goto_next_buffer, "Goto next buffer",
|
||||||
|
@ -787,8 +787,8 @@ fn shrink_buffer_height(cx: &mut Context) {
|
||||||
cx.editor.shrink_buffer_height();
|
cx.editor.shrink_buffer_height();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn buffer_focus_mode(cx: &mut Context) {
|
fn buffer_expand_mode(cx: &mut Context) {
|
||||||
cx.editor.buffer_focus_mode();
|
cx.editor.buffer_expand_mode();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn goto_next_buffer(cx: &mut Context) {
|
fn goto_next_buffer(cx: &mut Context) {
|
||||||
|
|
|
@ -31,7 +31,7 @@ pub fn default() -> HashMap<Mode, KeyTrie> {
|
||||||
"A-l"|"A-right" => grow_buffer_width,
|
"A-l"|"A-right" => grow_buffer_width,
|
||||||
"A-j"|"A-down" => shrink_buffer_height,
|
"A-j"|"A-down" => shrink_buffer_height,
|
||||||
"A-k"|"A-up" => grow_buffer_height,
|
"A-k"|"A-up" => grow_buffer_height,
|
||||||
"A-f" => buffer_focus_mode,
|
"A-f" => buffer_expand_mode,
|
||||||
},
|
},
|
||||||
|
|
||||||
"w" => move_next_word_start,
|
"w" => move_next_word_start,
|
||||||
|
|
|
@ -1661,8 +1661,8 @@ impl Editor {
|
||||||
self.tree.resize_buffer(Resize::Shrink, Dimension::Height);
|
self.tree.resize_buffer(Resize::Shrink, Dimension::Height);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn buffer_focus_mode(&mut self) {
|
pub fn buffer_expand_mode(&mut self) {
|
||||||
self.tree.buffer_focus_mode();
|
self.tree.buffer_expand_mode();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn should_close(&self) -> bool {
|
pub fn should_close(&self) -> bool {
|
||||||
|
|
|
@ -82,7 +82,7 @@ pub struct Container {
|
||||||
pub struct ContainerBounds {
|
pub struct ContainerBounds {
|
||||||
width: usize,
|
width: usize,
|
||||||
height: usize,
|
height: usize,
|
||||||
focus: bool,
|
expand: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Container {
|
impl Container {
|
||||||
|
@ -124,7 +124,7 @@ impl Container {
|
||||||
self.node_bounds.push(ContainerBounds {
|
self.node_bounds.push(ContainerBounds {
|
||||||
width: 10,
|
width: 10,
|
||||||
height: 10,
|
height: 10,
|
||||||
focus: false,
|
expand: false,
|
||||||
});
|
});
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ impl Container {
|
||||||
ContainerBounds {
|
ContainerBounds {
|
||||||
width: 10,
|
width: 10,
|
||||||
height: 10,
|
height: 10,
|
||||||
focus: false,
|
expand: false,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
self
|
self
|
||||||
|
@ -149,7 +149,7 @@ impl Container {
|
||||||
fn calculate_slots_width(&self) -> usize {
|
fn calculate_slots_width(&self) -> usize {
|
||||||
self.node_bounds
|
self.node_bounds
|
||||||
.iter()
|
.iter()
|
||||||
.map(|bounds| match bounds.focus {
|
.map(|bounds| match bounds.expand {
|
||||||
true => 40,
|
true => 40,
|
||||||
false => bounds.width,
|
false => bounds.width,
|
||||||
})
|
})
|
||||||
|
@ -159,7 +159,7 @@ impl Container {
|
||||||
fn calculate_slots_height(&self) -> usize {
|
fn calculate_slots_height(&self) -> usize {
|
||||||
self.node_bounds
|
self.node_bounds
|
||||||
.iter()
|
.iter()
|
||||||
.map(|bounds| match bounds.focus {
|
.map(|bounds| match bounds.expand {
|
||||||
true => 40,
|
true => 40,
|
||||||
false => bounds.height,
|
false => bounds.height,
|
||||||
})
|
})
|
||||||
|
@ -455,7 +455,7 @@ impl Tree {
|
||||||
|
|
||||||
for (i, child) in container.children.iter().enumerate() {
|
for (i, child) in container.children.iter().enumerate() {
|
||||||
let bounds = container.node_bounds[i];
|
let bounds = container.node_bounds[i];
|
||||||
let height = match bounds.focus {
|
let height = match bounds.expand {
|
||||||
true => (40.0 * slot_height) as u16,
|
true => (40.0 * slot_height) as u16,
|
||||||
false => (slot_height * bounds.height as f32).floor() 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() {
|
for (i, child) in container.children.iter().enumerate() {
|
||||||
let bounds = container.node_bounds[i];
|
let bounds = container.node_bounds[i];
|
||||||
let width = match bounds.focus {
|
let width = match bounds.expand {
|
||||||
true => (40.0 * slot_width) as u16,
|
true => (40.0 * slot_width) as u16,
|
||||||
false => (slot_width * bounds.width as f32).floor() 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) {
|
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) {
|
if let Some(bounds) = self.get_active_node_bounds_mut(Layout::Vertical) {
|
||||||
bounds.focus = !bounds.focus;
|
bounds.expand = !bounds.expand;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.recalculate();
|
self.recalculate();
|
||||||
|
|
Loading…
Reference in New Issue