diff --git a/Cargo.toml b/Cargo.toml index e57b606..564eab9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "sweet" description = "simple wayland event encoding text" -version = "0.3.0" +version = "0.4.0" edition = "2021" build = "build.rs" diff --git a/flake.nix b/flake.nix index 87eba62..e9fc35b 100644 --- a/flake.nix +++ b/flake.nix @@ -3,20 +3,25 @@ inputs.flake-utils.url = "github:numtide/flake-utils"; - outputs = { self, nixpkgs, flake-utils }: - flake-utils.lib.eachDefaultSystem - (system: - let pkgs = nixpkgs.legacyPackages.${system}; in - { - devShells.default = pkgs.mkShell rec { - packages = with pkgs; - [ - stdenv.cc.cc.lib - ]; + outputs = + { + self, + nixpkgs, + flake-utils, + }: + flake-utils.lib.eachDefaultSystem ( + system: + let + pkgs = nixpkgs.legacyPackages.${system}; + in + { + devShells.default = pkgs.mkShell rec { + packages = with pkgs; [ + stdenv.cc.cc.lib + ]; - LD_LIBRARY_PATH = "${nixpkgs.lib.makeLibraryPath packages}"; - LIBCLANG_PATH="${pkgs.llvmPackages.libclang.lib}/lib"; - }; - } - ); + LD_LIBRARY_PATH = "${nixpkgs.lib.makeLibraryPath packages}"; + }; + } + ); } diff --git a/template.pest b/template.pest index 487a4cf..c80666a 100644 --- a/template.pest +++ b/template.pest @@ -102,15 +102,6 @@ key_base = { | ^"next" | ^"pagedown" | ^"pageup" - | ^"f1" - | ^"f2" - | ^"f3" - | ^"f4" - | ^"f5" - | ^"f6" - | ^"f7" - | ^"f8" - | ^"f9" | ^"f10" | ^"f11" | ^"f12" @@ -126,6 +117,15 @@ key_base = { | ^"f22" | ^"f23" | ^"f24" + | ^"f1" + | ^"f2" + | ^"f3" + | ^"f4" + | ^"f5" + | ^"f6" + | ^"f7" + | ^"f8" + | ^"f9" | ASCII_ALPHANUMERIC } diff --git a/tests/tests.rs b/tests/tests.rs index 082a44d..b21bf82 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -261,6 +261,27 @@ w Ok(()) } +#[test] +fn test_greedy_ordering() -> Result<(), ParseError> { + let contents = " +f9 + librewolf + +f12 + kitty + "; + let parsed = SwhkdParser::from(ParserInput::Raw(&contents))?; + + let known = vec![ + Binding::running("librewolf").on(Definition::new(evdev::Key::KEY_F9)), + Binding::running("kitty").on(Definition::new(evdev::Key::KEY_F12)), + ]; + + assert_eq!(parsed.bindings, known); + + Ok(()) +} + #[test] // this test is stricter than the previous parser // gimp is not a valid key or a modifier