You can retrieve the text of the editor window - 
in JavaScript it would be e.g.
var actEd = newEditor();
actEd.assignActiveEditor();
var actEditorTxt = actEd.text();

then the string matching functions of the language of your script (JavaScript,
VBScript...) can be used.
Probably the regular expressions would do or some simpler methods of strings.
The following expression might match the whole procedure according to your
sample (eventually the optional whitespace should be checked too):
\nproc [^ ]+ \{[^}]+\} \{(\n|.)+?\n\}

(Actually the line ending before the proc is matched too, then the procedure
definition and any text to the first closing bracket } following immediately
after a linebreak; hence if there are any other brackets inside the procedure,
they would have to be indented, for this to work.)

Or you can simply search for all occurences of the "proc" at the beginning of
the line in the text, then compare the results with the cursor position and use
the further steps you described (this would overcome the problem with nested
brackets as the matching brace algorithm of PSPad is much more sophisticated).

-- 
<http://forum.pspad.com/read.php?2,44299,44312>
PSPad freeware editor http://www.pspad.com

Odpovedet emailem