Community
    • Login

    Strange behavior of the sort function, with zero-length column mode selection

    Scheduled Pinned Locked Moved General Discussion
    18 Posts 4 Posters 1.1k 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.
    • Terry RT
      Terry R @guy038
      last edited by Terry R

      @guy038 said in Strange behavior of the sort function, with zero-length column mode selection:

      However, I do not understand why IF I select again the Plugins > PythonScript > New Script option, this time, the Save under… windows proposes to save the future .py file in the \E folder instead of the normal location E:\846_x64_RC3\plugins\Config\PythonScript\Scripts ?!

      After reading that I’m wondering if a variable has been set if the first use was in relation to the E:\ drive. Now any successive use of this will use the pre-set variable of E:\ as a starting point since it’s already set.

      Possibly a test might be to complete a fresh start of NPP and do a new script and see what the Save Under proposes.

      Terry

      1 Reply Last reply Reply Quote 0
      • Alan KilbornA
        Alan Kilborn @guy038
        last edited by

        @guy038

        I also have problems with the PythonScript > New Script command suggesting a folder that isn’t the one I want. It typically suggests a folder that is the scripts folder for another version of Notepad++ that I’ve recently used. I’ve no idea why this happens; I’ve posted about this before but never came to a resolution. So…I’m just doubly careful when I save a new script, such that it is going into the correct folder!

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

          Hi All,

          Could it be connected with the fact of putting a local N++ install on a removable drive ?

          BR

          guy038

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

            Hi, @terry-r, @alan-kilborn, @peterjones and All

            I’m really perplexed !!??

            • On my USB drive, I created a new folder E:\846_x64

            • Then, I moved the npp.8.4.6.portable.x64.7z archive, that I kept, from the folder E:\846_x64_RC3 to the new folder E:\846_x64

            • I opened this archive and extracted all the contents in the E:\846_x64 folder

            • I defined my preferred parameters in Settings > Preferences...

            • And I downloaded the PythonScript plugin via the Plugin Admin

            Bingo ! I’m pleased to tell you that, whatever the current tab, as soon as I select the Plugins > PythonScript > New Script option, the Save inder window always opens in E:\846_x64\plugins\Config\PythonScript\Scripts ;-))

            • Finally, I added the ComparePlus and BetterMultiSelection plugins and everything is still OK !

            So, I don’t see why it’s OK on a local N++ install, in folder E:\846_x64 and KO on a SAME local N++ install, in folder E:\846_x64_RC3 ???

            Anyway, my problem is solved !

            Best Regards,

            guy038

            …A quarter of an hour later, even if I use my old local N++ version, within the E:\846_x64_RC3 folder, everything seems OK, again ??? Really confusing !

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

              Hi all,

              As promised, I created a new issue concerning this problem :

              https://github.com/notepad-plus-plus/notepad-plus-plus/issues/12299#issue-1401062911

              BR

              guy038

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

                Hello @alan-kilborn and All,

                In the post above, of this discussion :

                https://community.notepad-plus-plus.org/post/80361

                You said that you met the problem, sometimes in the past and that you haven’t find a solution yet to the fact that running the Plugins > PythonScript > New Script does not open the folder Local N++ install\Plugins\Config\PythonScript\Scripts, in the case of a local N++ install !

                I’ve already found out two ways to reproduce this wrong behavior and also how to get the right folder ! Could you, Alan, @peterjones or someone else confirm my hypotheses ?


                A wrong folder destination, when using the Plugins > PythonScript > New Script option, may occur when :

                • You’re trying, by mistake, to open an already opened file in your current N++ session which is not saved in the ...\Plugins\Config\PythonScript\Scripts folder

                • You’re saving a new_x file, in a specific folder, different from the ...\Plugins\Config\PythonScript\Scripts folder


                So, an easy solution is to re-open a Python script of your current session ! Afterwards, any use of the Plugins > PythonScript > New Script option should open the right folder ...\Plugins\Config\PythonScript\Scripts ;-))

                Remark : Note that holding the Ctrl key, while using the Plugins\Python Scripts\Scripts\"Script Name" option, does not help in this matter :-((

                Best Regards,

                guy038

                Alan KilbornA 1 Reply Last reply Reply Quote 0
                • Alan KilbornA
                  Alan Kilborn @guy038
                  last edited by

                  @guy038 said in Strange behavior of the sort function, with zero-length column mode selection:

                  two ways to reproduce this wrong behavior

                  As I never do those two actions, that isn’t a way I’m getting into the circumstance.

                  My problem with it mainly occurs when I am running a different instance of N++ to test a script in a “clean” setup. I tell it to create a New Script and it wants to save the file in the correct folder but in my daily use Notepad++.

                  I have several workarounds for this, but it is annoying behavior to say the least.

                  1 Reply Last reply Reply Quote 0
                  • Alan KilbornA
                    Alan Kilborn
                    last edited by Alan Kilborn

                    The “Strange behavior of the sort function, with zero-length column mode selection” has been SOLVED by the developers and will be in the next release, presumably 8.4.8.

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

                      @PeterJones :

                      SelectionToRectangle.py v2022.10.06

                      In Peter’s Oct 6, 2022 11:20am posting, the script code contained this line:

                      if editor.getSelectionMode()<>SELECTIONMODE.RECTANGLE:

                      Is Peter showing his BASIC roots here by using <>?

                      Proper Python would be to use != (or so one would think… keep reading…).

                      What caused me to notice this is that I exclusively use Python3 (and PythonScript v3.x) these days, and such a thing causes an error there, e.g.

                      Python 3.12.3 (tags/v3.12.3:f6650f9, Apr  9 2024, 14:05:25) [MSC v.1938 64 bit (AMD64)]
                      >Initialisation took 3078ms
                      >Ready.
                      >>> a = 3
                      >>> a <> 4
                        File "<console>", line 1
                          a <> 4
                            ^^
                      SyntaxError: invalid syntax
                      

                      This made me dig up PythonScript 2 and try it there, where, indeed, it is fine:

                      Python 2.7.18 (v2.7.18:8d21aa21f2, Apr 20 2020, 13:25:05) [MSC v.1500 64 bit (AMD64)]
                      >Initialisation took 2703ms
                      >Ready.
                      >>> a = 3
                      >>> a <> 4
                      True
                      

                      Probably the moral to the story is to just not use <> with Python, whatever version. :-)

                      Perhaps some further interesting reading: https://stackoverflow.com/questions/16749121

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

                        @Alan-Kilborn said in Strange behavior of the sort function, with zero-length column mode selection:

                        Is Peter showing his BASIC roots here by using <>?

                        100 PRINT "BASIC FOREVER"
                        200 GOTO 100
                        
                        1 Reply Last reply Reply Quote 3
                        • First post
                          Last post
                        The Community of users of the Notepad++ text editor.
                        Powered by NodeBB | Contributors