Re: NSTextInput protocol - 'unmarkText' is late?
Re: NSTextInput protocol - 'unmarkText' is late?
- Subject: Re: NSTextInput protocol - 'unmarkText' is late?
- From: Aki Inoue <email@hidden>
- Date: Mon, 22 Aug 2005 11:06:08 -0700
Jonathan,
The marked range should be treated as if it is a selection.
So, whenever you receive -insertText:, you need to replace the range
and clear the marking state.
(user presses Alt-e)
[setMarkedText] - has an apostrophe mark
(user presses e)
[insertText] - with é as the text
Unmarking is implied here, and you need to reset your internal flag.
Aki
On 12 Aug 2005, at 02:57, Jonathan del Strother wrote:
On 12 Aug 2005, at 02:41, Jonathan del Strother wrote:
I'm implementing my own text input control, and having some
issues with marked text...
If I insert some marked text, I don't get informed of the next
keypress. Only after a second keypress do I get the 'unmarkText'
call, and then I receive key events as normal.
Say I want to insert an accented 'e', then t. The sequence of
events is as follows (user input appears in brackets, NSTextInput
functions being called are in square brackets)
(user presses Alt-e)
[setMarkedText] - has an apostrophe mark
(user presses e)
[insertText] - with é as the text
(user presses t)
[hasMarkedText] - since I haven't yet received 'unmarkText', I
return YES. Nothing else happens
(user presses t again)
[hasMarkedText]
[unmarkText] - finally!
[insertText] - with t as the text.
Did that make sense? Basically, I think I should be receiving
unmarkText as soon as the 'é' character is complete, whereas I'm
receiving it 1 keypress too late, regardless whether that
keypress is a letter, a delete key, whatever.
Am I returning the correct value for hasMarkedText? I'm
currently storing a 'hasMark' boolean, which I'm setting to YES
when I receive setMarkedText, and NO on unmarkText. Am I
supposed to clear it whenever I receive an insertText event?
I forgot to mention - if I always return NO from hasMarkedText,
the text control works perfectly. However, I'm a little wary of
'fixing' it this way, and was hoping for an answer on the proper
way of doing things.
No ideas, anyone? _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden