Retrieve the insert position in a text

Post here questions and problems related to oXygen frameworks/document types.
Isabelle
Posts: 168
Joined: Fri Jan 20, 2017 1:11 pm

Retrieve the insert position in a text

Post by Isabelle »

Hello everyone,

I am using the Oxygen SDK 21.1.0.2 and I wondered if it is possible to retrieve the exact insert position in a text.

Currently I have overridden the method

Code: Select all

insertText
in our own

Code: Select all

DocumentFilter
class.
But I only manage to use the offset attribut to get the current node.
And I don't manage to retrieve the exacte position of the insert in the text of this node.
I tried to use the method

Code: Select all

getFilteredText
from

Code: Select all

AuthorDocumentController
with

Code: Select all

offset -1 and offset
as parameters but without success.

Is it possible to retrieve this position ?
I need it to automatically detect specific abbreviations when users writes in a document.

Regards,
Isabelle
Radu
Posts: 9434
Joined: Fri Jul 09, 2004 5:18 pm

Re: Retrieve the insert position in a text

Post by Radu »

Hi Isabelle,

So you want to somehow look around the current offset and see what text is there, right?
Maybe you can create a text content iterator ro.sync.ecss.extensions.api.AuthorDocumentController.getTextContentIterator(int, int) starting from the current node's start offset to the current offset and use it to see what text is there.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Isabelle
Posts: 168
Joined: Fri Jan 20, 2017 1:11 pm

Re: Retrieve the insert position in a text

Post by Isabelle »

Hello Radu,

It is exactly what I am looking for.
Thanks a lot.

Regards,
Isabelle
Post Reply