Update cosmic-text, fixing CRLF handling (#64)

This commit is contained in:
Jeremy Soller 2024-04-30 12:22:39 -06:00
parent 42cade3149
commit 0fa09ab57b
No known key found for this signature in database
GPG key ID: D02FD439211AF56F
2 changed files with 25 additions and 19 deletions

View file

@ -1,5 +1,6 @@
use cosmic_text::{
Align, Attrs, AttrsList, BufferLine, Family, FontSystem, LayoutLine, ShapeBuffer, Shaping, Wrap,
Align, Attrs, AttrsList, BufferLine, Family, FontSystem, LayoutLine, LineEnding, ShapeBuffer,
Shaping, Wrap,
};
use std::collections::HashMap;
@ -32,7 +33,12 @@ impl LineNumberCache {
//TODO: do not repeat, used in App::init
let attrs = Attrs::new().family(Family::Monospace);
let text = format!("{:width$}", key.number, width = key.width);
let mut buffer_line = BufferLine::new(text, AttrsList::new(attrs), Shaping::Advanced);
let mut buffer_line = BufferLine::new(
text,
LineEnding::default(),
AttrsList::new(attrs),
Shaping::Advanced,
);
buffer_line.set_align(Some(Align::Left));
buffer_line
.layout_in_buffer(