• Login
Community
  • Login

Select all text on all open files?

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
5 Posts 2 Posters 1.4k 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.
  • T
    trespda
    last edited by Apr 2, 2020, 10:57 AM

    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
    • T
      trespda
      last edited by Apr 2, 2020, 11:31 AM

      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 ?

      E 1 Reply Last reply Apr 2, 2020, 11:37 AM Reply Quote 1
      • E
        Ekopalypse @trespda
        last edited by Apr 2, 2020, 11:37 AM

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

        T 1 Reply Last reply Apr 2, 2020, 1:13 PM Reply Quote 2
        • T
          trespda @Ekopalypse
          last edited by trespda Apr 2, 2020, 1:13 PM Apr 2, 2020, 1:13 PM

          @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
          • E
            Ekopalypse
            last edited by Apr 2, 2020, 1:22 PM

            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
            3 out of 5
            • First post
              3/5
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors