mirror of
https://github.com/ilyakooo0/helix.git
synced 2024-12-01 11:23:10 +03:00
Work around rendering errors for positions offscreen.
This commit is contained in:
parent
8f0ddf9632
commit
c70080dd68
@ -198,12 +198,16 @@ impl EditorView {
|
|||||||
|
|
||||||
// TODO: paint cursor heads except primary
|
// TODO: paint cursor heads except primary
|
||||||
|
|
||||||
surface.set_string(
|
// HAXX: we don't render the char if it's offscreen. This should be
|
||||||
viewport.x + visual_x,
|
// skipped in a better way much earlier
|
||||||
viewport.y + line,
|
if visual_x < viewport.width {
|
||||||
grapheme,
|
surface.set_string(
|
||||||
style,
|
viewport.x + visual_x,
|
||||||
);
|
viewport.y + line,
|
||||||
|
grapheme,
|
||||||
|
style,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
visual_x += width;
|
visual_x += width;
|
||||||
}
|
}
|
||||||
@ -268,12 +272,18 @@ impl EditorView {
|
|||||||
|
|
||||||
if let Some(path) = doc.relative_path() {
|
if let Some(path) = doc.relative_path() {
|
||||||
let path = path.to_string_lossy();
|
let path = path.to_string_lossy();
|
||||||
surface.set_string(viewport.x + 6, viewport.y, path, text_color);
|
surface.set_stringn(
|
||||||
|
viewport.x + 6,
|
||||||
|
viewport.y,
|
||||||
|
path,
|
||||||
|
viewport.width.saturating_sub(6) as usize,
|
||||||
|
text_color,
|
||||||
|
);
|
||||||
// TODO: append [+] if modified
|
// TODO: append [+] if modified
|
||||||
}
|
}
|
||||||
|
|
||||||
surface.set_string(
|
surface.set_string(
|
||||||
viewport.x + viewport.width - 10,
|
viewport.x + viewport.width.saturating_sub(10),
|
||||||
viewport.y,
|
viewport.y,
|
||||||
format!("{}", doc.diagnostics.len()),
|
format!("{}", doc.diagnostics.len()),
|
||||||
text_color,
|
text_color,
|
||||||
|
@ -152,16 +152,27 @@ impl Tree {
|
|||||||
match container.layout {
|
match container.layout {
|
||||||
Layout::Vertical => unimplemented!(),
|
Layout::Vertical => unimplemented!(),
|
||||||
Layout::Horizontal => {
|
Layout::Horizontal => {
|
||||||
let len = container.children.len() as u16;
|
let len = container.children.len();
|
||||||
|
|
||||||
let width = area.width / len;
|
let width = area.width / len as u16;
|
||||||
|
|
||||||
let mut child_x = area.x;
|
let mut child_x = area.x;
|
||||||
|
|
||||||
for (_i, child) in container.children.iter().enumerate() {
|
for (i, child) in container.children.iter().enumerate() {
|
||||||
let area = Rect::new(child_x, area.y, width, area.height);
|
let mut area = Rect::new(
|
||||||
|
child_x,
|
||||||
|
container.area.y,
|
||||||
|
width,
|
||||||
|
container.area.height,
|
||||||
|
);
|
||||||
child_x += width;
|
child_x += width;
|
||||||
|
|
||||||
|
// last child takes the remaining width because we can get uneven
|
||||||
|
// space from rounding
|
||||||
|
if i == len - 1 {
|
||||||
|
area.width = container.area.x + container.area.width - area.x;
|
||||||
|
}
|
||||||
|
|
||||||
self.stack.push((*child, area));
|
self.stack.push((*child, area));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user