Community
    • Login

    Is there a quick way to paste big text to the right?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    14 Posts 3 Posters 8.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.
    • Hoakin SingerH
      Hoakin Singer
      last edited by

      Hi Claudia,no i was interested in creating 2 columns , imagine a paper that has text on left and right with a separation in between . Most common use ,lyrics and closing credits in movies,remember how there sometimes are 2 lines of text side by side.Thank you.

      1 Reply Last reply Reply Quote 0
      • Claudia FrankC
        Claudia Frank
        last edited by

        Hi Hoakin Singer,

        I still think this can be achieved by using the block copy.
        Let’s assume we have the following text

        this 
        is
        the
        text
        on
        the
        left
        whereas
        this
        should
        be
        on
        the
        right
        

        We can move the desired text by pressing and holding the left ALT key and selcting from “whereas” to “right”.
        Press strg+x to cut out the selection, put the cursor on the position where the first word should start and press
        strg+v. Done.

        Then we should have something like this

        this 
        is
        the                         whereas
        text                        this
        on                          should
        the                         be
        left                        on
                                    the
                                    right
        

        Done. Or?

        Cheers
        Claudia

        1 Reply Last reply Reply Quote 0
        • Hoakin SingerH
          Hoakin Singer
          last edited by

          @Claudia-Frank said:

          strg+x

          Hello Claudia.
          Thank you for your time!
          It did work,but the result wasn’t as i expected,the formatting of the text needs rework,so i guess NPPP isn’t good for what i want to achieve. Will try on a image editor.
          Thank you again , i hope and wish to you the best.

          Singer

          1 Reply Last reply Reply Quote 0
          • Claudia FrankC
            Claudia Frank
            last edited by

            Hi Singer,

            if there is a repeating pattern in how you want the text to be modified then
            it might be that there are other possible solutions.
            Can you show us an example what exactly you try to achieve?
            But if you already found a solution with another program than
            I’m fine too. ;-)

            All the best to you as well.

            Claudia

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

              Hi Hoakin, Claudia and All,

              Hoakin, I think that we can use some regexes, in order to achieve what you would like to !

              For instance, I suppose that, from the original list ( 2 x 4 lines ), below :

              Sir William
              Robert
              Jo
              Louise-Elisabeth
              Shakespeare
              Pattinson
              Burt  
              Vigée Le Brun
              

              OR from the original list ( 1 * 4 lines ), below :

              Sir William Shakespeare   
              Robert Pattinson
              Jo Burt  
              Louise-Élisabeth Vigée Le Brun
              

              You would expect the same final list below :

                   Sir William Shakespeare   
                        Robert Pattinson
                            Jo Burt  
              Louise-Élisabeth Vigée Le Brun
              

              No problem. Just the time to run 2/3 Searches/Replacements !!


              Of course, I needed some test text and I was thinking of a small list of real names and forenames of celebrities, with some compound names and some compound forenames, too !

              I, finally, chose the list of the 32 repute classical harpists, taken from the link below :

              https://en.wikipedia.org/wiki/List_of_classical_harpists

              Note that I don’t specially like or hate harp !!, Just hazard, while surfing on the Net :-)


              So, insert, in a NEW tab, the 32 forenames, below, without any indentation :

              Nancy
              Jana
              Alice
              Pearl
              Elaine
              Osian
              Vincent
              Sidonie
              Marcel
              Alphonse
              Elizabeth
              Pierre
              Yolanda
              Johann Baptist
              Lucile
              Susann
              François Joseph
              Jean Henri
              Şirin
              Laura
              Edna
              Ann
              Anna-Maria
              Casper
              Henriette
              Marisa
              Victor
              Carlos
              Marcel
              Sylvia
              Aristid
              Nicanor
              

              Some hypotheses :

              • The variable N will represent the total number of forenames / names, that is to say, the value 32, in our example

              • The variable M will represent the number of characters of the greatest forename, that is to say the value 15 ( Forename François Joseph, in our example )

              • The different S/R, below, must have the Regular expression search mode checked and the . matches newline option unchecked, in the Replace dialog ( CTRL + R )

              • You must go back to the very beginning of the list ( with CTRL + Origin ), BEFORE each S/R


              Perform the first S/R, below :

              SEARCH ^[^|\r\n]+[^ |]\K($|\|)|^.{M}\K + replacing the M variable by the appropriate integer ( 15, in our example )

              REPLACE (?1 |) with M Spaces, between the (?1 and |) strings ( 15 spaces, in our example ), that is to say :

              (?1               |)
              

              Click, TWICE, on the Replace All button


              Now, add, AFTER the present list, the 32 names, below, without any indentation :

              Allen
              Bouskova
              Chalifoux
              Chertok
              Christy
              Ellis
              Fanelli
              Goossens
              Grandjany
              Hasselmans
              Hainen DePeters
              Jamet
              Kondonassis
              Krumpholtz
              Lawrence
              McDonald
              Naderman
              Naderman
              Pancaroğlu
              Peperara
              Phillips
              Hobson Pilot
              Ravnopolska-Dean
              Reardon
              Renié
              Robles
              Salvi
              Salzedo
              Tournier
              Woods
              Von Würtzler
              Zabaleta
              

              Perform the second S/R, below:

              SEARCH (.+)(?=\R(.+\R){N-1}(.+))|.(?s).+ replacing the N-1 expression by the appropriate number ( 31, in our example )

              REPLACE \1\3

              Click, ONCE, on the Replace All button

              Note :

              • The dot, before the (?s) syntax, represents 1 char. NON EOL, to avoid that the second alternative selects ALL the remaining text, when the cursor is located :

                • Between the PIPE character and an EOL character, after a previous match of the first alternative of the regex

                • In possible blank lines, preceding the list, BEFORE any S/R process


              Finally, perform the third S/R, below :

              SEARCH ^(.+?)( *)\|

              REPLACE \2\1\x20

              Click, ONCE, on the Replace All button

              Et voilà !!! Nice, isn’t it ?

              We get the final list , below :

                        Nancy Allen
                         Jana Bouskova
                        Alice Chalifoux
                        Pearl Chertok
                       Elaine Christy
                        Osian Ellis
                      Vincent Fanelli
                      Sidonie Goossens
                       Marcel Grandjany
                     Alphonse Hasselmans
                    Elizabeth Hainen DePeters
                       Pierre Jamet
                      Yolanda Kondonassis
               Johann Baptist Krumpholtz
                       Lucile Lawrence
                       Susann McDonald
              François Joseph Naderman
                   Jean Henri Naderman
                        Şirin Pancaroğlu
                        Laura Peperara
                         Edna Phillips
                          Ann Hobson Pilot
                   Anna-Maria Ravnopolska-Dean
                       Casper Reardon
                    Henriette Renié
                       Marisa Robles
                       Victor Salvi
                       Carlos Salzedo
                       Marcel Tournier
                       Sylvia Woods
                      Aristid Von Würtzler
                      Nicanor Zabaleta
              

              Note :

              • In the Replacement part, you may change the single space (\x20), between forenames and names, by anything you would like to ! For instance, \2\1 - ( two spaces + one dash + two spaces )

              Now, let’s suppose that we, already, got the list of the 32 names, with their forenames, as below :

              Nancy Allen
              Jana Bouskova
              Alice Chalifoux
              Pearl Chertok
              Elaine Christy
              Osian Ellis
              Vincent Fanelli
              Sidonie Goossens
              Marcel Grandjany
              Alphonse Hasselmans
              Elizabeth Hainen DePeters
              Pierre Jamet
              Yolanda Kondonassis
              Johann Baptist Krumpholtz
              Lucile Lawrence
              Susann McDonald
              François Joseph Naderman
              Jean Henri Naderman
              Şirin Pancaroğlu
              Laura Peperara
              Edna Phillips
              Ann Hobson Pilot
              Anna-Maria Ravnopolska-Dean
              Casper Reardon
              Henriette Renié
              Marisa Robles
              Victor Salvi
              Carlos Salzedo
              Marcel Tournier
              Sylvia Woods
              Aristid Von Würtzler
              Nicanor Zabaleta
              

              First of all, we had to change aspace with the PIPE character |, to separate the forename part, on the left, from the name part, on the right. This action still needs human’s brain, NOT regexes, unfortunately :-(( So, our list becomes :

              Nancy|Allen
              Jana|Bouskova
              Alice|Chalifoux
              Pearl|Chertok
              Elaine|Christy
              Osian|Ellis
              Vincent|Fanelli
              Sidonie|Goossens
              Marcel|Grandjany
              Alphonse|Hasselmans
              Elizabeth|Hainen DePeters
              Pierre|Jamet
              Yolanda|Kondonassis
              Johann Baptist|Krumpholtz
              Lucile|Lawrence
              Susann|McDonald
              François Joseph|Naderman
              Jean Henri|Naderman
              Şirin|Pancaroğlu
              Laura|Peperara
              Edna|Phillips
              Ann|Hobson Pilot
              Anna-Maria|Ravnopolska-Dean
              Casper|Reardon
              Henriette|Renié
              Marisa|Robles
              Victor|Salvi
              Carlos|Salzedo
              Marcel|Tournier
              Sylvia|Woods
              Aristid|Von Würtzler
              Nicanor|Zabaleta
              

              Now, the different steps are almost the same ones as above. As we’ll use the same value of M, these are :

              • Recopy this modified list in a NEW tab

              • Perform the first S/R, TWICE :

              SEARCH ^[^|\r\n]+[^ |]\K($|\|)|^.{15}\K +

              REPLACE (?1 |) ( 15 spaces, between the (?1 and |) strings

              • Perform the third S/R, ONCE :

              SEARCH ^(.+?)( *)\|

              REPLACE \2\1\x20

              Note : In this case, the second S/R, above, is NOT used

              We, again, get the final list below :

                        Nancy Allen
                         Jana Bouskova
                        Alice Chalifoux
                        Pearl Chertok
                       Elaine Christy
                        Osian Ellis
                      Vincent Fanelli
                      Sidonie Goossens
                       Marcel Grandjany
                     Alphonse Hasselmans
                    Elizabeth Hainen DePeters
                       Pierre Jamet
                      Yolanda Kondonassis
               Johann Baptist Krumpholtz
                       Lucile Lawrence
                       Susann McDonald
              François Joseph Naderman
                   Jean Henri Naderman
                        Şirin Pancaroğlu
                        Laura Peperara
                         Edna Phillips
                          Ann Hobson Pilot
                   Anna-Maria Ravnopolska-Dean
                       Casper Reardon
                    Henriette Renié
                       Marisa Robles
                       Victor Salvi
                       Carlos Salzedo
                       Marcel Tournier
                       Sylvia Woods
                      Aristid Von Würtzler
                      Nicanor Zabaleta
              

              Best regards,

              guy038

              1 Reply Last reply Reply Quote 1
              • Claudia FrankC
                Claudia Frank
                last edited by

                Hi guy038,

                puuuhh, wow, excellent.
                You know I love python script and I guess this script can do it almost the same, can’t it?

                i = 0               # LengthOfBiggestString
                list_of_names = []
                
                def find_biggest_string(cont, l_num, tot_lines): 
                    global i
                    if len(cont) > i:
                        i = len(cont)
                    list_of_names.append(cont)
                
                editor.forEachLine(find_biggest_string) 
                
                editor.clearAll()
                
                for name in list_of_names:
                    name_parts = name.split(' ')
                    firstname = name_parts[0]
                    lastname = ' '.join(name_parts[1:])
                    console.write('{0:>{1}} {2}'.format(firstname,i, lastname))
                    editor.appendText('{0:>{1}} {2}'.format(firstname,i, lastname))
                

                Cheers
                Claudia

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

                  Hello, Claudia,

                  Yes, you’re absolutely right ! I should have a try of this powerful plugin, taking some time to fully study it, instead of jumping from one N++ version to another one, rather using basic features !

                  I also saw your detailed reply to pwnotepaduser, from :

                  https://notepad-plus-plus.org/community/topic/10882/feature-request-copy-line-with-number/6

                  Everyone can notice that very few lines, of that scripting tool, are enough to get a complete new feature, from inside N++ :-)


                  However, I, sometimes, find hard to get back to “real life”, while using N++. So, I’m just afraid it would be worse, using the Python Script plugin, which can help everyone to really customize its own Notepad++ ! Of course, I’m a bit joking… but not only !

                  BTW, I haven’t heard of you, on N++ forums, for quite a long time. So, it’s nice that you’re back again ! And, thanks for the active and valuable support you give to many N++ users :-))

                  Cheers,

                  guy038

                  1 Reply Last reply Reply Quote 0
                  • Claudia FrankC
                    Claudia Frank
                    last edited by Claudia Frank

                    Hi guy038,

                    thank you for your kind words. You’re right, I was a bit lazy in the past.
                    Mainly in the virtual world, real life was/is stressful enough ;-)

                    It’s nice to see that you are still having that patience to answer in such
                    elaborated way. Astonishing. Is there anything you can’t do with RegEx? ;-)
                    Maybe cooking??

                    Keep your good mood.

                    Cheers
                    Claudia

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

                      Hi, Claudia,

                      No, no, you’re wrong about regexes ! Of course, cooking is possible with regexes : See, below, that wonderful cake, only made of special regex characters, except for the regular slash !!!

                      •-------------------------------------------------------------•
                      |                                                             |
                      |                            {+}                              |
                      |                    \      ({^})       \                     |
                      |          /        / )      \ /       / )    {^}             |
                      |         ( \      | /       .|.      | /    ({+})            |
                      |          \ |     .|.       | |      .|.     \ /             |
                      |          .|.     | |       | |      | |     .|.             |
                      |          | |     | |       | |      | |     | |             |
                      |          | |     | |+*****+| |+****+| |     | |             |
                      |          | |+***+| |       | |      | |+***+| |             |
                      |        +*| |     | |                | |     | |+***+        |
                      |       +  | |     | |                | |     | |     +       |
                      |      *           | |    H  A  P  P  Y       | |      *      |
                      |      | *         | |                               * |      |
                      |      |  +***+        R  E  G  E  X  E  S  !   +***+  |      |
                      |      |$      +********+             +********+      $|      |
                      |      | $   $           +***********+           $   $ |      |
                      |      |  $ $ $    $                       $    $ $ $  |      |
                      |      |       $ $  $      $       $      $ $ $        |      |
                      |       +            $ $ $  $     $ $ $ $             +       |
                      |         +***+              $   $              +***+         |
                      |              +********+     $ $     +********+              |
                      |                        +***********+                        |
                      |                                                             |
                      •-------------------------------------------------------------•
                      

                      And, as we’re near Christmas time, let’s have, now, the candle’s flames animated :

                      • Copy / Paste that delicious cake in a new tab

                      • Open the Replace dialog ( CTRL + H )

                      • Set the Regular expression search mode

                      • Check, preferably, the Wrap around option

                      • Don’t care about the other options !

                      • Fill up the Search and Replace zones :

                        SEARCH ( \ )|( / ) )|( | / )|({^})|( / )|( ( \ )|( \ | )|({+})

                        REPLACE (?1 / )(?2 ( \ )(?3 \ | )(?4{+})(?5 \ )(?6 / ) )(?7 | / )(?8{^})

                      • Click on the Replace All button, repeatedly ( or press the ALT + A shortcut, for a quicker switch )

                      Et voilà ! Like kids, you’re quite filled with wonder, aren’t you ?


                      Of course ( as I’m certainly better in regexes than in drawing and painting ! ), I didn’t create this image. I just took the general frame, from a French site, about ASCII-Art, at the address below :

                      http://www.ascii-fr.com/-Anniversaire-.html

                      Best Regards,

                      guy038

                      1 Reply Last reply Reply Quote 0
                      • Claudia FrankC
                        Claudia Frank
                        last edited by

                        LOL LOL LOL LOL

                        Brilliant, I really tried it and had a lot of fun with it.
                        I even felt the heat :-D

                        So next time I have guests I serve coffee,
                        put a laptop on the table and let them choose a slice :-D

                        Hmm, so I have to think about a pythonish way. ;-)

                        Cheers
                        Claudia

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

                          Hi, Claudia,

                          Give a second try to my regex, because I slightly modified the cake and I needed to put the Search and Replace regexes like pure code, with black background, in order that consecutive space characters are NOT compacted in one space !

                          Otherwise, the regexes DON’T give the goods results !

                          Cheers,

                          guy038

                          1 Reply Last reply Reply Quote 0
                          • Claudia FrankC
                            Claudia Frank
                            last edited by

                            Hi guy038,

                            beautiful. So I don’t play spider solitare anymore
                            but will watch burning cake :-D

                            Cheers
                            Claudia

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