Angelo Fallaria
6f18996445
refactor(config): refactor curly brace finding
...
Remove a lot of unnecessary mutable variables to find
the curly braces. Instead, use a bit of functional programming
to achieve the algorithm.
2 years ago
Angelo Fallaria
343e5c74da
refactor: convert another if block into guard clause
2 years ago
Angelo Fallaria
6720ab6ed3
refactor(config): use guard clause in loop
2 years ago
Angelo Fallaria
7d59afb3c6
refactor(config): improve duplicate hotkey check
2 years ago
EdenQwQ
ee31c54d42
[update] config: more tests for range syntax
2 years ago
EdenQwQ
49ebf957b3
rustfmt
2 years ago
EdenQwQ
caaedeb4a7
[update] handle invalid range
2 years ago
EdenQwQ
214b1b1692
Merge remote-tracking branch 'origin/error_display' into config_devel
...
[merge] config error display by Angelo
2 years ago
EdenQwQ
5df6027991
[remove] config: remove test for nonsensical file
2 years ago
Angelo Fallaria
9567883fed
feat: add Display functionality for config errs
2 years ago
Angelo Fallaria
f78e40c67c
test: add tests for error display
2 years ago
EdenQwQ
85fe0f70f2
[update] config: support for ascii character as range
2 years ago
EdenQwQ
165d6b50af
[rustfmt] config
2 years ago
EdenQwQ
62cbe3e420
[update] config: basic range syntax(support numbers only)
2 years ago
EdenQwQ
f60903d2f3
[refactor, update] config: basic curly brace syntax
2 years ago
EdenQwQ
c7da0a4669
[update] config: a new function to extract all the items inside a pair of curly braces
2 years ago
EdenQwQ
a780a6ea4b
[update] config.rs: comment out unimplemented modifiers; add delete, brightness
2 years ago
Angelo Fallaria
ce3b551628
style: fix formatting w/ rustfmt
2 years ago
Angelo Fallaria
7098ff3aab
refactor(config): put test-only modules in own mod
...
std::fs and std::io::Write are used in the unit tests,
but not in the main program itself, which results in a
warning by the Rust compiler. They are now only used
in the test module, when `cargo test` is run.
2 years ago
Angelo Fallaria
e10d2ac005
fix(config): alleviate panic on blank config filee
...
Whenever the config parse was parsed an empty config,
a panic would result because of trying to process an
empty vector:
---- config::tests::test_blank_config stdout ----
thread 'config::tests::test_blank_config' panicked at 'index out of bounds: the len is 0 but the index is 0', src/config.rs:237:33
This commit alleviates that by simply returning an empty
Hotkey vector whenever an empty config is passed.
2 years ago
EdenQwQ
106bef257c
added many keysyms
2 years ago
Shinyzenith
44568d19fc
[Update] add printscr to enum
2 years ago
EdenQwQ
8499692702
Implement inline comments support when parsing config
2 years ago
Shinyzenith
0af29511f5
[wip] working cooldown
2 years ago
Shinyzenith
e949a8bd72
[wip] Check last hotkey for duplicate removal.
2 years ago
Shinyzenith
465c155be5
[testing]Print possible matches based on key count
2 years ago
EdenQwQ
34c2426e03
modify test to make sure this also work with empty modifier
2 years ago
EdenQwQ
d697eaea36
ignore duplicated keys
2 years ago
EdenQwQ
d83063fc1e
convert to lowercase
2 years ago
Eden
eca333e62e
Merge pull request #29 from waycrate/config_new
...
refactor
2 years ago
Shinyzenith
45b3b1b260
[update] make all fields in hotkey struct, pub
2 years ago
EdenQwQ
271c8c32b2
finished
2 years ago
EdenQwQ
d007cfdace
join lines ending with backslash and have the same type before actual parsing
2 years ago
EdenQwQ
2e84be120e
a new vector called lines_with_types to store the position and the type of each line
2 years ago
EdenQwQ
c64ed4bcc3
ignore some tests concerning empty commands
2 years ago
Angelo Fallaria
560f69dc0a
test: refactor return statement in tests
...
In many tests, the structure at the end of the test function is like
this:
```rust
eval_test(...);
Ok(())
```
It can be simplified to just:
```rust
eval_test(...)
```
2 years ago
Angelo Fallaria
f9e0db9309
fix: remove unused code in parse_keybind
2 years ago
Angelo Fallaria
5ad8877e73
feat: allow empty commands
2 years ago
Angelo Fallaria
0f3f64551f
style(config): format w/ rustfmt
2 years ago
Angelo Fallaria
f272fcfc64
feat: add more modifiers
...
Modifiers added: Escape, BackSpace, Return, Tab, Minus, Equal, Grave
2 years ago
Angelo Fallaria
b06323540e
test: add tests for more keysyms
2 years ago
Angelo Fallaria
252e09a5d2
refactor: use 'map' instead of iteration for modifiers
2 years ago
Angelo Fallaria
5e2b74d923
feat: add detection of modifier keys
2 years ago
Angelo Fallaria
981d4c0387
refactor: reduce one line of indent in parsing
...
Checking if the current line is a command can be refactored
into a guard clause.
2 years ago
Angelo Fallaria
ff635cc3d9
refactor: remove unused 'keysyms' var in parse_contents
2 years ago
Angelo Fallaria
5aa87b60cc
test: add tests for invalid configs
2 years ago
Angelo Fallaria
b5ba778072
feat: add modifiers field to Hotkey
2 years ago
Angelo Fallaria
7a34a1e664
test: add #[test] to #[ignore] tests
2 years ago
Angelo Fallaria
1953fe269e
test: refactor valid config tests into a wrapper
2 years ago
Angelo Fallaria
920458cdf7
style: put the error checks next to each other
2 years ago