Merge pull request #3177 from daboe01/menushortcut-textviewfix

fixed: keystrokes from menu shortcuts are inserted into textviews
This commit is contained in:
daboe01 authored and GitHub committed 2026-01-30 22:41:47 +01:00
commit 4af8fcc008
2 files changed
+9 -6

No files matched your search

+1
View File
@@ -1075,6 +1075,7 @@ var _CPMenuBarVisible = NO,
if (self === [CPApp mainMenu])
[self _flashItemAtIndex:index];
anEvent._isKeyEquivalent = YES; // prevent the menu keystroke from beeing inserted into textview
[self performActionForItemAtIndex:index];
}
else
+8 -6
View File
@@ -1867,7 +1867,7 @@ Sets the selection to a range of characters in response to user action.
}
else
{
[_typingAttributes setObject:[sender selectedFont] forKey:CPFontAttributeName];
[_typingAttributes setObject:[sender convertFont:oldFont] forKey:CPFontAttributeName];
}
}
else
@@ -2754,12 +2754,14 @@ var _CPCopyPlaceholder = '-';
var currentFirstResponder = [[CPApp keyWindow] firstResponder];
if (currentFirstResponder && [currentFirstResponder respondsToSelector:@selector(insertText:)])
// setTimeout to prevent flickering
setTimeout(function(){
[currentFirstResponder insertText:textToInsert]
}, 20);
var event = [CPApp currentEvent];
// CRUCIAL: Clear the field immediately after grabbing its content.
if (!event._isKeyEquivalent)
setTimeout(function(){
[currentFirstResponder insertText:textToInsert]
}, 20);
// Clear the field immediately after grabbing its content.
_CPNativeInputField.innerHTML = '';
};