doc.line_ending() now returns &'static str

imgbot
Jan Hrastnik 4 years ago
parent a4f5a0134e
commit 7cf0fa05a4

@ -348,7 +348,7 @@ where
KeyEvent { KeyEvent {
code: KeyCode::Enter, code: KeyCode::Enter,
.. ..
} => '\n', // TODO: we should be calling doc.line_ending() here } => '\n',
KeyEvent { KeyEvent {
code: KeyCode::Char(ch), code: KeyCode::Char(ch),
.. ..
@ -476,7 +476,7 @@ pub fn replace(cx: &mut Context) {
KeyEvent { KeyEvent {
code: KeyCode::Enter, code: KeyCode::Enter,
.. ..
} => Some('\n'), // TODO: we should be calling doc.line_ending() here } => Some('\n'),
_ => None, _ => None,
}; };

@ -741,7 +741,7 @@ impl Document {
self.diagnostics = diagnostics; self.diagnostics = diagnostics;
} }
pub fn line_ending(&self) -> &str { pub fn line_ending(&self) -> &'static str {
match self.line_ending { match self.line_ending {
LineEnding::Crlf => "\u{000D}\u{000A}", LineEnding::Crlf => "\u{000D}\u{000A}",
LineEnding::LF => "\u{000A}", LineEnding::LF => "\u{000A}",

Loading…
Cancel
Save