[texworks] a script question
st.loeffler at gmail.com
Wed Mar 30 14:53:25 CEST 2011
On 2011-03-30 14:03, Pavol Severa wrote:
> if the text is
> ...something something someword<here-is-cursor>
> how can I get the position of the first character of "someword"?
> Should I simply take the big string TW.target.text and let the script
> detect the word in front of the cursor (by whatever means available in
> the scripting language)? Or is there an API command doing it?
No, there currently is no API for that.
For very large documents, it may be more efficient to use
selectionStart, selectionEnd, selection, and selectRange (because this
relies on some underlying Qt functions that should be optimized and
doesn't require the whole text to be passed to the script), but I'm not
aware of any tests regarding this. My guess would be that for any
"normal" document (smaller than several MB of text), the methods are
More information about the texworks