patches: fix singleLineMove compile error - out-of-scope variables

oldLine and newLine were declared inside 'if (cachedText && oldPoint > 0)'
block but singleLineMove block referenced them from outside that scope.

Fix: declare singleLineMove = NO before the granularity detection block;
compute adjFwd/adjBwd inside the 'if (oldLine.location != newLine.location)'
branch where both variables are in scope.
This commit is contained in:
2026-03-02 21:13:20 +01:00
parent d6fc21f975
commit ce34c44c2f
9 changed files with 47 additions and 36 deletions

View File

@@ -1,4 +1,4 @@
From 95f998ecdda8342da491c57cd62c610cd3c15a3e Mon Sep 17 00:00:00 2001
From 0ef896396709b9b0a832d07476dfc7ded2eca9fc Mon Sep 17 00:00:00 2001
From: Martin Sukany <martin@sukany.cz>
Date: Sat, 28 Feb 2026 22:39:35 +0100
Subject: [PATCH 0/8] ns: integrate with macOS Zoom for cursor tracking

View File

@@ -1,4 +1,4 @@
From 1465c5f3ad2ddec5a89329de34d871207626b078 Mon Sep 17 00:00:00 2001
From 195c2d4ccc1d607984468fa7f9a8e41005463f04 Mon Sep 17 00:00:00 2001
From: Martin Sukany <martin@sukany.cz>
Date: Sat, 28 Feb 2026 12:58:11 +0100
Subject: [PATCH 1/8] ns: add accessibility base classes and text extraction

View File

@@ -1,4 +1,4 @@
From d8fb143c071a55e9463282b8017643a3b1159dde Mon Sep 17 00:00:00 2001
From 96ab29ec0bd830c6ba81632c8ccfedb4fdec85d2 Mon Sep 17 00:00:00 2001
From: Martin Sukany <martin@sukany.cz>
Date: Sat, 28 Feb 2026 12:58:11 +0100
Subject: [PATCH 2/8] ns: implement buffer accessibility element (core

View File

@@ -1,4 +1,4 @@
From a4f0ba874e18fc5b59ab92f38122461223e916f6 Mon Sep 17 00:00:00 2001
From 23f2a62922e7fe9a4075b5e2074bde292434f882 Mon Sep 17 00:00:00 2001
From: Martin Sukany <martin@sukany.cz>
Date: Sat, 28 Feb 2026 12:58:11 +0100
Subject: [PATCH 3/8] ns: add buffer notification dispatch and mode-line

View File

@@ -1,4 +1,4 @@
From de1a3e8c2cbc4e90d3d9f24378fa00716e1ee175 Mon Sep 17 00:00:00 2001
From 04edba6e94622176c9869ba2564cd4fda4d2edd8 Mon Sep 17 00:00:00 2001
From: Martin Sukany <martin@sukany.cz>
Date: Sat, 28 Feb 2026 12:58:11 +0100
Subject: [PATCH 4/8] ns: add interactive span elements for Tab navigation

View File

@@ -1,4 +1,4 @@
From da937d7af5f787c2bf594457ec494a838bd64afc Mon Sep 17 00:00:00 2001
From c3afdca23634547cb961efd8368e09393ade2690 Mon Sep 17 00:00:00 2001
From: Martin Sukany <martin@sukany.cz>
Date: Sat, 28 Feb 2026 12:58:11 +0100
Subject: [PATCH 5/8] ns: integrate accessibility with EmacsView and redisplay

View File

@@ -1,4 +1,4 @@
From 4f7f340b5e3e2068b9d20e9fe81f6d0cc20a1340 Mon Sep 17 00:00:00 2001
From 312ef33147100f5486aa42b70d44ee9e143fd6ce Mon Sep 17 00:00:00 2001
From: Martin Sukany <martin@sukany.cz>
Date: Sat, 28 Feb 2026 12:58:11 +0100
Subject: [PATCH 6/8] doc: add VoiceOver accessibility section to macOS

View File

@@ -1,4 +1,4 @@
From b90379446166af5f851f6994aff68e242b8d2dca Mon Sep 17 00:00:00 2001
From a264f3ec7acb0f736e79bd692bd79c11b0f16c2e Mon Sep 17 00:00:00 2001
From: Daneel <daneel@sukany.cz>
Date: Mon, 2 Mar 2026 18:39:46 +0100
Subject: [PATCH 7/8] ns: announce overlay completion candidates for VoiceOver

View File

@@ -1,4 +1,4 @@
From 614cc39167cfb89a0ee7731b6b8c012ff838f8dc Mon Sep 17 00:00:00 2001
From 089ff332d52b9595e774b654a9259c65450cdaa2 Mon Sep 17 00:00:00 2001
From: Daneel <daneel@sukany.cz>
Date: Mon, 2 Mar 2026 18:49:13 +0100
Subject: [PATCH 8/8] ns: announce child frame completion candidates for
@@ -33,8 +33,8 @@ area announcements.
doc/emacs/macos.texi | 14 +-
etc/NEWS | 18 +-
src/nsterm.h | 20 ++
src/nsterm.m | 496 ++++++++++++++++++++++++++++++++++++++-----
4 files changed, 479 insertions(+), 69 deletions(-)
src/nsterm.m | 493 ++++++++++++++++++++++++++++++++++++++-----
4 files changed, 475 insertions(+), 70 deletions(-)
diff --git a/doc/emacs/macos.texi b/doc/emacs/macos.texi
index 8d4a7825d8..03a657f970 100644
@@ -149,7 +149,7 @@ index 21a93bc799..bdd40b8eb7 100644
@end
diff --git a/src/nsterm.m b/src/nsterm.m
index 8f744d1bf3..3533eca3bc 100644
index 8f744d1bf3..20a50281db 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1126,24 +1126,19 @@ Uses CFAbsoluteTimeGetCurrent() (~5 ns, a VDSO read) for timing. */
@@ -480,7 +480,35 @@ index 8f744d1bf3..3533eca3bc 100644
NSInteger direction = ns_ax_text_selection_direction_discontiguous;
if (point > oldPoint)
direction = ns_ax_text_selection_direction_next;
@@ -9548,34 +9708,40 @@ frameworks like Vertico bump BOTH BUF_MODIFF (via text property
@@ -9512,6 +9672,7 @@ frameworks like Vertico bump BOTH BUF_MODIFF (via text property
/* --- Granularity detection --- */
NSInteger granularity = ns_ax_text_selection_granularity_unknown;
+ BOOL singleLineMove = NO;
[self ensureTextCache];
if (cachedText && oldPoint > 0)
{
@@ -9526,7 +9687,18 @@ frameworks like Vertico bump BOTH BUF_MODIFF (via text property
NSRange newLine = [cachedText lineRangeForRange:
NSMakeRange (newIdx, 0)];
if (oldLine.location != newLine.location)
- granularity = ns_ax_text_selection_granularity_line;
+ {
+ granularity = ns_ax_text_selection_granularity_line;
+ /* Detect single adjacent-line move while oldLine/newLine
+ are in scope. Any command that steps exactly one line ---
+ C-n/C-p, evil j/k, outline-next-heading, etc. --- is
+ sequential. Multi-line teleports (]], M-<, xref, ...) are
+ not adjacent and will be marked discontiguous below.
+ Detected structurally: no package-specific code needed. */
+ BOOL adjFwd = (newLine.location == NSMaxRange (oldLine));
+ BOOL adjBwd = (NSMaxRange (newLine) == oldLine.location);
+ singleLineMove = adjFwd || adjBwd;
+ }
else
{
NSUInteger dist = (newIdx > oldIdx
@@ -9548,34 +9720,23 @@ frameworks like Vertico bump BOTH BUF_MODIFF (via text property
granularity = ns_ax_text_selection_granularity_line;
}
@@ -492,23 +520,6 @@ index 8f744d1bf3..3533eca3bc 100644
- accessibilitySelectedTextRange rather than advancing linearly
- from its previous internal position. */
- if (!isCtrlNP && granularity == ns_ax_text_selection_granularity_line)
+ /* Detect whether this is a single adjacent-line move.
+ Any command that steps exactly one line forward or backward
+ --- including C-n/C-p, evil j/k, outline-next-heading, etc. ---
+ is treated as sequential so VoiceOver reads the full destination
+ line. Multi-line teleports (]], M-<, xref, imenu, isearch, ...) are
+ discontiguous so VoiceOver re-anchors its browse cursor.
+ Adjacency is detected structurally (NSString line ranges), not
+ by command name, so no package-specific code is needed. */
+ BOOL singleLineMove = NO;
+ if (!isCtrlNP
+ && granularity == ns_ax_text_selection_granularity_line
+ && cachedText)
+ {
+ BOOL adjFwd = (newLine.location == NSMaxRange (oldLine));
+ BOOL adjBwd = (NSMaxRange (newLine) == oldLine.location);
+ singleLineMove = adjFwd || adjBwd;
+ }
+
+ /* Multi-line teleports are discontiguous; single adjacent-line
+ steps stay sequential. */
@@ -545,7 +556,7 @@ index 8f744d1bf3..3533eca3bc 100644
{
NSWindow *win = [self.emacsView window];
if (win)
@@ -9734,6 +9900,13 @@ - (NSRect)accessibilityFrame
@@ -9734,6 +9895,13 @@ - (NSRect)accessibilityFrame
if (vis_start >= vis_end)
return @[];
@@ -559,7 +570,7 @@ index 8f744d1bf3..3533eca3bc 100644
block_input ();
specpdl_ref blk_count = SPECPDL_INDEX ();
record_unwind_protect_void (unblock_input);
@@ -9858,6 +10031,7 @@ than O(chars). Fall back to pos+1 as safety net. */
@@ -9858,6 +10026,7 @@ than O(chars). Fall back to pos+1 as safety net. */
pos = span_end;
}
@@ -567,7 +578,7 @@ index 8f744d1bf3..3533eca3bc 100644
return [[spans copy] autorelease];
}
@@ -10039,6 +10213,10 @@ - (void)dealloc
@@ -10039,6 +10208,10 @@ - (void)dealloc
#endif
[accessibilityElements release];
@@ -578,7 +589,7 @@ index 8f744d1bf3..3533eca3bc 100644
[[self menu] release];
[super dealloc];
}
@@ -11488,6 +11666,9 @@ - (instancetype) initFrameFromEmacs: (struct frame *)f
@@ -11488,6 +11661,9 @@ - (instancetype) initFrameFromEmacs: (struct frame *)f
windowClosing = NO;
processingCompose = NO;
@@ -588,7 +599,7 @@ index 8f744d1bf3..3533eca3bc 100644
scrollbarsNeedingUpdate = 0;
fs_state = FULLSCREEN_NONE;
fs_before_fs = next_maximized = -1;
@@ -12796,6 +12977,154 @@ - (id)accessibilityFocusedUIElement
@@ -12796,6 +12972,154 @@ - (id)accessibilityFocusedUIElement
The existing elements carry cached state (modiff, point) from the
previous redisplay cycle. Rebuilding first would create fresh
elements with current values, making change detection impossible. */
@@ -743,7 +754,7 @@ index 8f744d1bf3..3533eca3bc 100644
- (void)postAccessibilityUpdates
{
NSTRACE ("[EmacsView postAccessibilityUpdates]");
@@ -12806,11 +13135,64 @@ - (void)postAccessibilityUpdates
@@ -12806,11 +13130,64 @@ - (void)postAccessibilityUpdates
/* Re-entrance guard: VoiceOver callbacks during notification posting
can trigger redisplay, which calls ns_update_end, which calls us