editeng/source/editeng/impedit5.cxx |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

New commits:
commit b91dc86a9cff565a009cf8ed003b6c0a65f8da2e
Author:     Patrick Luby <[email protected]>
AuthorDate: Fri Sep 19 11:05:35 2025 -0400
Commit:     Michael Weghorn <[email protected]>
CommitDate: Mon Sep 29 16:37:20 2025 +0200

    tdf#168375 return false if both KEY_MOD1 and KEY_MOD2 are pressed
    
    Previously ImpEditEngine::IsSimpleCharInput() returned false only
    if one of these modifiers is pressed. At least on macOS, pressing
    Command-Option with a character is not a simple character so return
    false if both modifiers are pressed.
    
    Change-Id: I7698a1ec3178b83c0a1d4e161915246cac08f0ee
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191205
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>
    (cherry picked from commit ed45cdaef3d2807d0b9d6a4c08da375fc72024a6)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191210
    Reviewed-by: Michael Weghorn <[email protected]>
    Reviewed-by: Adolfo Jayme Barrientos <[email protected]>
    Tested-by: Michael Weghorn <[email protected]>
    Reviewed-by: Ilmari Lauhakangas <[email protected]>
    Reviewed-by: Patrick Luby <[email protected]>

diff --git a/editeng/source/editeng/impedit5.cxx 
b/editeng/source/editeng/impedit5.cxx
index 5a356281ac76..b82e361038c5 100644
--- a/editeng/source/editeng/impedit5.cxx
+++ b/editeng/source/editeng/impedit5.cxx
@@ -1338,9 +1338,14 @@ bool ImpEditEngine::PostKeyEvent( const KeyEvent& 
rKeyEvent, EditView* pEditView
 
 bool ImpEditEngine::IsSimpleCharInput( const KeyEvent& rKeyEvent )
 {
-    return EditEngine::IsPrintable( rKeyEvent.GetCharCode() ) &&
-        ( KEY_MOD2 != (rKeyEvent.GetKeyCode().GetModifier() & ~KEY_SHIFT ) ) &&
-        ( KEY_MOD1 != (rKeyEvent.GetKeyCode().GetModifier() & ~KEY_SHIFT ) );
+    // tdf#168375 return false if both KEY_MOD1 and KEY_MOD2 are pressed
+    // Previously this function returned false only if one of these
+    // modifiers is pressed. At least on macOS, pressing Command-Option
+    // with a character is not a simple character so return false if
+    // both modifiers are pressed.
+    sal_uInt16 nNonShiftModifiers = rKeyEvent.GetKeyCode().GetModifier() & 
~KEY_SHIFT;
+    nNonShiftModifiers &= ( KEY_MOD1 | KEY_MOD2 );
+    return !nNonShiftModifiers && EditEngine::IsPrintable( 
rKeyEvent.GetCharCode() );
 }
 
 void ImpEditEngine::SetControlWord( EEControlBits nWord )

Reply via email to