From 6e5abb5db029342d3b2fb441965c74c0e41ddd4d Mon Sep 17 00:00:00 2001 From: Ryan Mehri Date: Wed, 1 Nov 2023 08:14:17 -0700 Subject: [PATCH 1/6] make indent/unindent exit select mode --- helix-term/src/commands.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 648aa96e8458..7f9e9d01814a 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -4207,6 +4207,7 @@ fn indent(cx: &mut Context) { }), ); doc.apply(&transaction, view.id); + exit_select_mode(cx); } fn unindent(cx: &mut Context) { @@ -4246,6 +4247,7 @@ fn unindent(cx: &mut Context) { let transaction = Transaction::change(doc.text(), changes.into_iter()); doc.apply(&transaction, view.id); + exit_select_mode(cx); } fn format_selections(cx: &mut Context) { From 4ca01ba9f6ed84b435a7c5d02ccb0485e285083c Mon Sep 17 00:00:00 2001 From: Ryan Mehri Date: Sun, 5 Nov 2023 08:12:21 -0800 Subject: [PATCH 2/6] make paste commands exit select mode --- helix-term/src/commands.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 7f9e9d01814a..4e73568b1ab8 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -4085,22 +4085,27 @@ pub(crate) fn paste_bracketed_value(cx: &mut Context, contents: String) { }; let (view, doc) = current!(cx.editor); paste_impl(&[contents], doc, view, paste, count, cx.editor.mode); + exit_select_mode(cx); } fn paste_clipboard_after(cx: &mut Context) { paste(cx.editor, '+', Paste::After, cx.count()); + exit_select_mode(cx); } fn paste_clipboard_before(cx: &mut Context) { paste(cx.editor, '+', Paste::Before, cx.count()); + exit_select_mode(cx); } fn paste_primary_clipboard_after(cx: &mut Context) { paste(cx.editor, '*', Paste::After, cx.count()); + exit_select_mode(cx); } fn paste_primary_clipboard_before(cx: &mut Context) { paste(cx.editor, '*', Paste::Before, cx.count()); + exit_select_mode(cx); } fn replace_with_yanked(cx: &mut Context) { @@ -4160,6 +4165,7 @@ fn paste_after(cx: &mut Context) { Paste::After, cx.count(), ); + exit_select_mode(cx); } fn paste_before(cx: &mut Context) { @@ -4169,6 +4175,7 @@ fn paste_before(cx: &mut Context) { Paste::Before, cx.count(), ); + exit_select_mode(cx); } fn get_lines(doc: &Document, view_id: ViewId) -> Vec { From 2ae6d4546f3c771744ceb7b39b56bee4dee8dbea Mon Sep 17 00:00:00 2001 From: Ryan Mehri Date: Sun, 5 Nov 2023 08:14:39 -0800 Subject: [PATCH 3/6] make replace with clipboard commands exit select mode --- helix-term/src/commands.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 4e73568b1ab8..d300f848d11c 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -4144,10 +4144,12 @@ fn replace_with_yanked_impl(editor: &mut Editor, register: char, count: usize) { fn replace_selections_with_clipboard(cx: &mut Context) { replace_with_yanked_impl(cx.editor, '+', cx.count()); + exit_select_mode(cx); } fn replace_selections_with_primary_clipboard(cx: &mut Context) { replace_with_yanked_impl(cx.editor, '*', cx.count()); + exit_select_mode(cx); } fn paste(editor: &mut Editor, register: char, pos: Paste, count: usize) { From 0500015fe392bcbb6dc0c2be6427227863fa1c58 Mon Sep 17 00:00:00 2001 From: Ryan Mehri Date: Sun, 5 Nov 2023 08:18:58 -0800 Subject: [PATCH 4/6] make align exit select mode --- helix-term/src/commands.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index d300f848d11c..e73fe2ed604b 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -984,6 +984,7 @@ fn align_selections(cx: &mut Context) { let transaction = Transaction::change(doc.text(), changes.into_iter()); doc.apply(&transaction, view.id); + exit_select_mode(cx); } fn goto_window(cx: &mut Context, align: Align) { From 871014b3c3b706c4fc72bb892e3ea671843f830b Mon Sep 17 00:00:00 2001 From: Ryan Mehri Date: Sun, 5 Nov 2023 08:15:49 -0800 Subject: [PATCH 5/6] make switch case commands exit select mode --- helix-term/src/commands.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index e73fe2ed604b..a783fc683115 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -1528,6 +1528,7 @@ where }); doc.apply(&transaction, view.id); + exit_select_mode(cx); } fn switch_case(cx: &mut Context) { From fb19fddefd94d643853f9fea2cf6b77aef52ffa5 Mon Sep 17 00:00:00 2001 From: Ryan Mehri Date: Sun, 5 Nov 2023 08:07:22 -0800 Subject: [PATCH 6/6] make increment/decrement exit select mode --- helix-term/src/commands.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index a783fc683115..f1d1df063f19 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -5684,6 +5684,7 @@ fn increment_impl(cx: &mut Context, increment_direction: IncrementDirection) { let transaction = Transaction::change(doc.text(), changes.into_iter()); let transaction = transaction.with_selection(new_selection); doc.apply(&transaction, view.id); + exit_select_mode(cx); } }