vcl/osx/salframeview.mm | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
New commits: commit 811a901f6242e9dd7d01a050ad9cb793a555a0d4 Author: Patrick Luby <[email protected]> AuthorDate: Mon Oct 6 19:28:50 2025 -0400 Commit: Adolfo Jayme Barrientos <[email protected]> CommitDate: Tue Oct 7 15:15:45 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 (cherry picked from commit 0f6d14dbe7f0f5a50a28ea8b796a8a97de756487) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192041 Reviewed-by: Adolfo Jayme Barrientos <[email protected]> diff --git a/vcl/osx/salframeview.mm b/vcl/osx/salframeview.mm index c05bd28d5413..46d1671a1548 100644 --- a/vcl/osx/salframeview.mm +++ b/vcl/osx/salframeview.mm @@ -2398,13 +2398,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] ); @@ -2553,7 +2551,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] ) {
