Re: NSTextInput problems (Solved)
Re: NSTextInput problems (Solved)
- Subject: Re: NSTextInput problems (Solved)
- From: Eyal Redler <email@hidden>
- Date: Tue, 28 May 2002 19:47:31 +0200
Hi,
I've got it working now. Thanks a lot!
Eyal
On Tuesday, May 28, 2002, at 03:58 AM, Aki Inoue wrote:
3. I type option-e (US-keyboard) ; setMarkedText is being called with (1,
0)
as selRange.
Even after knowing the selelction range is relative to the marked range,
it doesn't make sense. My marked text is still (NSNotFound,0)?!
OK. It is your responsibility to keep track of the marked range based on
the current insertion point.
For example, the initial state of the marked text is (NSNotFound, 0)
representing the non-existence of marked range.
When your setMarkedText:selectedRange: is called, you insert the text
into the document and mark them as the marked text by updating the marked
range. If the current insertion point is, say, at the index 10, and hit
option-e, insert the argument string with the accent character in it into
your document, then, update your marked range to (10, 1). The selected
range passed in is (1, 0) so your selected range is (11, 0). Then, if
you hit 'e', you get -insertText: with 'i' as the argument. You replace
your marked range, (10, 1), with the new string. At this point, you
should clear out your marked range to (NSNotFound, 0), and the selected
range to (11, 0).
Aki
On 2002.05.27, at 17:43, Eyal Redler wrote:
Hi Aki,
First of all, thanks. I was Googling the net for days about this! Found
a lot of Japanese pages. But I can't read them...
Now, the selected range argument in the -setMarkedText:selectedRange:
method is the selection inside the marked text. Since the content of
the marked range is basically owned by the input manager, the cursor
movement including the selection is the input manager's responsibility.
The index in the argument is, thus, relative to the beginning of the
marked range, not from the document beginning. I assume you've been
testing your code with dead keys for Roman accented characters. In
that case, the length of the marked range is almost always 1, and, the
cursor position is always at the index 1. With more complex languages
like Japanese, Chinese, or Korean, the marked text can be a whole
sentence. In that case, the selected range can move inside the marked
text.
What I'm missing here is how the marked text is initially set-up.
I tried this sequance
1. At first, the marked text is (NSFontFound,0)
2. I type a few characters. (insertText is called) the marked text is
not changed (there is none)
Now:
3. I type option-e (US-keyboard) ; setMarkedText is being called with (1,
0)
as selRange.
Even after knowing the selelction range is relative to the marked range,
it doesn't make sense. My marked text is still (NSNotFound,0)?!
Could you specify what should be done with the these elements in
insertText and setMarkedText?
The elements being:
1.Selection range
2. Text model
3. Marked Text range
Thanks,
Eyal
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.