Discussion:
Finding the closest word!
(too old to reply)
Atmapuri
2008-06-06 14:03:11 UTC
Permalink
Hi!

In which way could I obtain the word closest to the
cursor in the currently open file in the editor?

I guess I would at least need cursor position
and access to the text buffer of the currently edited
file.

I can see in Castalia that this is possible.

Thanks!
Atmapuri
Gerrit Beuze
2008-06-06 14:39:32 UTC
Permalink
Post by Atmapuri
In which way could I obtain the word closest to the
cursor in the currently open file in the editor?
There's nothing build in the ToolsAPI that does this.

Use IOTAEditView to get the cursor position,
and the corresponding charpos
Use TEditorReader to read the code at that position
(probably the entire line)
Write a procedure that does what you need.

Gerrit Beuze
ModelMaker Tools
Lex Y. Li
2008-06-07 03:28:33 UTC
Permalink
Post by Atmapuri
I can see in Castalia that this is possible.
According to CodeRush's author Mark and Castalia's author Jacob, you
cannot do many fancy things with OTA in fact. Both CodeRush and Castalia
use a lot of low level hacking tricks to inject into Delphi IDE to
realize so many wonderful features.
Gerrit Beuze
2008-06-07 11:01:31 UTC
Permalink
According to CodeRush's author Mark and Castalia's author Jacob, you cannot do many fancy things with OTA in fact. Both CodeRush
and Castalia use a lot of low level hacking tricks to inject into Delphi IDE to realize so many wonderful features.
You can do a lot without none or very little hacking...
ModelMaker Code Explorer adds a lot of features without any low level
hacks.

Gerrit Beuze
ModelMaker Tools

Boost your productivity in the Delphi IDE with ModelMaker Code Explorer:
http://www.modelmakertools.com/code-explorer/index.html
Erik Berry
2008-06-09 00:04:30 UTC
Permalink
Post by Atmapuri
In which way could I obtain the word closest to the
cursor in the currently open file in the editor?
You could try IOTAEditPosition.RipText with the flags like
rfIncludeAlphaChars. There is also a search interface to find whole words
(see IOTASearchOptions.WordBoundary). You may need to do some caret
positioning before using either method.

Erik
Atmapuri
2008-06-09 10:00:39 UTC
Permalink
Hi!
Post by Erik Berry
You could try IOTAEditPosition.RipText with the flags like
rfIncludeAlphaChars. There is also a search interface to find whole words
(see IOTASearchOptions.WordBoundary). You may need to do some caret
positioning before using either method.
I also posted a QC in your corner :)

http://qc.codegear.com/wc/qcmain.aspx?d=63061

Thanks!
Atmapuri

Loading...