aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-06-07 14:32:44 +0000
committerBlaž Hrastnik2021-06-07 14:32:44 +0000
commit9821beb5c4b36f7c34ae6a5cb014b3eb68b9233a (patch)
tree1ac2f1a290bf157536d3f63330b08a3ebebac152 /helix-term
parent3cee0bf200b2785022398867c11455378c29e9fa (diff)
Make gh/gl extend selection in select mode
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/commands.rs24
1 files changed, 13 insertions, 11 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 94175006..00556e18 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -1276,17 +1276,19 @@ pub fn goto_mode(cx: &mut Context) {
} = event
{
// TODO: temporarily show GOTO in the mode list
- match ch {
- 'g' => move_file_start(cx),
- 'e' => move_file_end(cx),
- 'h' => move_line_start(cx),
- 'l' => move_line_end(cx),
- 'd' => goto_definition(cx),
- 'y' => goto_type_definition(cx),
- 'r' => goto_reference(cx),
- 'i' => goto_implementation(cx),
-
- 't' | 'm' | 'b' => {
+ match (cx.doc().mode, ch) {
+ (_, 'g') => move_file_start(cx),
+ (_, 'e') => move_file_end(cx),
+ (Mode::Normal, 'h') => move_line_start(cx),
+ (Mode::Normal, 'l') => move_line_end(cx),
+ (Mode::Select, 'h') => extend_line_start(cx),
+ (Mode::Select, 'l') => extend_line_end(cx),
+ (_, 'd') => goto_definition(cx),
+ (_, 'y') => goto_type_definition(cx),
+ (_, 'r') => goto_reference(cx),
+ (_, 'i') => goto_implementation(cx),
+
+ (_, 't') | (_, 'm') | (_, 'b') => {
let (view, doc) = cx.current();
let pos = doc.selection(view.id).cursor();