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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user