Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 14 additions & 19 deletions openless-all/app/src-tauri/src/coordinator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1905,7 +1905,7 @@ fn spawn_qa_recorder_error_monitor(inner: &Arc<Inner>, rx: mpsc::Receiver<Record
.ok();
}

#[cfg(target_os = "windows")]
#[cfg(all(target_os = "windows", test))]
fn store_prepared_windows_ime_session(
slots: &mut Vec<PreparedWindowsImeSessionSlot>,
session_id: SessionId,
Expand Down Expand Up @@ -1972,20 +1972,21 @@ async fn insert_with_windows_ime_first(
paste_shortcut: PasteShortcut,
ime_target: Option<ImeSubmitTarget>,
) -> InsertStatus {
if allow_non_tsf_insertion_fallback {
log::info!("[windows-ime] non-TSF insertion enabled; skipping TSF activation");
return insert_via_non_tsf_fallback(inner, polished, restore_clipboard, paste_shortcut);
}

let prepared = {
let mut slot = inner.prepared_windows_ime_session.lock();
take_matching_prepared_windows_ime_session(&mut slot, session_id)
};
let Some(prepared) = prepared else {
log::warn!("[windows-ime] no prepared TSF session for this dictation");
if should_try_non_tsf_insertion_fallback(
allow_non_tsf_insertion_fallback,
InsertStatus::Failed,
) {
return insert_via_non_tsf_fallback(inner, polished, restore_clipboard, paste_shortcut);
let prepared = match prepared {
Some(prepared) => prepared,
None => {
log::info!("[windows-ime] preparing TSF session for required TSF insert");
inner.windows_ime.prepare_session()
}
log::warn!("[windows-ime] non-TSF insertion fallback is disabled; failing insert");
return InsertStatus::Failed;
};

let request = crate::windows_ime_ipc::ImeSubmitRequest {
Expand Down Expand Up @@ -2036,19 +2037,13 @@ fn insert_via_non_tsf_fallback(

match status {
InsertStatus::Inserted => {
log::warn!(
"[windows-ime] TSF unavailable; inserted via paced Unicode SendInput fallback"
);
log::info!("[windows-ime] inserted via paced Unicode SendInput");
}
InsertStatus::CopiedFallback => {
log::warn!(
"[windows-ime] TSF unavailable; Unicode SendInput failed, left text on clipboard"
);
log::warn!("[windows-ime] Unicode SendInput failed, left text on clipboard");
}
InsertStatus::PasteSent | InsertStatus::Failed => {
log::warn!(
"[windows-ime] TSF unavailable; Unicode SendInput fallback failed and copy fallback failed"
);
log::warn!("[windows-ime] Unicode SendInput failed and copy fallback failed");
}
}

Expand Down
6 changes: 0 additions & 6 deletions openless-all/app/src-tauri/src/coordinator/dictation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -535,12 +535,6 @@ pub(super) async fn begin_session(inner: &Arc<Inner>) -> Result<(), String> {
}
session_id
};
#[cfg(target_os = "windows")]
{
let prepared = inner.windows_ime.prepare_session();
let mut slots = inner.prepared_windows_ime_session.lock();
store_prepared_windows_ime_session(&mut slots, current_session_id, prepared);
}
// 翻译模式标志重置;hotkey 监听器在 Shift down 时再 set true。
inner
.translation_modifier_seen
Expand Down