|
|
@ -1,11 +1,11 @@
|
|
|
|
use helix_core::{
|
|
|
|
use helix_core::{
|
|
|
|
comment, coords_at_pos, find_first_non_whitespace_char, find_root, graphemes, indent,
|
|
|
|
comment, coords_at_pos, find_first_non_whitespace_char, find_root, get_line_ending, graphemes,
|
|
|
|
match_brackets,
|
|
|
|
indent, match_brackets,
|
|
|
|
movement::{self, Direction},
|
|
|
|
movement::{self, Direction},
|
|
|
|
object, pos_at_coords,
|
|
|
|
object, pos_at_coords,
|
|
|
|
regex::{self, Regex},
|
|
|
|
regex::{self, Regex},
|
|
|
|
register::{self, Register, Registers},
|
|
|
|
register::{self, Register, Registers},
|
|
|
|
search, selection, Change, ChangeSet, LineEnding, Position, Range, Rope, RopeSlice, Selection, get_line_ending,
|
|
|
|
search, selection, Change, ChangeSet, LineEnding, Position, Range, Rope, RopeSlice, Selection,
|
|
|
|
SmallVec, Tendril, Transaction,
|
|
|
|
SmallVec, Tendril, Transaction,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -183,9 +183,11 @@ pub fn move_line_end(cx: &mut Context) {
|
|
|
|
let text = doc.text();
|
|
|
|
let text = doc.text();
|
|
|
|
let line = text.char_to_line(range.head);
|
|
|
|
let line = text.char_to_line(range.head);
|
|
|
|
|
|
|
|
|
|
|
|
let pos = text
|
|
|
|
let pos = text.line_to_char(line + 1).saturating_sub(
|
|
|
|
.line_to_char(line + 1)
|
|
|
|
get_line_ending(&text.line(line))
|
|
|
|
.saturating_sub(get_line_ending(&text.line(line)).map(|le| le.len_chars()).unwrap_or(0));
|
|
|
|
.map(|le| le.len_chars())
|
|
|
|
|
|
|
|
.unwrap_or(0),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
Range::new(pos, pos)
|
|
|
|
Range::new(pos, pos)
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -606,9 +608,11 @@ pub fn extend_line_end(cx: &mut Context) {
|
|
|
|
let text = doc.text();
|
|
|
|
let text = doc.text();
|
|
|
|
let line = text.char_to_line(range.head);
|
|
|
|
let line = text.char_to_line(range.head);
|
|
|
|
|
|
|
|
|
|
|
|
let pos = text
|
|
|
|
let pos = text.line_to_char(line + 1).saturating_sub(
|
|
|
|
.line_to_char(line + 1)
|
|
|
|
get_line_ending(&text.line(line))
|
|
|
|
.saturating_sub(get_line_ending(&text.line(line)).map(|le| le.len_chars()).unwrap_or(0));
|
|
|
|
.map(|le| le.len_chars())
|
|
|
|
|
|
|
|
.unwrap_or(0),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
Range::new(range.anchor, pos)
|
|
|
|
Range::new(range.anchor, pos)
|
|
|
|
});
|
|
|
|
});
|
|
|
|