Community

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

    Select all text on all open files?

    Help wanted · · · – – – · · ·
    2
    5
    420
    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.
    • trespda
      trespda last edited by

      Is there a way to select all text on all open files?

      Is there a way to run a menu command on all of these selected texts?

      1 Reply Last reply Reply Quote 0
      • trespda
        trespda last edited by

        I’m looking blindly at the jN code

        URLDecoderEncoder.addItem({
            text: 'Decode',
            cmd: function() {
                var encoded = Editor.currentView.text;
                var unencoded = decodeURIComponent(encoded);
                Editor.currentView.text = unencoded;
            }
        

        , out of stackoverflow. They said there that Editor.currentView.text is the value that specify the text of the entire file. Can it be changed to be broader than currentView ?

        Ekopalypse 1 Reply Last reply Reply Quote 1
        • Ekopalypse
          Ekopalypse @trespda last edited by

          @trespda

          I’m not familiar with jn plugin but in order to get the text from all
          open documents you have to iterate over all open files.
          Npp offers an API to retrieve the open files.

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

            @Ekopalypse

            Npp offers an API to retrieve the open files.

            Would this mean keeping the files as files in their tabs, or retrieving the texts from all files to a new file?

            1 Reply Last reply Reply Quote 1
            • Ekopalypse
              Ekopalypse last edited by

              Not quite sure I understand.
              The workflow is like this

              • get number of open files (NPPM_GETNBOPENFILES)
              • retrieve the bufferids for these files (NPPM_GETOPENFILENAMESPRIMARY/NPPM_GETOPENFILENAMESSECOND, NPPM_GETBUFFERIDFROMPOS)
              • activate the bufferids (NPPM_ACTIVATEDOC)
              • read the content (SCINTILLA API GetTextT)
              1 Reply Last reply Reply Quote 3
              • First post
                Last post
              Copyright © 2014 NodeBB Forums | Contributors