A simple CPU rendered GUI IDE experience.
Diffstat (limited to 'src/rnd.rs')
-rw-r--r--src/rnd.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/rnd.rs b/src/rnd.rs
index 0f625d6..faaf599 100644
--- a/src/rnd.rs
+++ b/src/rnd.rs
@@ -4,6 +4,7 @@ use std::sync::{Arc, LazyLock};
use std::time::Instant;
use atools::prelude::*;
+use crossbeam::channel::select_biased;
use dsb::cell::Style;
use dsb::{Cell, Fonts};
use fimg::pixels::Blend;
@@ -100,8 +101,7 @@ pub fn render(
// }
// }
- text.write_to(
- (cells, (c, r)),
+ text.write_to((cells, (c, r)),
(t_ox, 0),
x,
|(_c, _r), text, mut x| {
@@ -285,7 +285,10 @@ pub fn render(
// std::fs::write("cells", Cell::store(c));
if w >= size.width as usize
- || (position.1 + h >= size.height as usize
+ || (position
+ .1
+ .checked_add(h)
+ .is_none_or(|x| x >= size.height as usize)
&& !position.1.checked_sub(h).is_some())
|| position.1 >= size.height as usize
|| position.0 >= size.width as usize
@@ -463,6 +466,9 @@ pub fn render(
let Some(_y) = _y.checked_sub(text.vo) else {
return;
};
+ let Some(_x) = _x.checked_sub(text.ho) else {
+ return;
+ };
// if !(cursor_position.1 == _y && (_x..=_x2).contains(&cursor_position.0)) {
// return;