|
|
|
|
@ -16,6 +16,8 @@ mod keybinds { |
|
|
|
|
Redo, |
|
|
|
|
NewLines, |
|
|
|
|
DeleteLines, |
|
|
|
|
TabForward, |
|
|
|
|
TabBackward, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
pub(super) enum Movement { |
|
|
|
|
@ -61,6 +63,17 @@ impl ModifierKeys { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
pub fn tab(buffer: &mut String, cursor_position: &mut usize, modifiers: &ModifierKeys) { |
|
|
|
|
if modifiers.shift { |
|
|
|
|
println!("unimplemented back-tab"); |
|
|
|
|
} else { |
|
|
|
|
// for _ in 0..4 {
|
|
|
|
|
buffer.insert_str(*cursor_position, " "); |
|
|
|
|
*cursor_position += 4; |
|
|
|
|
// }
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
pub fn backspace(buffer: &mut String, cursor_position: &mut usize, modifiers: &ModifierKeys) { |
|
|
|
|
if modifiers.ctrl { |
|
|
|
|
// Word backspace
|
|
|
|
|
@ -73,7 +86,6 @@ pub fn backspace(buffer: &mut String, cursor_position: &mut usize, modifiers: &M |
|
|
|
|
*cursor_position -= 1; |
|
|
|
|
buffer.remove(*cursor_position); |
|
|
|
|
} |
|
|
|
|
// i shouldn't have to do this
|
|
|
|
|
*cursor_position -= 1; |
|
|
|
|
buffer.remove(*cursor_position); |
|
|
|
|
} else { |
|
|
|
|
|