• Login
Community
  • Login

[Improvements] Folding, copy paste, drag'n drop

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
16 Posts 5 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.
  • W
    wonkawilly
    last edited by Jun 4, 2023, 4:39 PM

    I wish to advance a proposal of improvement to the Npp dev team. Its about how folding behaves when copy and pasting and when drag 'n dropping.
    If a section is folded into one line and the user select the folded part and copy and past or tries to drag’n drop elsewhere, not the whole section ins processed but only the start row that the folded section stars with.

    My proposal is that when a section is folded and the user moves with drag’n drop or cuts/copy and / pasts it elsewhere the whole section has to be moved as happens with Microsoft word while moving the whole chapter of a structured text.

    At the moment if the user wants to process the whole section that is folded has to select the whole section plus one line more. The problem is that not every time it is empty so cannot be done.

    Ho to reproduce the bad behavior:
    Make a generic content that is possible to fold and fold it clicking on the - (folding point): the section folds… than select the row and cut|copy/past or drag’n drop it elsewhere: only the first row is processed if you don’t select an empty row after the folded section.
    If you have other text you cannot select correctly.

    Also when a section is folded and you try to move them by using the keyboard (Ctrl+Shift+up|down arrow) is expected that the whole section moves before or after the previous or next folded section at once. But instead is un-folded and moves line by line. This too is an ugly behavior that IMHO needs correction making a folded section move all at once and jump the others folded section all at once: each folded section has to act as a block.

    L A 2 Replies Last reply Jun 5, 2023, 4:59 AM Reply Quote 0
    • L
      Lycan Thrope @wonkawilly
      last edited by Jun 5, 2023, 4:59 AM

      @wonkawilly ,
      Try reading this FAQ, and take it from there.
      https://community.notepad-plus-plus.org/topic/15741/faq-desk-feature-request-or-bug-report

      1 Reply Last reply Reply Quote 0
      • A
        Alan Kilborn @wonkawilly
        last edited by Alan Kilborn Jun 5, 2023, 10:53 AM Jun 5, 2023, 10:48 AM

        @wonkawilly said in [Improvements] Folding, copy paste, drag’n drop:

        How to reproduce the bad behavior:
        Make a generic content that is possible to fold and fold it clicking on the - (folding point): the section folds… than select the row and cut|copy/past or drag’n drop it elsewhere: only the first row is processed if you don’t select an empty row after the folded section.
        If you have other text you cannot select correctly.

        It will do the described poor behavior if you click the line number margin to select.

        However, if you don’t use the line-margin selection technique, but rather use the mouse to select the folded lineblock’s single visible line (in its entirety), and then drag it to a new location, the block moves (and is expanded when dropped).


        Also when a section is folded and you try to move them by using the keyboard (Ctrl+Shift+up|down arrow) is expected that the whole section moves before or after the previous or next folded section at once. But instead is un-folded and moves line by line. This too is an ugly behavior that IMHO needs correction making a folded section move all at once and jump the others folded section all at once: each folded section has to act as a block.

        This perhaps is a valid point, with the obvious workaround of cut -> move caret -> paste.

        I used to like “move line up” / “move line down” functionality, but I have stopped using them for two reasons: It puts a lot of information in the undo buffer, so if I’m undoing or redoing, I find myself getting confused about what the “real” operation was, and also because it can do unintended changes to “change history”, which I have come to rely on.

        L W 2 Replies Last reply Jun 5, 2023, 8:33 PM Reply Quote 2
        • L
          Lycan Thrope @Alan Kilborn
          last edited by Lycan Thrope Jun 5, 2023, 8:35 PM Jun 5, 2023, 8:33 PM

          @Alan-Kilborn ,
          Originally, I answered with the link to the FAQ on how to suggest Features, but if this is about a discussion, then my vote is that the user should just unfold and cut/copy/paste the complete text they want. That way there is no magic needed, nor will they be confused why everything wasn’t pasted.

          Some things, in my POV is that some people are just being excessively lazy either in planning out their layouts whether that be code or chapters of a book, and expecting the software to make their needing to change something, the responsibility of the application to make their mistakes easier to repair.

          I’m a touch typist, having been using a manual typewriter, going to an electric typewriter, to using software word processors and code editors, and it amazes me, how someone could have ever survived using the tools I did, prior to software tools. But, therein lies the answer to their problem…now they just have to learn how to code the solution to their problems themselves, rather than rely on other people and tools to do it for them. I guess I’m just old to think such things. :-)

          W 1 Reply Last reply Jun 6, 2023, 4:23 AM Reply Quote 1
          • W
            wonkawilly @Lycan Thrope
            last edited by Jun 6, 2023, 4:23 AM

            @Lycan-Thrope Somethime you might have to move huge sections of text or code with the huge risk let in place some orphan row.
            Folding have been invented not only to hide rows but even to facilitate working with very long text with easiness.
            Look for example at MS Word or Libre office Write that are able to move whole chapters ad sub chapters around into a structured document just moving a row: the title of the chapter that you want to move.
            This is a powerful editing tool to have into a text editor.

            Ps
            Also about asking for new features and improvements into
            https://github.com/notepad-plus-plus/notepad-plus-plus
            I can’t because I get the message:

            "You can’t perform that action at this time. "

            L A 2 Replies Last reply Jun 6, 2023, 5:15 AM Reply Quote 0
            • W
              wonkawilly @Alan Kilborn
              last edited by wonkawilly Jun 6, 2023, 5:04 AM Jun 6, 2023, 4:48 AM

              @Alan-Kilborn said in [Improvements] Folding, copy paste, drag’n drop:

              It will do the described poor behavior if you click the line number margin to select.

              Tried: doesn’t work; just the first line of the folded block gets moved
              An Animated screenshot follows:
              2023-06-06 07 03 11.gif

              P A 2 Replies Last reply Jun 6, 2023, 1:16 PM Reply Quote 0
              • L
                Lycan Thrope @wonkawilly
                last edited by Lycan Thrope Jun 6, 2023, 5:27 AM Jun 6, 2023, 5:15 AM

                @wonkawilly ,
                The tools you mention, again for clarification, are Word Processors and Notepad++ is not.

                You can code in a word processor if you want to, as long as it’s exported/saved to a .txt format file, since a word processor has meta data and structures that allow for the fancy manipulation you are asking about…and again, for clarification and education, Notepad++ is not a word processor, it is a text editor

                The capabilities of NPP is by nature, the product of a library that allows for meta manipulation of text for the purpose of minor word processing capability to produce syntax highlighting, folding (that you are asking about) and is inherent in the library itself, not NPP…so maybe this feature is something that you could direct to the Scintilla project, to make it something it can do by default by calling a few routines in that library.

                NPP can do a lot of things beyond just being a code editor, but at the end of the day, it only handles text, saves as text and does not save the structure of the document itself, in the document. That’s the basic difference between what we have, and what you want.

                Those examples you give save their document format and structure in the doument itself, hence by nature, it is not a comparable capability that can be embedded in the text files that NPP works with. I can’t understand why people can not or will not understand and accept that NPP is a text editor and not a word processor, where all those neat features everyone wants belongs.

                1 Reply Last reply Reply Quote 0
                • G
                  guy038
                  last edited by guy038 Jun 6, 2023, 11:26 AM Jun 6, 2023, 11:06 AM

                  Hi, @wonkawilly, @lycan-thrope, @alan-kilborn and All,

                  But, @wonkawilly, it DOES copy / paste the folded html section !


                  • Placed your caret to the very beginning of your folded line, whatever it is

                  • Click on the Shift + Down arrow shortcut

                  • Click on the Ctrl + C shortcut

                  • Open a new tab ( Ctrl + V )

                  • Paste the HTML stucture of the folded section ( Ctrl + V )


                  You may, as well, use the @alan-kilborn’s techique and drag n’ drop your folded section in a new tab, using the two panels feature !

                  But, whatever your choice, your new tab should contain the complete struture of the folded section selected !

                  Best Regards,

                  guy038

                  1 Reply Last reply Reply Quote 1
                  • G
                    guy038
                    last edited by guy038 Jun 6, 2023, 11:27 AM Jun 6, 2023, 11:13 AM

                    Hi, @wonkawilly and All,

                    Oh, I misunderstood your post :-(( Indeed, you seem upset that a click on the line number of the folded line does not copy all the structure, doesn’t it ?

                    Well, then simply use one of the two techniques, described in my previous post !

                    BR

                    guy038

                    1 Reply Last reply Reply Quote 1
                    • P
                      PeterJones @wonkawilly
                      last edited by PeterJones Jun 6, 2023, 1:17 PM Jun 6, 2023, 1:16 PM

                      @Alan-Kilborn said,

                      It will do the described poor behavior if you click the line number margin to select.

                      Then @wonkawilly said in [Improvements] Folding, copy paste, drag’n drop:

                      Tried: doesn’t work; just the first line of the folded block gets moved

                      He just told you clicking in the line margin to select will not work, and then you tell him you tried doing that and it didn’t work. This is unsurprising, as it’s exactly what he said wouldn’t work. But luckily for you, Alan went on to explain exactly how you can achieve your desired behavior:

                      And I quote @Alan-Kilborn here (emphasis added):

                      However, if you don’t use the line-margin selection technique, but rather use the mouse to select the folded lineblock’s single visible line (in its entirety), and then drag it to a new location, the block moves (and is expanded when dropped).

                      You also said,

                      I can’t because I get the message: "You can’t perform that action at this time. "

                      Yes, it is rather unfortunate for you that decisions you made when posting in the GitHub issues have lasting consequences. But that doesn’t change the fact that we in the Community Forum can do nothing here to implement feature improvements, and any suggestions made here can only serve to get you our opinions on your ideas, and our thoughts for workarounds; but nothing you say here will be taken by any of the developers as an official feature request.

                      L 1 Reply Last reply Jun 6, 2023, 8:03 PM Reply Quote 1
                      • L
                        Lycan Thrope @PeterJones
                        last edited by Jun 6, 2023, 8:03 PM

                        @PeterJones ,
                        There is one exception to this, depending on if it’s an inhouse or UDL language. For instance, my UDL has an issue when the return statement is used inside say a do case structure, the folding short circuits including text after that return statement, as belonging to the function that is folded, and consequently, the remaining text after the first return will be outside the fold.

                        However, copying that additional bit of text along with the folded function line, does indeed do as you describe, by copying and expanding the folded function, including the internal do case folded section as well. Below shows the needed copy and paste screenshots that I have to do, unless I can figure out how to allow a return statement inside of a function to not be counted when it is not the function’s true return closing keyword:

                        FoldedUDLFunction1.PNG

                        FoldedUDLFunction2.PNG

                        P 1 Reply Last reply Jun 6, 2023, 9:42 PM Reply Quote 0
                        • P
                          PeterJones @Lycan Thrope
                          last edited by PeterJones Jun 6, 2023, 9:43 PM Jun 6, 2023, 9:42 PM

                          @Lycan-Thrope ,

                          On a technicality, I still maintain that Alan and I are right, because Alan’s method grabs the entire folded section (27-46 in your example) – grabbing something outside the fold (lines 47 and 48 in your example) (whether it should have been part of the code block or not) was not part of the problem statement (“select the folded part”). If you want to grab more than just what’s inside the fold, you can extend the selection after starting to grab the whole block the way that Alan described.

                          To sum up: Double-clicking the margin will only select a single line, whether it’s the first line of a fold or not; selecting from the first character of a line then using shift+arrow to move to the next visible line will select the entirety of the fold; and you are responsible to extend beyond that yourself, if you want to select more than was folded.

                          L 1 Reply Last reply Jun 6, 2023, 10:54 PM Reply Quote 1
                          • L
                            Lycan Thrope @PeterJones
                            last edited by Jun 6, 2023, 10:54 PM

                            @PeterJones ,
                            I think we just misunderstood each other…I’m agreeing with you, I’m just pointing out a flaw, more due to my UDL limitation, than the technique you’re talking about.
                            :-)
                            I agree with you, and have done it, it’s just the flaw with how the UDL works that causes it not to get the intended end of the fold, so it does work as it’s supposed to, my UDL just leaves it short.

                            1 Reply Last reply Reply Quote 1
                            • W
                              wonkawilly
                              last edited by wonkawilly Jun 11, 2023, 12:27 PM Jun 11, 2023, 12:25 PM

                              OK the solution proposed works indeed: so the trick is basically to select one more paragraph / end of line / \r\n to make it work.
                              Thank you all.

                              1 Reply Last reply Reply Quote 0
                              • A
                                Alan Kilborn @wonkawilly
                                last edited by Jun 12, 2023, 1:05 PM

                                This post is deleted!
                                1 Reply Last reply Reply Quote 0
                                • A
                                  Alan Kilborn @wonkawilly
                                  last edited by Alan Kilborn Jun 12, 2023, 1:07 PM Jun 12, 2023, 1:07 PM

                                  This post is deleted!
                                  1 Reply Last reply Reply Quote 0
                                  • rdipardoR rdipardo referenced this topic on Jan 27, 2025, 11:37 PM
                                  1 out of 16
                                  • First post
                                    1/16
                                    Last post
                                  The Community of users of the Notepad++ text editor.
                                  Powered by NodeBB | Contributors