From 8f8fd0f66ae149595608211382cc48381bfc85b4 Mon Sep 17 00:00:00 2001 From: Raphael Amorim Date: Thu, 30 Apr 2026 00:55:33 +0200 Subject: [PATCH] Revert "disable_autofill_heuristic_controller" This reverts commit 05e4ef0a31b00a9a78f7bc58e93084c7c6674de6. --- frontends/rioterm/src/main.rs | 3 --- frontends/rioterm/src/platform/macos/mod.rs | 29 +-------------------- 2 files changed, 1 insertion(+), 31 deletions(-) diff --git a/frontends/rioterm/src/main.rs b/frontends/rioterm/src/main.rs index 270e4b61..29665797 100644 --- a/frontends/rioterm/src/main.rs +++ b/frontends/rioterm/src/main.rs @@ -144,9 +144,6 @@ fn main() -> Result<(), Box> { AttachConsole(ATTACH_PARENT_PROCESS); } - #[cfg(target_os = "macos")] - platform::macos::disable_autofill_heuristic_controller(); - // Load command line options. let args = cli::Cli::parse(); diff --git a/frontends/rioterm/src/platform/macos/mod.rs b/frontends/rioterm/src/platform/macos/mod.rs index ffb2de44..f1acfee1 100644 --- a/frontends/rioterm/src/platform/macos/mod.rs +++ b/frontends/rioterm/src/platform/macos/mod.rs @@ -8,37 +8,10 @@ use std::{env, slice, str}; use libc::{setlocale, LC_ALL, LC_CTYPE}; use objc::runtime::{Class, Object}; -use objc::{class, msg_send, sel, sel_impl}; +use objc::{msg_send, sel, sel_impl}; use tracing::debug; const FALLBACK_LOCALE: &str = "UTF-8"; -// macOS 26 (Tahoe) installs a global NSAutoFillHeuristicController that -// hooks an NSEvent local monitor for every key/mouse/scroll event and runs -// a debounced callback through the text-input system. The chain interacts -// pathologically with custom NSTextInputClient implementations (which all -// terminals have for IME), making scrolling progressively laggier and -// freezing the window. SMS-code/credentials autofill makes no sense in a -// terminal anyway. Match Ghostty's PR #8625 by registering a default that -// disables the controller before AppKit reads it. Must run before NSApp -// initialization. Harmless on older macOS versions — the key is just -// unknown there. -pub fn disable_autofill_heuristic_controller() { - unsafe { - let key_cstr = CString::new("NSAutoFillHeuristicControllerEnabled").unwrap(); - let key: *mut Object = - msg_send![class!(NSString), stringWithUTF8String: key_cstr.as_ptr()]; - let value: *mut Object = msg_send![class!(NSNumber), numberWithBool: false]; - let dict: *mut Object = msg_send![ - class!(NSDictionary), - dictionaryWithObject: value - forKey: key - ]; - let user_defaults: *mut Object = - msg_send![class!(NSUserDefaults), standardUserDefaults]; - let _: () = msg_send![user_defaults, registerDefaults: dict]; - } -} - pub fn set_locale_environment() { let env_locale_c = CString::new("").unwrap(); let env_locale_ptr = unsafe { setlocale(LC_ALL, env_locale_c.as_ptr()) }; -- 2.51.2