on master help sign in
fixed some problems from rebasing
9c3eadbJan Hrastnik
helix-term/src/commands.rs+6−16
@@ -4,14 +4,9 @@ use helix_core::{
4 movement::{self, Direction},
4 movement::{self, Direction},
5 object, pos_at_coords,
5 object, pos_at_coords,
6 regex::{self, Regex},
6 regex::{self, Regex},
7−<<<<<<< HEAD
8 register::{self, Register, Registers},
7 register::{self, Register, Registers},
9− search, selection, Change, ChangeSet, Position, Range, Rope, RopeSlice, Selection, SmallVec,
10− Tendril, Transaction,
11−=======
12− register, search, selection, Change, ChangeSet, LineEnding, Position, Range, Rope, RopeSlice,
8+ search, selection, Change, ChangeSet, LineEnding, Position, Range, Rope, RopeSlice, Selection,
13− Selection, SmallVec, Tendril, Transaction,
9+ SmallVec, Tendril, Transaction,
14−>>>>>>> 856fd95 (trying out line ending helper functions in commands.rs)
15};
10};
16
11
17use helix_view::{
12use helix_view::{
@@ -348,7 +343,7 @@ where
348 KeyEvent {
343 KeyEvent {
349 code: KeyCode::Enter,
344 code: KeyCode::Enter,
350 ..
345 ..
351− } => '\n',
346+ } => '\n',
352 KeyEvent {
347 KeyEvent {
353 code: KeyCode::Char(ch),
348 code: KeyCode::Char(ch),
354 ..
349 ..
@@ -2285,15 +2280,10 @@ fn paste_impl(
2285 .unwrap(),
2280 .unwrap(),
2286 );
2281 );
2287
2282
2288−<<<<<<< HEAD
2289 // if any of values ends \n it's linewise paste
2283 // if any of values ends \n it's linewise paste
2290− let linewise = values.iter().any(|value| value.ends_with('\n'));
2284+ let linewise = values
2291−=======
2292− // if any of values ends \n it's linewise paste
2293− let linewise = values
2294− .iter()
2285+ .iter()
2295− .any(|value| value.ends_with(doc.line_ending()));
2286+ .any(|value| value.ends_with(doc.line_ending()));
2296−>>>>>>> 856fd95 (trying out line ending helper functions in commands.rs)
2297
2287
2298 let mut values = values.iter().cloned().map(Tendril::from).chain(repeat);
2288 let mut values = values.iter().cloned().map(Tendril::from).chain(repeat);
2299
2289
helix-view/src/document.rs+2−15
@@ -5,7 +5,9 @@ use std::path::{Component, Path, PathBuf};
5use std::sync::Arc;
5use std::sync::Arc;
6
6
7use helix_core::{
7use helix_core::{
8+ auto_detect_line_ending,
8 chars::{char_is_linebreak, char_is_whitespace},
9 chars::{char_is_linebreak, char_is_whitespace},
10+ history::History,
9 syntax::{LanguageConfiguration, LOADER},
11 syntax::{LanguageConfiguration, LOADER},
10 ChangeSet, Diagnostic, LineEnding, Rope, Selection, State, Syntax, Transaction,
12 ChangeSet, Diagnostic, LineEnding, Rope, Selection, State, Syntax, Transaction,
11 DEFAULT_LINE_ENDING,
13 DEFAULT_LINE_ENDING,
@@ -28,21 +30,6 @@ pub enum IndentStyle {
28 Spaces(u8),
30 Spaces(u8),
29}
31}
30
32
31−/// Represents one of the valid Unicode line endings.
32−/// Also acts as an index into `LINE_ENDINGS`.
33−#[derive(PartialEq, Copy, Clone, Debug)]
34−pub enum LineEnding {
35− None = 0, // No line ending
36− Crlf = 1, // CarriageReturn followed by LineFeed
37− LF = 2, // U+000A -- LineFeed
38− VT = 3, // U+000B -- VerticalTab
39− FF = 4, // U+000C -- FormFeed
40− CR = 5, // U+000D -- CarriageReturn
41− Nel = 6, // U+0085 -- NextLine
42− LS = 7, // U+2028 -- Line Separator
43− PS = 8, // U+2029 -- ParagraphSeparator
44−}
45−
46pub struct Document {
33pub struct Document {
47 // rope + selection
34 // rope + selection
48 pub(crate) id: DocumentId,
35 pub(crate) id: DocumentId,