editor.findText()

Ron Jensen
2014-02-12
2014-02-13
  • Ron Jensen

    Ron Jensen - 2014-02-12

    http://npppythonscript.sourceforge.net/docs/latest/scintilla.html?highlight=findtext#Editor.findText tells me the first field is 'flags'

    Editor.findText(flags, start, end, ft) → object¶
    Find some text in the document.
    
    See Scintilla documentation for SCI_FINDTEXT
    

    http://www.scintilla.org/ScintillaDoc.html#SCI_FINDTEXT calls it "int searchFlags" and poking around the page I see these flags: SCFIND_MATCHCASE SCFIND_WHOLEWORD SCFIND_WORDSTART SCFIND_REGEXP SCFIND_POSIX but I can't use those directly in the command,

    myFind = editor.findText(SCFIND_REGEXP,0,endPos,"\t")
    Traceback (most recent call last):
      File "<console>", line 1, in <module>
    NameError: name 'SCFIND_REGEXP' is not defined
    

    How do I use these flags?

    Thanks,

    Jentron

     
  • Dave Brotherstone

    The flags you want are in FINDOPTION, which has the options WHOLEWORD, MATCHCASE, WORDSTART, REGEXP and POSIX (although POSIX should have no effect).

    e.g.

    editor.findText(FINDOPTION.WORDSTART | FINDOPTION.MATCHCASE, 0, editor.getLength(), "Test")
    

    It'd be great if the documentation included references to which flags are used in which calls - I'm sorry they don't at the moment.

    Cheers,
    Dave.

     
  • Ron Jensen

    Ron Jensen - 2014-02-13

    Great, thanks! A lot more readable than editor.findText(0x00600000,...)

    :D

    The Scittilla says SCFIND_POSIX Treat regular expression in a more POSIX compatible manner by interpreting bare ( and ) for tagged sections rather than ( and ). So it should change the behavior of parenthesis?

    I noticed when the Boost regex engine was updated that dots "." now need to be escaped in the replace string "."

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks