Community
    • Login

    Autocomplete over multiple lines

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    7 Posts 5 Posters 880 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.
    • Romain BocquiauR
      Romain Bocquiau
      last edited by

      Hey,

      Let’s say we have a file with this :

      $Test1 = strstr('my text to search in at First', 'e'); 
      $Test2 = strstr('my text to search in If it is possible', 'e'); 
      $Test3 = strstr('my text to search in', 'e');
      

      I want to replace strstr by strpos, but i don’t want to use the simple search/replace, because I have other lines with the same function and i’ll have to keep them.
      I can select “strstr” on these lines with [ALT]+[MAJ] then start to write “strp”.

      If I do, and press [CTRL]+[ENTER], nothing happens.
      If I press [ENTER] only, it will create and go to next line.

      Would it be possible to get a shortcut doing it please ?
      Like [CTRL]+[MAJ]+[V] for instance

      Michael VincentM PeterJonesP 2 Replies Last reply Reply Quote 0
      • Michael VincentM
        Michael Vincent @Romain Bocquiau
        last edited by

        @romain-bocquiau said in Autocomplete over multiple lines:

        I want to replace strstr by strpos, but i don’t want to use the simple search/replace, because I have other lines with the same function and i’ll have to keep them.
        I can select “strstr” on these lines with [ALT]+[MAJ] then start to write “strp”.
        If I do, and press [CTRL]+[ENTER], nothing happens.
        If I press [ENTER] only, it will create and go to next line.
        Would it be possible to get a shortcut doing it please ?

        This is possible, you just need to set SCI_AUTOCSETMULTI to SC_MULTIAUTOC_EACH . You can do this with the PythonScript plugin at startup:

            ed.autoCSetMulti(MULTIAUTOCOMPLETE.EACH)
        

        or any other of your favorite scripting plugins.

        Cheers.

        Alan KilbornA 1 Reply Last reply Reply Quote 2
        • Alan KilbornA
          Alan Kilborn @Michael Vincent
          last edited by

          @michael-vincent

          Maybe more complete, for PythonScript?:

          from Npp import *
          editor.autoCSetMulti(MULTIAUTOCOMPLETE.EACH)
          
          1 Reply Last reply Reply Quote 3
          • PeterJonesP
            PeterJones @Romain Bocquiau
            last edited by PeterJones

            @romain-bocquiau

            In v8.2 and earlier, the auto-completion was always completed by typing either ENTER or TAB, and there was no way to make either of those keys work as actual text input, so you had to type TAB TAB or ENTER ENTER if you wanted the next character to be inserted as a literal TAB or ENTER (which I often wanted, so I have had to have auto-completion feature disabled for years, because I was more likely to want a literal TAB or ENTER than to want the auto-completed text by the time I hit TAB or ENTER)

            Ctrl+Enter never was the auto-complete key, so I’m not sure why you (and others) have started saying that it should work.

            In v8.2.1 and v8.3, the new feature was added to disable ENTER and/or TAB for the completion-selection key; this setting could be changed using Settings > Preferences > Auto-Completion ☑ TAB and ☐ ENTER, and was mentioned in the release notes (the change.log that opened when you installed or upgraded to v8.2.1). This change was necessary and good, because it allows users to pick which of the completion-keys will select the chosen auto-complete text (and allowed me to finally start using auto-completion, after years of not being able to).

            Unfortunately, by default it was set to ☑ TAB (on) and ☐ ENTER (off), and users rebelled at the change in behavior. Due to the rebellion, the default was changed back to both being enabled by default on v8.3.1-RC1, but can still be changed in the GUI settings.

            But if you have v8.2.1 or v8.3 (or if you ever ran them, so they wrote the config file), the “default” will not override the saved setting (because the “default” has no way of knowing whether you intentionally set your config.xml to ☑ TAB (on) and ☐ ENTER (off), or whether that just happened to be the default that you don’t want). If you have installed one of those intermediate versions, you will have to go to Settings > Preferences > Auto-Completion and enable ☑ ENTER to get ENTER as the completion key. Or you can choose to learn to use TAB as the completion key, which is the more common completion key across Windows products (for example, it’s what’s used in MS Office products). (Please note that updating from v8.2.1 or from v8.3 to v8.3.1 will not change the configuration if you ever ran in v8.2.1 or v8.3 … you will have to change the setting yourself).

            PeterJonesP 1 Reply Last reply Reply Quote 2
            • PeterJonesP
              PeterJones @PeterJones
              last edited by

              Interesting. I interpreted your request as the auto-complete wasn’t working right. The others interpreted your request as wanting a way to multi-select the text so you can type it all.

              Apparently, your phrasing can be interpreted in multiple ways.

              If you wanted one or the other, hopefully our answers are good enough. If you really want both, please note that auto-completion will not work right with multi-select or column select (it will pop up, but the auto-completed text will only show up on one occurrence of the multi-or-column select). So if you’ve got multi-select or column-select, type the whole word rather than relying on auto-completion.

              Good luck.

              1 Reply Last reply Reply Quote 2
              • guy038G
                guy038
                last edited by guy038

                Hi, @romain-bocquiau, @peterjones, @michael-vincent, @alan-kilborn and All,

                Peter, I think that the BetterMultiSelection plugin, of @dail, allows and keeps the multi or column selection on several lines, together with the auto completion feature ! Just tested !

                Best Regards,

                guy038

                Romain BocquiauR 1 Reply Last reply Reply Quote 6
                • Romain BocquiauR
                  Romain Bocquiau @guy038
                  last edited by

                  Hi all,

                  @guy038 said in Autocomplete over multiple lines:

                  Hi, @romain-bocquiau, @peterjones, @michael-vincent, @alan-kilborn and All,

                  Peter, I think that the BetterMultiSelection plugin, of @dail, allows and keeps the multi or column selection on several lines, together with the auto completion feature ! Just tested !

                  Best Regards,

                  guy038

                  It was exactly what i needed. thank you.

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