on master help sign in
doc.line_ending() now returns &'static str
7cf0fa0Jan Hrastnik
helix-term/src/commands.rs+2−2
@@ -348,7 +348,7 @@ where
348 KeyEvent {
348 KeyEvent {
349 code: KeyCode::Enter,
349 code: KeyCode::Enter,
350 ..
350 ..
351− } => '\n', // TODO: we should be calling doc.line_ending() here
351+ } => '\n',
352 KeyEvent {
352 KeyEvent {
353 code: KeyCode::Char(ch),
353 code: KeyCode::Char(ch),
354 ..
354 ..
@@ -476,7 +476,7 @@ pub fn replace(cx: &mut Context) {
476 KeyEvent {
476 KeyEvent {
477 code: KeyCode::Enter,
477 code: KeyCode::Enter,
478 ..
478 ..
479− } => Some('\n'), // TODO: we should be calling doc.line_ending() here
479+ } => Some('\n'),
480 _ => None,
480 _ => None,
481 };
481 };
482
482
helix-view/src/document.rs+1−1
@@ -741,7 +741,7 @@ impl Document {
741 self.diagnostics = diagnostics;
741 self.diagnostics = diagnostics;
742 }
742 }
743
743
744− pub fn line_ending(&self) -> &str {
744+ pub fn line_ending(&self) -> &'static str {
745 match self.line_ending {
745 match self.line_ending {
746 LineEnding::Crlf => "\u{000D}\u{000A}",
746 LineEnding::Crlf => "\u{000D}\u{000A}",
747 LineEnding::LF => "\u{000A}",
747 LineEnding::LF => "\u{000A}",