mirror of
https://github.com/kdheepak/taskwarrior-tui.git
synced 2025-08-24 05:26:42 +02:00
refactor: Added forgotten line check
This commit is contained in:
parent
f1aabced6a
commit
0d967b0a45
1 changed files with 7 additions and 2 deletions
|
@ -1,7 +1,7 @@
|
||||||
use std::{collections::HashSet, error::Error, hash::Hash};
|
use std::{collections::HashSet, error::Error, hash::Hash};
|
||||||
|
|
||||||
use anyhow::{anyhow, Result};
|
use anyhow::{anyhow, Result};
|
||||||
use log::{debug, error, info, warn};
|
use log::{debug, error, info, trace, warn};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::event::KeyCode;
|
use crate::event::KeyCode;
|
||||||
|
@ -214,6 +214,10 @@ impl KeyConfig {
|
||||||
let config_variants = vec![config.to_owned(), config.replace('-', "_")];
|
let config_variants = vec![config.to_owned(), config.replace('-', "_")];
|
||||||
|
|
||||||
for config in &config_variants {
|
for config in &config_variants {
|
||||||
|
if !line.starts_with(config) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
let trimmed_line = line
|
let trimmed_line = line
|
||||||
.trim_start_matches(config)
|
.trim_start_matches(config)
|
||||||
.trim_start()
|
.trim_start()
|
||||||
|
@ -224,7 +228,7 @@ impl KeyConfig {
|
||||||
let chars: Vec<char> = trimmed_line.chars().collect();
|
let chars: Vec<char> = trimmed_line.chars().collect();
|
||||||
|
|
||||||
match chars.len() {
|
match chars.len() {
|
||||||
0 => debug!("Found no override key for {}", config),
|
0 => error!("Found no override key for {} in line {}, only the config prefix", config, line),
|
||||||
1 => {
|
1 => {
|
||||||
let key_char = chars.first();
|
let key_char = chars.first();
|
||||||
match key_char {
|
match key_char {
|
||||||
|
@ -242,6 +246,7 @@ impl KeyConfig {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
trace!("Could not find a key override for KeyConfig {}", config);
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue