Thanks. I want implement autocomplete for textview. So I need know where to display the window with autocomplete suggestions. I'm adding the code in NSTextView.m, not in NSTextView_actions.m. I think this is the correct place, right?
I will submit a patch for review when ready. Regards. On 2013-05-25 06:40:40 -0600 Fred Kiefer <[email protected]> wrote: > On 25.05.2013 09:16, Germán Arias wrote: >> Is there a way to know the localization (x, y) of the I-beam in a textview? > > Internally we use _insertionPointRect but this isn't accessible from outside > the NSTextView. The best you can do is to duplicate the code in the method > -updateInsertionPointStateAndRestartTimer: to compute that rectangle > yourself. I think this is the important code snipplet: > > > new = [_layoutManager > insertionPointRectForCharacterIndex: > _layoutManager->_selected_range.location > inTextContainer: _textContainer]; > > new.origin.x += _textContainerOrigin.x; > new.origin.y += _textContainerOrigin.y; > > /* If the insertion would extend outside the view (e.g. because it's > just to the right of a character on the far right edge of the view, > a common case for right-aligned text), we force it back in. */ > if (NSMaxX(new) > NSMaxX(_bounds)) > { > new.origin.x = NSMaxX(_bounds) - new.size.width; > } > > All the instance variables used here are available from the outside as well. > > Hope this helps > Fred > > > _______________________________________________ > Gnustep-dev mailing list > [email protected] > https://lists.gnu.org/mailman/listinfo/gnustep-dev > > _______________________________________________ Gnustep-dev mailing list [email protected] https://lists.gnu.org/mailman/listinfo/gnustep-dev
