more cleanup

This commit is contained in:
Simon Gardling
2022-06-01 02:26:21 -04:00
parent 5c5c4d09fb
commit 4cdd764956
3 changed files with 57 additions and 11 deletions

View File

@@ -115,6 +115,12 @@ impl FunctionManager {
}),
);
// Only keep valid chars
new_string = new_string
.chars()
.filter(|c| crate::misc::is_valid_char(c))
.collect::<String>();
// If not fully open, return here as buttons cannot yet be displayed, therefore the user is inable to mark it for deletion
if ui.ctx().animate_bool(*te_id, re.has_focus()) == 1.0 {
function.autocomplete.update_string(&new_string);

View File

@@ -182,3 +182,7 @@ pub fn random_u64() -> Result<u64, getrandom::Error> {
// Merge buffer into u64
Ok(u64::from_be_bytes(buf))
}
include!(concat!(env!("OUT_DIR"), "/valid_chars.rs"));
pub fn is_valid_char(c: &char) -> bool { c.is_alphanumeric() | VALID_EXTRA_CHARS.contains(c) }