mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-25 07:28:20 +00:00
MacOS: Let EmacsView implement NSTextInputClient
* src/nsterm.h (@interface EmacsView): Implement NSTextInputClient protocol. * src/nsterm.m: Implement required NSTextInputClient methods, forwarding to existing NSTextInput methods.
This commit is contained in:
parent
9f7c1ace9f
commit
ceb5a15222
@ -463,7 +463,7 @@ enum ns_return_frame_mode
|
||||
@class EmacsLayer;
|
||||
|
||||
#ifdef NS_IMPL_COCOA
|
||||
@interface EmacsView : NSView <NSTextInput, NSWindowDelegate>
|
||||
@interface EmacsView : NSView <NSTextInput, NSTextInputClient, NSWindowDelegate>
|
||||
#else
|
||||
@interface EmacsView : NSView <NSTextInput>
|
||||
#endif
|
||||
|
41
src/nsterm.m
41
src/nsterm.m
@ -7032,10 +7032,49 @@ In that case we use UCKeyTranslate (ns_get_shifted_character)
|
||||
[nsEvArray removeObject: theEvent];
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
NSTextInputClient
|
||||
***********************************************************************/
|
||||
|
||||
#ifdef NS_IMPL_COCOA
|
||||
|
||||
- (void) insertText: (id) string
|
||||
replacementRange: (NSRange) replacementRange
|
||||
{
|
||||
if ([string isKindOfClass:[NSAttributedString class]])
|
||||
string = [string string];
|
||||
[self unmarkText];
|
||||
[self insertText:string];
|
||||
}
|
||||
|
||||
- (void) setMarkedText: (id) string
|
||||
selectedRange: (NSRange) selectedRange
|
||||
replacementRange: (NSRange) replacementRange
|
||||
{
|
||||
[self setMarkedText: string selectedRange: selectedRange];
|
||||
}
|
||||
|
||||
- (nullable NSAttributedString *)
|
||||
attributedSubstringForProposedRange: (NSRange) range
|
||||
actualRange: (nullable NSRangePointer) actualRange
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSRect) firstRectForCharacterRange: (NSRange) range
|
||||
actualRange: (nullable NSRangePointer) actualRange
|
||||
{
|
||||
return NSZeroRect;
|
||||
}
|
||||
|
||||
#endif /* NS_IMPL_COCOA */
|
||||
|
||||
/***********************************************************************
|
||||
NSTextInput
|
||||
***********************************************************************/
|
||||
|
||||
/* <NSTextInput> implementation (called through [super interpretKeyEvents:]). */
|
||||
|
||||
|
||||
/* <NSTextInput>: called when done composing;
|
||||
NOTE: also called when we delete over working text, followed
|
||||
immediately by doCommandBySelector: deleteBackward: */
|
||||
|
Loading…
Reference in New Issue
Block a user