patches: fix Corfu completion tracking in Zoom
Fget_char_property with a buffer as OBJECT checks text properties only. Corfu highlights the selected candidate (corfu-current) via an overlay, not a text property, so the scan always returned -1 and Zoom focus stayed on the first line. Pass cf->selected_window instead of cw->contents so that overlays are included in the property lookup. Vertico uses text properties and is unaffected; child-frame completion frameworks that use overlays (Corfu, Company-box) now track correctly.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
From d494967af08ec3e5bb94ff50126c2994505a6d85 Mon Sep 17 00:00:00 2001
|
||||
From 380124ba2243d4a587cb748aa6e88c0384400154 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 | 339 +++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 356 insertions(+)
|
||||
src/nsterm.m | 345 +++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 362 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..6527750 100644
|
||||
index 74e4ad5..f9ec72d 100644
|
||||
--- a/src/nsterm.m
|
||||
+++ b/src/nsterm.m
|
||||
@@ -1081,6 +1081,271 @@ static NSRect constrain_frame_rect(NSRect frameRect, bool isFullscreen)
|
||||
@@ -1081,6 +1081,277 @@ static NSRect constrain_frame_rect(NSRect frameRect, bool isFullscreen)
|
||||
}
|
||||
|
||||
|
||||
@@ -228,6 +228,12 @@ index 74e4ad5..6527750 100644
|
||||
+ ptrdiff_t zv = BUF_ZV (b);
|
||||
+ int line = 0;
|
||||
+
|
||||
+ /* Pass the window (not the buffer) to Fget_char_property so
|
||||
+ that overlay face properties are checked in addition to text
|
||||
+ properties. Corfu highlights the selected candidate with an
|
||||
+ overlay face (corfu-current); text-property-only lookup misses
|
||||
+ it. Vertico uses text properties, so either form works there,
|
||||
+ but passing the window is strictly correct for both. */
|
||||
+ specpdl_ref count = SPECPDL_INDEX ();
|
||||
+ record_unwind_current_buffer ();
|
||||
+ set_buffer_internal_1 (b);
|
||||
@@ -237,7 +243,7 @@ index 74e4ad5..6527750 100644
|
||||
+ {
|
||||
+ Lisp_Object face
|
||||
+ = Fget_char_property (make_fixnum (pos), Qface,
|
||||
+ cw->contents);
|
||||
+ cf->selected_window);
|
||||
+ if (ns_zoom_face_is_selected (face))
|
||||
+ {
|
||||
+ unbind_to (count, Qnil);
|
||||
@@ -356,7 +362,7 @@ index 74e4ad5..6527750 100644
|
||||
static void
|
||||
ns_update_end (struct frame *f)
|
||||
/* --------------------------------------------------------------------------
|
||||
@@ -1104,6 +1369,41 @@ static NSRect constrain_frame_rect(NSRect frameRect, bool isFullscreen)
|
||||
@@ -1104,6 +1375,41 @@ static NSRect constrain_frame_rect(NSRect frameRect, bool isFullscreen)
|
||||
|
||||
unblock_input ();
|
||||
ns_updating_frame = NULL;
|
||||
@@ -398,7 +404,7 @@ index 74e4ad5..6527750 100644
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -3232,6 +3532,45 @@ Note that CURSOR_WIDTH is meaningful only for (h)bar cursors.
|
||||
@@ -3232,6 +3538,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