patches: reduce completion tracking rate-limit from 500ms to 50ms
500ms (2 Hz) was too aggressive — Zoom focus stopped updating during keyboard navigation in Vertico/Corfu lists. 50ms (20 Hz) tracks fast arrow-key navigation while still avoiding per-frame overhead. UAZoomEnabled() is already cached so the main cost is the overlay scan, which is cheap.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
From 82465943223138dfa1185467400e547c59e6e1be Mon Sep 17 00:00:00 2001
|
||||
From 38bbd275736251862f4b2fb433ee0a84799f0cec Mon Sep 17 00:00:00 2001
|
||||
From: Martin Sukany <martin@sukany.cz>
|
||||
Date: Sat, 28 Feb 2026 22:39:35 +0100
|
||||
Subject: [PATCH 1/9] ns: integrate with macOS Zoom for cursor tracking
|
||||
@@ -38,8 +38,8 @@ window splits, switches (C-x o), and completion frameworks.
|
||||
---
|
||||
etc/NEWS | 11 ++
|
||||
src/nsterm.h | 6 +
|
||||
src/nsterm.m | 338 +++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 355 insertions(+)
|
||||
src/nsterm.m | 339 +++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 356 insertions(+)
|
||||
|
||||
diff --git a/etc/NEWS b/etc/NEWS
|
||||
index ef36df5..80661a9 100644
|
||||
@@ -81,10 +81,10 @@ index 7c1ee4c..ea6e7ba 100644
|
||||
}
|
||||
|
||||
diff --git a/src/nsterm.m b/src/nsterm.m
|
||||
index 74e4ad5..d624a76 100644
|
||||
index 74e4ad5..6527750 100644
|
||||
--- a/src/nsterm.m
|
||||
+++ b/src/nsterm.m
|
||||
@@ -1081,6 +1081,270 @@ static NSRect constrain_frame_rect(NSRect frameRect, bool isFullscreen)
|
||||
@@ -1081,6 +1081,271 @@ static NSRect constrain_frame_rect(NSRect frameRect, bool isFullscreen)
|
||||
}
|
||||
|
||||
|
||||
@@ -269,13 +269,14 @@ index 74e4ad5..d624a76 100644
|
||||
+ if (!WINDOWP (f->selected_window))
|
||||
+ return;
|
||||
+
|
||||
+ /* Rate-limit completion scan to 2 Hz. Completion state changes at
|
||||
+ human interaction speed; checking every 500 ms eliminates
|
||||
+ per-redisplay FOR_EACH_FRAME overhead with no perceptible lag. */
|
||||
+ /* Rate-limit completion scan to 20 Hz (50 ms). UAZoomEnabled() is
|
||||
+ now cached so the main cost is the overlay/child-frame scan.
|
||||
+ 50 ms is imperceptible for completion navigation while preventing
|
||||
+ per-frame FOR_EACH_FRAME overhead. */
|
||||
+ {
|
||||
+ static CFAbsoluteTime last_check;
|
||||
+ CFAbsoluteTime now = CFAbsoluteTimeGetCurrent ();
|
||||
+ if (now - last_check < 0.5)
|
||||
+ if (now - last_check < 0.05)
|
||||
+ return;
|
||||
+ last_check = now;
|
||||
+ }
|
||||
@@ -355,7 +356,7 @@ index 74e4ad5..d624a76 100644
|
||||
static void
|
||||
ns_update_end (struct frame *f)
|
||||
/* --------------------------------------------------------------------------
|
||||
@@ -1104,6 +1368,41 @@ static NSRect constrain_frame_rect(NSRect frameRect, bool isFullscreen)
|
||||
@@ -1104,6 +1369,41 @@ static NSRect constrain_frame_rect(NSRect frameRect, bool isFullscreen)
|
||||
|
||||
unblock_input ();
|
||||
ns_updating_frame = NULL;
|
||||
@@ -397,7 +398,7 @@ index 74e4ad5..d624a76 100644
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -3232,6 +3531,45 @@ Note that CURSOR_WIDTH is meaningful only for (h)bar cursors.
|
||||
@@ -3232,6 +3532,45 @@ Note that CURSOR_WIDTH is meaningful only for (h)bar cursors.
|
||||
/* Prevent the cursor from being drawn outside the text area. */
|
||||
r = NSIntersectionRect (r, ns_row_rect (w, glyph_row, TEXT_AREA));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user