mirror of https://github.com/helix-editor/helix
renaming;some key-mapping fixes;refactoring
parent
5aaaf137cb
commit
978c1a126d
|
@ -37,7 +37,7 @@ use helix_view::{
|
|||
info::Info,
|
||||
input::KeyEvent,
|
||||
keyboard::KeyCode,
|
||||
tree::{Dimension, Resize},
|
||||
tree::{self, Dimension, Resize},
|
||||
view::View,
|
||||
Document, DocumentId, Editor, ViewId,
|
||||
};
|
||||
|
@ -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_expand_mode, "Enable expand mode on buffer",
|
||||
toggle_focus_window, "Toggle focus 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.resize_buffer(Resize::Shrink, Dimension::Height);
|
||||
}
|
||||
|
||||
fn buffer_expand_mode(cx: &mut Context) {
|
||||
cx.editor.buffer_expand_mode();
|
||||
fn toggle_focus_window(cx: &mut Context) {
|
||||
cx.editor.toggle_focus_window();
|
||||
}
|
||||
|
||||
fn goto_next_buffer(cx: &mut Context) {
|
||||
|
|
|
@ -27,11 +27,11 @@ pub fn default() -> HashMap<Mode, KeyTrie> {
|
|||
"end" => goto_line_end,
|
||||
|
||||
"A-w" => { "Alter Window"
|
||||
"A-h"|"A-left" => shrink_buffer_width,
|
||||
"A-l"|"A-right" => grow_buffer_width,
|
||||
"A-j"|"A-down" => shrink_buffer_height,
|
||||
"A-k"|"A-up" => grow_buffer_height,
|
||||
"A-f" => buffer_expand_mode,
|
||||
"A-h"|"A-left" |"h"|"left" => shrink_buffer_width,
|
||||
"A-l"|"A-right"|"l"|"right" => grow_buffer_width,
|
||||
"A-j"|"A-down" |"j"|"down" => shrink_buffer_height,
|
||||
"A-k"|"A-up" |"k"|"up" => grow_buffer_height,
|
||||
"A-f"|"f" => toggle_focus_window,
|
||||
},
|
||||
|
||||
"A-W" => { "Alter Window" sticky=true
|
||||
|
@ -39,7 +39,7 @@ pub fn default() -> HashMap<Mode, KeyTrie> {
|
|||
"l"|"right" => grow_buffer_width,
|
||||
"j"|"down" => shrink_buffer_height,
|
||||
"k"|"up" => grow_buffer_height,
|
||||
"f" => buffer_expand_mode,
|
||||
"f" => toggle_focus_window,
|
||||
},
|
||||
|
||||
"w" => move_next_word_start,
|
||||
|
|
|
@ -1649,8 +1649,8 @@ impl Editor {
|
|||
self.tree.resize_buffer(resize_type, dimension);
|
||||
}
|
||||
|
||||
pub fn buffer_expand_mode(&mut self) {
|
||||
self.tree.buffer_expand_mode();
|
||||
pub fn toggle_focus_window(&mut self) {
|
||||
self.tree.toggle_focus_window();
|
||||
}
|
||||
|
||||
pub fn should_close(&self) -> bool {
|
||||
|
|
|
@ -96,10 +96,10 @@ impl Container {
|
|||
}
|
||||
|
||||
fn get_child_by_view_id(&mut self, node: ViewId) -> Option<&mut ContainerBounds> {
|
||||
if let Some(index) = self.children.iter().position(|child| child == &node) {
|
||||
return self.node_bounds.get_mut(index);
|
||||
};
|
||||
None
|
||||
self.children
|
||||
.iter()
|
||||
.position(|child| child == &node)
|
||||
.and_then(|index| self.node_bounds.get_mut(index))
|
||||
}
|
||||
|
||||
fn push_child(&mut self, node: ViewId) -> &mut Self {
|
||||
|
@ -736,7 +736,7 @@ impl Tree {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn buffer_expand_mode(&mut self) {
|
||||
pub fn toggle_focus_window(&mut self) {
|
||||
if let Some(bounds) = self.get_active_node_bounds_mut(Layout::Horizontal) {
|
||||
bounds.expand = !bounds.expand;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue