A simple CPU rendered GUI IDE experience.
Diffstat (limited to 'src/rnd.rs')
| -rw-r--r-- | src/rnd.rs | 57 |
1 files changed, 44 insertions, 13 deletions
@@ -698,6 +698,36 @@ pub fn render( h as _, BORDER, ); + }, + State::Command(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; + let Ok((is_above, left, top, w, mut h)) = place_around( + (_x, _y), + i.copy(), + &c, + 50, + 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, + ); } _ => {} } @@ -887,6 +917,9 @@ pub fn render( draw_at(x, y, &image); } + if matches!(ed.state, State::Default | State::Selection(_) | State::Insert) { + draw_at(x, y, &cursor); + } window.pre_present_notify(); let buffer = surface.buffer_mut().unwrap(); let x = unsafe { @@ -903,17 +936,15 @@ pub fn render( } pub fn simplify_path(x: &str) -> String { - static DEP: LazyLock<Regex> = LazyLock::new(|| { - Regex::new(r"\.cargo\/git\/checkouts\/(?<name>[^/]+)\-[a-f0-9]+\/[a-f0-9]+").unwrap() - }); - static DEP2: LazyLock<Regex> = LazyLock::new(|| { - Regex::new(r"\.cargo\/registry\/src/index.crates.io-[0-9a-f]+/(?<name>[^/]+)\-(?<version>[0-9]+\.[0-9]+\.[0-9]+)").unwrap() - }); - static RUST_SRC: LazyLock<Regex> = LazyLock::new(|| { - Regex::new(r".rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library").unwrap() - }); - let x = x.replace(env!("HOME"), " "); - [(&*RUST_SRC, " "), (&*DEP, " /$name"), (&*DEP2, " /$name")] - .into_iter() - .fold(x, |acc, (r, repl)| r.replace(&acc, repl).into_owned()) + static DEP: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"\.cargo\/git\/checkouts\/(?<name>[^/]+)\-[a-f0-9]+\/[a-f0-9]+").unwrap()); + static DEP2: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"\.cargo\/registry\/src/index.crates.io-[0-9a-f]+/(?<name>[^/]+)\-(?<version>[0-9]+\.[0-9]+\.[0-9]+)").unwrap()); + static RUST_SRC: LazyLock<Regex> = LazyLock::new(|| Regex::new(r".rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library").unwrap()); + let x = x.replace(env!("HOME"), " "); + [ + (&*RUST_SRC, " "), + (&*DEP, " /$name"), + (&*DEP2, " /$name"), + ].into_iter().fold(x, |acc, (r, repl)| { + r.replace(&acc, repl).into_owned() + }) } |