aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/commands.rs
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-03-15 08:13:36 +0000
committerBlaž Hrastnik2021-03-15 08:13:36 +0000
commiteea339545cf7198b7a9e477ee2a9ee081ee5be36 (patch)
tree6eb3fa01ef188a85ed61978459cb8797465a4e3c /helix-term/src/commands.rs
parentdd91090a1ae931a604c51b9c6d7d8c9b46761af4 (diff)
Add command for keeping only the primary selection.
Diffstat (limited to 'helix-term/src/commands.rs')
-rw-r--r--helix-term/src/commands.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index d75fd694..507e5be6 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -1167,6 +1167,14 @@ pub fn keep_selections(cx: &mut Context) {
cx.push_layer(Box::new(prompt));
}
+pub fn keep_primary_selection(cx: &mut Context) {
+ let doc = cx.doc();
+
+ let range = doc.selection().primary();
+ let selection = Selection::single(range.anchor, range.head);
+ doc.set_selection(selection);
+}
+
//
pub fn save(cx: &mut Context) {