I solved it without selecting a text.
I just needed the last word before the cursor:


    if editor.seltext="" then
      for x=editor.caretX to 1 Step -1
        if Mid(editor.linetext,x,1)<>" " Then 
          SearchText=Mid(editor.linetext,x,1) & SearchText
        else
          exit for
        end if
      next
    else
      SearchText = editor.seltext
    end if


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

Odpovedet emailem