Strip carriage returns from all text in text::Buffer
* Moving the logic from Rope to text::Buffer makes it easier to keep the Rope in sync with the fragment tree. * Removing carriage return characters is lossier, but is much simpler than incrementally maintaining the invariant that there are no carriage returns followed by newlines. We may want to do something smarter in the future. Co-authored-by: Keith Simmons <keith@zed.dev>
This commit is contained in:
parent
116fa92e84
commit
7e9beaf4bb
9 changed files with 132 additions and 100 deletions
|
@ -11,6 +11,20 @@ use text::*;
|
|||
|
||||
pub use proto::{Buffer, BufferState, LineEnding, SelectionSet};
|
||||
|
||||
pub fn deserialize_line_ending(message: proto::LineEnding) -> text::LineEnding {
|
||||
match message {
|
||||
LineEnding::Unix => text::LineEnding::Unix,
|
||||
LineEnding::Windows => text::LineEnding::Windows,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn serialize_line_ending(message: text::LineEnding) -> proto::LineEnding {
|
||||
match message {
|
||||
text::LineEnding::Unix => proto::LineEnding::Unix,
|
||||
text::LineEnding::Windows => proto::LineEnding::Windows,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn serialize_operation(operation: &Operation) -> proto::Operation {
|
||||
proto::Operation {
|
||||
variant: Some(match operation {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue