style(core): expand some TODO comments
This commit is contained in:
parent
2f53752e97
commit
f07ff326b5
|
@ -39,8 +39,6 @@ impl <'a> TextInjector for EventInjectorAdapter<'a> {
|
|||
}
|
||||
|
||||
fn inject_text(&self, text: &str) -> anyhow::Result<()> {
|
||||
// TODO: wait for modifiers release
|
||||
|
||||
// Handle CRLF or LF line endings correctly
|
||||
let split_sequence = if text.contains("\r\n") {
|
||||
"\r\n"
|
||||
|
|
|
@ -33,8 +33,6 @@ impl<'a> KeyInjectorAdapter<'a> {
|
|||
|
||||
impl<'a> KeyInjector for KeyInjectorAdapter<'a> {
|
||||
fn inject_sequence(&self, keys: &[crate::engine::event::input::Key]) -> anyhow::Result<()> {
|
||||
// TODO: wait for modifiers release
|
||||
|
||||
let converted_keys: Vec<_> = keys.iter().map(convert_to_inject_key).collect();
|
||||
self.injector.send_keys(&converted_keys, Default::default()) // TODO: handle options
|
||||
}
|
||||
|
|
|
@ -26,7 +26,10 @@ use log::warn;
|
|||
|
||||
use crate::engine::process::ModifierStatusProvider;
|
||||
|
||||
// TODO: explain
|
||||
/// This duration represents the maximum length for which a pressed modifier
|
||||
/// event is considered valid. This is useful when the "release" event is
|
||||
/// lost for whatever reason, so that espanso becomes eventually consistent
|
||||
/// after a while.
|
||||
const MAXIMUM_MODIFIERS_PRESS_TIME_RECORD: Duration = Duration::from_secs(30);
|
||||
|
||||
#[derive(Debug, Hash, PartialEq, Eq)]
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
* along with espanso. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// TODO: explain why this is needed
|
||||
|
||||
use std::{
|
||||
time::{Duration, Instant},
|
||||
};
|
||||
|
@ -28,13 +26,18 @@ use log::{trace, warn};
|
|||
use super::super::Middleware;
|
||||
use crate::engine::event::{Event, EventType};
|
||||
|
||||
// TODO: pass through config
|
||||
/// Maximum time to wait for modifiers being released before
|
||||
/// giving up.
|
||||
const MODIFIER_DELAY_TIMEOUT: Duration = Duration::from_secs(3);
|
||||
|
||||
pub trait ModifierStatusProvider {
|
||||
fn is_any_modifier_pressed(&self) -> bool;
|
||||
}
|
||||
|
||||
/// This middleware is used to delay the injection of text until
|
||||
/// all modifiers have been released. This is needed as otherwise,
|
||||
/// injections might misbehave as pressed modifiers might alter
|
||||
/// the keys being injected.
|
||||
pub struct DelayForModifierReleaseMiddleware<'a> {
|
||||
provider: &'a dyn ModifierStatusProvider,
|
||||
}
|
||||
|
|
|
@ -201,7 +201,7 @@ fn main() {
|
|||
// .subcommand(install_subcommand)
|
||||
// .subcommand(uninstall_subcommand);
|
||||
|
||||
// TODO: explain that the start and restart commands are only meaningful
|
||||
// TODO: explain that the register and unregister commands are only meaningful
|
||||
// when using the system daemon manager on macOS and Linux
|
||||
|
||||
let matches = clap_instance.clone().get_matches();
|
||||
|
|
Loading…
Reference in New Issue
Block a user