A simple CPU rendered GUI IDE experience.
Diffstat (limited to 'src/rnd.rs')
-rw-r--r--src/rnd.rs80
1 files changed, 32 insertions, 48 deletions
diff --git a/src/rnd.rs b/src/rnd.rs
index 8e2ba9b..4453769 100644
--- a/src/rnd.rs
+++ b/src/rnd.rs
@@ -644,51 +644,16 @@ pub fn render(
);
})
});
- match &ed.state {
- State::CodeAction(Rq { result: Some(x), .. }) => 'out: {
- let m = x.maxc();
- let c = x.write(m);
- let (_x, _y) = (cx, cy);
- let _x = _x + text.line_number_offset() + 1;
- let Some(_y) = _y.checked_sub(text.vo) else {
- println!("rah");
- break 'out;
- };
- let Ok((_is_above, left, top, w, h)) = place_around(
- (_x, _y),
- i.copy(),
- &c,
- m,
- ppem,
- ls,
- 0.,
- 0.,
- 0.,
- ) else {
- println!("ra?");
- break 'out;
- };
- i.r#box(
- (
- left.saturating_sub(1) as _,
- top.saturating_sub(1) as _,
- ),
- w as _,
- h as _,
- BORDER,
- );
- }
- State::Command(x) => 'out: {
- let ws = ed.workspace.as_deref().unwrap();
- let c = x.cells(50, ws);
+ let mut drawb = |cells, c| {
+ // let ws = ed.workspace.as_deref().unwrap();
// let (_x, _y) = text.cursor_visual();
let _x = 0;
let _y = r - 1;
let Ok((_, left, top, w, h)) = place_around(
(_x, _y),
i.copy(),
- &c,
- 50,
+ cells,
+ c,
ppem,
ls,
0.,
@@ -696,7 +661,7 @@ pub fn render(
0.,
) else {
println!("ra?");
- break 'out;
+ return;
};
i.r#box(
(
@@ -707,18 +672,22 @@ pub fn render(
h as _,
BORDER,
);
- }
- State::Symbols(Rq { result: Some(x), .. }) => 'out: {
- let ws = ed.workspace.as_deref().unwrap();
- let c = x.cells(50, ws);
- // let (_x, _y) = text.cursor_visual();
- let _x = 0;
- let _y = r - 1;
+ };
+ match &ed.state {
+ State::CodeAction(Rq { result: Some(x), .. }) => 'out: {
+ let m = x.maxc();
+ let c = x.write(m);
+ let (_x, _y) = (cx, cy);
+ let _x = _x + text.line_number_offset() + 1;
+ let Some(_y) = _y.checked_sub(text.vo) else {
+ println!("rah");
+ break 'out;
+ };
let Ok((_is_above, left, top, w, h)) = place_around(
(_x, _y),
i.copy(),
&c,
- 50,
+ m,
ppem,
ls,
0.,
@@ -738,6 +707,21 @@ pub fn render(
BORDER,
);
}
+ State::Command(x) => {
+ let ws = ed.workspace.as_deref().unwrap();
+ let c = x.cells(50, ws);
+ drawb(&c, 50);
+ }
+ State::Symbols(Rq { result: Some(x), .. }) => {
+ let ws = ed.workspace.as_deref().unwrap();
+ let c = x.cells(50, ws);
+ drawb(&c, 50);
+ }
+ State::Runnables(Rq { result:Some(x), .. }) => {
+ let ws = ed.workspace.as_deref().unwrap();
+ let c = x.cells(50, ws);
+ drawb(&c, 50);
+ }
_ => {}
}
let com = match ed.requests.complete {