Skip to content

Commit

Permalink
use ending.len_chars() directly
Browse files Browse the repository at this point in the history
  • Loading branch information
kirawi committed Apr 6, 2022
1 parent ad9acfe commit 59d0ff8
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions helix-term/src/commands/typed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@ fn set_line_ending(
args: &[Cow<str>],
_event: PromptEvent,
) -> anyhow::Result<()> {
use helix_core::line_ending;
use LineEnding::*;

// If no argument, report current line ending setting.
Expand Down Expand Up @@ -329,11 +328,10 @@ fn set_line_ending(
let transaction = Transaction::change(
doc.text(),
doc.text().lines().filter_map(|line| {
let current_pos = pos;
pos += line.len_chars();
match line_ending::get_line_ending(&line) {
match helix_core::line_ending::get_line_ending(&line) {
Some(ending) if ending != line_ending => {
let start = current_pos + line_ending::rope_end_without_line_ending(&line);
let start = pos - ending.len_chars();
let end = pos;
Some((start, end, Some(line_ending.as_str().into())))
}
Expand Down

0 comments on commit 59d0ff8

Please sign in to comment.