summaryrefslogtreecommitdiff
path: root/helix-term/src/commands.rs
diff options
context:
space:
mode:
authorJan Hrastnik2021-06-19 12:58:49 +0000
committerJan Hrastnik2021-06-19 12:58:49 +0000
commit1e80fbb6020c75bdc5d7e3edc9513b4ed52c4e6b (patch)
tree243de45444d7b3edd5d6ecc021494d8984c8a7e4 /helix-term/src/commands.rs
parentcdd9347457f0608346894cd0aab35b412cb59a7b (diff)
fix merge issue
Diffstat (limited to 'helix-term/src/commands.rs')
-rw-r--r--helix-term/src/commands.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 07d2999b..af2e8eee 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -1668,16 +1668,16 @@ fn open(cx: &mut Context, open: Open) {
let mut ranges = SmallVec::with_capacity(selection.len());
let mut offs = 0;
- let line = match open {
- // adjust position to the end of the line (next line - 1)
- Open::Below => line + 1,
- // adjust position to the end of the previous line (current line - 1)
- Open::Above => line,
- };
-
let mut transaction = Transaction::change_by_selection(contents, selection, |range| {
let line = text.char_to_line(range.head);
+ let line = match open {
+ // adjust position to the end of the line (next line - 1)
+ Open::Below => line + 1,
+ // adjust position to the end of the previous line (current line - 1)
+ Open::Above => line,
+ };
+
// insert newlines after this index for both Above and Below variants
let linend_index = doc.text().line_to_char(line).saturating_sub(1);