• Login
Community
  • Login

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

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
4 Posts 2 Posters 532 Views
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.
  • A
    Alan Kilborn
    last edited by Jun 15, 2022, 7:01 PM

    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…

    E 1 Reply Last reply Jun 16, 2022, 7:34 AM Reply Quote 2
    • E
      Ekopalypse @Alan Kilborn
      last edited by Jun 16, 2022, 7:34 AM

      @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.

      A 1 Reply Last reply Jun 16, 2022, 11:55 AM Reply Quote 5
      • A
        Alan Kilborn @Ekopalypse
        last edited by Jun 16, 2022, 11:55 AM

        @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
        • A Alan Kilborn referenced this topic on Jun 16, 2022, 8:54 PM
        • A
          Alan Kilborn
          last edited by Nov 23, 2023, 11:55 AM

          There is further discussion about this topic in this thread: https://community.notepad-plus-plus.org/topic/25145/find-and-display-all-duplicate-lines/

          1 Reply Last reply Reply Quote 1
          2 out of 4
          • First post
            2/4
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors