Navigation

    Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Setting a file tab's Language to "Internal Search"

    Help wanted · · · – – – · · ·
    2
    3
    76
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Alan Kilborn
      Alan Kilborn last edited by

      Just a bit curious about setting the language type for a file to “Internal Search”…

      One can’t do this by selecting something from the Language menu (doesn’t appear there), but I can do it with PythonScript via:

      notepad.setLangType(LANGTYPE.SEARCHRESULT)

      and indeed when I do that I see this on the left part of the status bar:

      3f2e9b24-485d-4c09-ab89-d97955c7d384-image.png

      But if I then copy some text from the Search results window into the file tab, I don’t see it get lexed like it is in the Search results; it looks rather plain and without fold points, like this:

      cf492f08-5997-4796-a18d-fe49e2e681ed-image.png

      For reference, here’s a sampling from the Search results window:

      a94acfb7-3f5d-4320-92d8-7a89989dbf15-image.png

      Curious if anyone knows why this is, leading to a workaround? Or a pointing out to me what I am doing wrong…

      Ekopalypse 1 Reply Last reply Reply Quote 2
      • Ekopalypse
        Ekopalypse @Alan Kilborn last edited by

        @alan-kilborn said in Setting a file tab's Language to "Internal Search":

        In order for a lexer to work it needs to know its

        • keywords
        • styles
        • and properties

        The searchResult lexer has no keywords, but one important property.
        The @MarkingsStruct contains the stringified version of the struct pointer,
        which contains the needed information from
        where to where to color the searched words.
        You must call getProperty to get this value and always set it for the tab’s buffer.

        copy some text from

        This can become a problem if you don’t make sure
        that the buffer in the tab is either an exact copy of the
        search result content or at least always the top result.

        Alan Kilborn 1 Reply Last reply Reply Quote 4
        • Alan Kilborn
          Alan Kilborn @Ekopalypse last edited by

          @ekopalypse

          Hmm, sounds complicated…probably more effort than I want to go to, as the text I’d want to lex may not end up being exactly like “search result” text anyway.
          Thanks for your thoughts on the matter.

          1 Reply Last reply Reply Quote 1
          • Referenced by  Alan Kilborn Alan Kilborn 
          • First post
            Last post
          Copyright © 2014 NodeBB Forums | Contributors