Skip to content

Commit

Permalink
doc.line_ending() now returns &'static str
Browse files Browse the repository at this point in the history
  • Loading branch information
janhrastnik committed Jun 16, 2021
1 parent a4f5a01 commit 7cf0fa0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions helix-term/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ where
KeyEvent {
code: KeyCode::Enter,
..
} => '\n', // TODO: we should be calling doc.line_ending() here
} => '\n',
KeyEvent {
code: KeyCode::Char(ch),
..
Expand Down Expand Up @@ -476,7 +476,7 @@ pub fn replace(cx: &mut Context) {
KeyEvent {
code: KeyCode::Enter,
..
} => Some('\n'), // TODO: we should be calling doc.line_ending() here
} => Some('\n'),
_ => None,
};

Expand Down
2 changes: 1 addition & 1 deletion helix-view/src/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ impl Document {
self.diagnostics = diagnostics;
}

pub fn line_ending(&self) -> &str {
pub fn line_ending(&self) -> &'static str {
match self.line_ending {
LineEnding::Crlf => "\u{000D}\u{000A}",
LineEnding::LF => "\u{000A}",
Expand Down

0 comments on commit 7cf0fa0

Please sign in to comment.