aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-03-18 04:28:27 +0000
committerBlaž Hrastnik2021-03-18 04:39:56 +0000
commit8eaf9a432d14b6c2dd084dabbea606e4b1e3baa0 (patch)
treea353a3a9182622b8434165825e03e2264bb444ea /helix-term
parent51c15da3c32b2f0bf3da6db9bca9496d333ec15a (diff)
Make Transaction::change only rely on the rope.
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/commands.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 34e4a813..34e18e3e 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -807,7 +807,7 @@ pub fn open_below(cx: &mut Context) {
);
let transaction =
- Transaction::change(&doc.state, changes.into_iter()).with_selection(selection);
+ Transaction::change(doc.text(), changes.into_iter()).with_selection(selection);
doc.apply(&transaction);
}
@@ -1116,7 +1116,7 @@ pub fn indent(cx: &mut Context) {
let indent = Tendril::from(" ".repeat(TAB_WIDTH));
let transaction = Transaction::change(
- &doc.state,
+ doc.text(),
lines.into_iter().map(|line| {
let pos = doc.text().line_to_char(line);
(pos, pos, Some(indent.clone()))
@@ -1153,7 +1153,7 @@ pub fn unindent(cx: &mut Context) {
}
}
- let transaction = Transaction::change(&doc.state, changes.into_iter());
+ let transaction = Transaction::change(doc.text(), changes.into_iter());
doc.apply(&transaction);
doc.append_changes_to_history();
@@ -1234,7 +1234,7 @@ pub fn join_selections(cx: &mut Context) {
// TODO: joining multiple empty lines should be replaced by a single space.
// need to merge change ranges that touch
- let transaction = Transaction::change(&doc.state, changes.into_iter());
+ let transaction = Transaction::change(doc.text(), changes.into_iter());
// TODO: select inserted spaces
// .with_selection(selection);