diff --git a/modules/desktop-environment/default.nix b/modules/desktop-environment/default.nix index ef44236..51d9ee6 100644 --- a/modules/desktop-environment/default.nix +++ b/modules/desktop-environment/default.nix @@ -8,7 +8,6 @@ ./dm.nix ./tlp.nix ./locale.nix - ./printing.nix ]; services.flatpak.enable = true; security.polkit.enable = true; diff --git a/modules/desktop-environment/printing.nix b/modules/desktop-environment/printing.nix index 3233279..006ea0b 100644 --- a/modules/desktop-environment/printing.nix +++ b/modules/desktop-environment/printing.nix @@ -11,9 +11,10 @@ ptouch-driver epsonscan2 epson-escpr - epson-escpr2 + epson-inkjet-printer-escpr2 epson_201207w epson-alc1100 + epson ]; }; } diff --git a/modules/shell/helix.nix b/modules/shell/helix.nix index adfda34..d24aa16 100644 --- a/modules/shell/helix.nix +++ b/modules/shell/helix.nix @@ -102,7 +102,7 @@ d = "@vgd"; f = "@vgy"; h = ":toggle-option lsp.display-inlay-hints"; - t = ":pipe flip-bool"; + t = "@|flip-bool"; }; }; insert = { diff --git a/programs/flip-bool/src/main.rs b/programs/flip-bool/src/main.rs index 0b99ab8..299685f 100644 --- a/programs/flip-bool/src/main.rs +++ b/programs/flip-bool/src/main.rs @@ -4,6 +4,7 @@ #![feature(pattern)] use std::{ + hint::black_box, io::{Read, Write}, str::pattern::Pattern, }; @@ -85,27 +86,29 @@ fn find_bools(input: &str) -> [[Vec; 2]; BOOL_COUNT] { input .match_indices(it) .filter_map(|it| { - fn char_guard(c: char) -> bool { - !(c.is_alphanumeric() || c.is_contained_in("-_")) - } + let char_guard = |c: char| !(c.is_alphanumeric() || c.is_contained_in("-_")); + let mut allow = true; - let last_idx = it.0 + it.1.len(); - - (it.0 > 0 - && last_idx < input.len() - && char_guard( + if it.0 > 0 { + allow &= char_guard( input[it.1.floor_char_boundary(it.0 - 1)..it.0] .chars() .last() .unwrap(), - ) - && char_guard( + ); + } + + let last_idx = it.0 + it.1.len(); + if last_idx < input.len() { + allow &= char_guard( input[(last_idx)..(input.ceil_char_boundary(last_idx + 1))] .chars() .last() .unwrap(), - )) - .then_some(it.0) + ); + } + + allow.then_some(it.0) }) .collect() })