A simple CPU rendered GUI IDE experience.
Diffstat (limited to 'src/commands.rs')
-rw-r--r--src/commands.rs21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/commands.rs b/src/commands.rs
index 4f19b01..05135cb 100644
--- a/src/commands.rs
+++ b/src/commands.rs
@@ -4,11 +4,10 @@ use std::path::Path;
use Default::default;
use dsb::Cell;
use dsb::cell::Style;
-use lsp_types::*;
use crate::FG;
-use crate::com::{back, filter, next, score};
-use crate::text::{TextArea, col, color_, set_a};
+use crate::menu::{back, filter, next, score};
+use crate::text::{TextArea, col, color_};
const COMMANDS: [(&str, &str); 3] = [
("w", "Write / Save"),
@@ -103,17 +102,19 @@ fn score_c<'a>(
x: impl Iterator<Item = &'a str>,
filter: &'_ str,
) -> Vec<(u32, &'a str, Vec<u32>)> {
- score(x, std::convert::identity, filter)
+ score(x, filter)
}
fn filter_c<'a>(
- completion: &'a Commands,
+ _me: &'a Commands,
f: &'_ str,
) -> impl Iterator<Item = &'a str> {
- filter(COMMANDS.into_iter().map(|(x, _)| x), std::convert::identity, f)
+ filter(COMMANDS.into_iter().map(|(x, _)| x), f)
}
-fn sym_as_str(x: &str) -> &str {
- &x
+impl<'a> crate::menu::Key<'a> for &'a str {
+ fn key(&self) -> impl Into<std::borrow::Cow<'a, str>> {
+ *self
+ }
}
fn charc(c: &str) -> usize {
c.chars().count()
@@ -121,7 +122,7 @@ fn charc(c: &str) -> usize {
#[implicit_fn::implicit_fn]
fn r(
x: &str,
- workspace: &Path,
+ _workspace: &Path,
c: usize,
selected: bool,
indices: &[u32],
@@ -138,7 +139,7 @@ fn r(
});
let i = &mut b[2..];
let qualifier = COMMANDS.iter().find(|y| y.0 == x).unwrap().1.chars();
- let left = i.len() as i32
+ let _left = i.len() as i32
- (charc(&x) as i32 + qualifier.clone().count() as i32)
- 3;