fix: update test helper for flush-forward behavior, 67 tests pass
- Engine no longer includes flush char in Replace insert - Daemon forwards raw flush key after Replace injection - Test helper simulates this by adding Insert event after Replace
This commit is contained in:
parent
758eea45b3
commit
118b601d0e
1 changed files with 9 additions and 2 deletions
|
|
@ -6,16 +6,23 @@ mod tests {
|
||||||
let mut events = Vec::new();
|
let mut events = Vec::new();
|
||||||
for ch in input.chars() {
|
for ch in input.chars() {
|
||||||
if let Some(event) = engine.process_key(ch) {
|
if let Some(event) = engine.process_key(ch) {
|
||||||
|
let is_replace = matches!(&event, EngineEvent::Replace { .. });
|
||||||
|
let fl = is_flush_char(ch);
|
||||||
events.push(event);
|
events.push(event);
|
||||||
|
if is_replace && fl {
|
||||||
|
events.push(EngineEvent::Insert(ch.to_string()));
|
||||||
|
}
|
||||||
} else if engine.is_enabled() {
|
} else if engine.is_enabled() {
|
||||||
// Engine didn't produce an event — the daemon would forward the raw key.
|
|
||||||
// Track this as an Insert for display reconstruction.
|
|
||||||
events.push(EngineEvent::Insert(ch.to_string()));
|
events.push(EngineEvent::Insert(ch.to_string()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
events
|
events
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn is_flush_char(ch: char) -> bool {
|
||||||
|
matches!(ch, ' ' | '\t' | '.' | ',' | '!' | '?' | ';' | ':' | '\n')
|
||||||
|
}
|
||||||
|
|
||||||
fn get_display(events: &[EngineEvent]) -> String {
|
fn get_display(events: &[EngineEvent]) -> String {
|
||||||
let mut display = String::new();
|
let mut display = String::new();
|
||||||
for ev in events {
|
for ev in events {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue