Update cosmic-text to 0.13
This commit is contained in:
parent
bae25b74f6
commit
201245a85d
5 changed files with 97 additions and 87 deletions
|
|
@ -178,10 +178,8 @@ impl editor::Editor for Editor {
|
|||
.get(cursor.line)
|
||||
.expect("Cursor line should be present");
|
||||
|
||||
let layout = line
|
||||
.layout_opt()
|
||||
.as_ref()
|
||||
.expect("Line layout should be cached");
|
||||
let layout =
|
||||
line.layout_opt().expect("Line layout should be cached");
|
||||
|
||||
let mut lines = layout.iter().enumerate();
|
||||
|
||||
|
|
@ -706,11 +704,7 @@ fn highlight_line(
|
|||
from: usize,
|
||||
to: usize,
|
||||
) -> impl Iterator<Item = (f32, f32)> + '_ {
|
||||
let layout = line
|
||||
.layout_opt()
|
||||
.as_ref()
|
||||
.map(Vec::as_slice)
|
||||
.unwrap_or_default();
|
||||
let layout = line.layout_opt().map(Vec::as_slice).unwrap_or_default();
|
||||
|
||||
layout.iter().map(move |visual_line| {
|
||||
let start = visual_line
|
||||
|
|
@ -761,9 +755,7 @@ fn visual_lines_offset(line: usize, buffer: &cosmic_text::Buffer) -> i32 {
|
|||
let visual_lines_offset: usize = buffer.lines[start..]
|
||||
.iter()
|
||||
.take(end - start)
|
||||
.map(|line| {
|
||||
line.layout_opt().as_ref().map(Vec::len).unwrap_or_default()
|
||||
})
|
||||
.map(|line| line.layout_opt().map(Vec::len).unwrap_or_default())
|
||||
.sum();
|
||||
|
||||
visual_lines_offset as i32 * if scroll.line < line { 1 } else { -1 }
|
||||
|
|
|
|||
|
|
@ -156,6 +156,7 @@ impl core::text::Paragraph for Paragraph {
|
|||
}),
|
||||
text::to_attributes(text.font),
|
||||
text::to_shaping(text.shaping),
|
||||
None,
|
||||
);
|
||||
|
||||
let min_bounds = text::measure(&buffer);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue