Allow for undefined buffer width and/or height, fixes #70
This commit is contained in:
parent
cd1cd0a337
commit
93a7df859a
15 changed files with 99 additions and 72 deletions
|
|
@ -201,7 +201,11 @@ impl<'syntax_system, 'buffer> SyntaxEditor<'syntax_system, 'buffer> {
|
|||
F: FnMut(i32, i32, u32, u32, Color),
|
||||
{
|
||||
let size = self.with_buffer(|buffer| buffer.size());
|
||||
f(0, 0, size.0 as u32, size.1 as u32, self.background_color());
|
||||
if let Some(width) = size.0 {
|
||||
if let Some(height) = size.1 {
|
||||
f(0, 0, width as u32, height as u32, self.background_color());
|
||||
}
|
||||
}
|
||||
self.editor.draw(
|
||||
font_system,
|
||||
cache,
|
||||
|
|
@ -263,7 +267,7 @@ impl<'syntax_system, 'buffer> Edit<'buffer> for SyntaxEditor<'syntax_system, 'bu
|
|||
self.editor.with_buffer_mut(|buffer| {
|
||||
let metrics = buffer.metrics();
|
||||
let scroll = buffer.scroll();
|
||||
let scroll_end = scroll.vertical + buffer.size().1;
|
||||
let scroll_end = scroll.vertical + buffer.size().1.unwrap_or(f32::INFINITY);
|
||||
let mut total_height = 0.0;
|
||||
let mut highlighted = 0;
|
||||
for line_i in 0..buffer.lines.len() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue