vcl/osx/salframeview.mm |   14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

New commits:
commit 0f6d14dbe7f0f5a50a28ea8b796a8a97de756487
Author:     Patrick Luby <[email protected]>
AuthorDate: Mon Oct 6 19:28:50 2025 -0400
Commit:     Patrick Luby <[email protected]>
CommitDate: Tue Oct 7 14:15:56 2025 +0200

    tdf#168711 Ignore marked text in -[SalFrameView selectedRange]
    
    While -[SalFrameView attributedSubstringForProposedRange:actualRange:]
    looks at marked text, -[SalFrameView selectedRange] should only return
    selected text.
    
    Change-Id: I8145f6d186cb4d17a50c545929bde3023caddd62
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191989
    Reviewed-by: Patrick Luby <[email protected]>
    Tested-by: Jenkins

diff --git a/vcl/osx/salframeview.mm b/vcl/osx/salframeview.mm
index e927975338e2..c761e646536c 100644
--- a/vcl/osx/salframeview.mm
+++ b/vcl/osx/salframeview.mm
@@ -2396,13 +2396,11 @@ static NSString* getCurrentSelection()
     // When a Japanese keyboard is selected, the keyboard's "Reverse 
Conversion"
     // menu item would silently fail when an empty range was returned by
     // -[SalFrameView selectedRange].
-    // So return a valid range in that call using the following steps:
-    // 1. If there is marked text, return the marked text range
-    // 2. If LibreOffice is selected text, return the selected text length
-    // Similar steps in the same order are in
-    // -[SalFrameView attributedSubstringForProposedRange:actualRange:].
-    if ( [self hasMarkedText] )
-        return ( mMarkedRange.location == NSNotFound ? NSMakeRange( 0, 0 ) : 
mMarkedRange );
+    // So if LibreOffice has selected text, return the selected text length.
+    // tdf#168711 Ignore marked text in -[SalFrameView selectedRange]
+    // While -[SalFrameView attributedSubstringForProposedRange:actualRange:]
+    // looks at marked text, -[SalFrameView selectedRange] should only return
+    // selected text.
     NSString *pSelectedText = getCurrentSelection();
     if ( pSelectedText )
         return NSMakeRange( 0, [pSelectedText length] );
@@ -2551,7 +2549,7 @@ static NSString* getCurrentSelection()
     // -[SalFrameView attributedSubstringForProposedRange:actualRange:].
     // So return a valid string in that call using the following steps:
     // 1. If there is marked text, return the last marked text
-    // 2. If LibreOffice is selected text, return the selected text
+    // 2. If LibreOffice has selected text, return the selected text
     // Similar steps in the same order are in -[SalFrameView selectedRange].
     if ( [self hasMarkedText] )
     {

Reply via email to