Community
    • Login

    File Specific word wrap (vs. global enable)

    Scheduled Pinned Locked Moved General Discussion
    feature requestword wrap
    22 Posts 7 Posters 14.6k 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.
    • guy038G
      guy038
      last edited by guy038

      Hi Claudia,

      I tested your changed script. It woks great, indeed ! Referring to my last try, each time I ran this new version of your script, the state of the word wrap option, for the current file was changed into the opposite state, even, when using two simultaneous views !

      And, when running the command, below :

      notepad.clearCallbacks([NOTIFICATION.BUFFERACTIVATED])
      

      In the Python console, I noticed that it sets the Word wrap state of the current document of each view, to all the opened documents of that associated view !

      Of course, after using the Python script, you can’t, seriously, rely on the visual appearance, of the Word Wrap button and/or the v indication, in menu View - Word wrap, as well as a click action, on this button/option !

      Just remember to use the Claudia script, exclusively, to get the right state of the Word Wrap ( or an other property ! ) that you want, for the current document !

      Thanks again, Claudia, for that nice Notepad++'s improvement !

      Cheers,

      guy038

      P.S :

      However, there’s, still, a limitation. For instance, if your create two ( almost ) identical scripts :

      • The first one, to modify a displaying property of the current document

      • The second one, to modify an OTHER property, of the current document

      The python script get confused and the properties can’t be set, simultaneously. Rather normal, however. We just have to be aware about this fact !

      1 Reply Last reply Reply Quote 0
      • Scott SumnerS
        Scott Sumner
        last edited by

        @Claudia-Frank 's FIRST Pythonscript in this thread really shines if the Wrap status is added to the status bar using the technique shown in the following thread: https://notepad-plus-plus.org/community/topic/13134/set-read-only-edit-function-feature-request. In that thread, the read-only status of the current file is shown (based upon a script in yet-another thread…sorry), but that can be modified to show the wrap status as follows:

        Change

        line_col_sel_info_for_sb = 'Ln : {user_line}     Col : {user_col}     Sel : {sel}     {ro}r'.format(
            user_line=curr_line+1,
            user_col=curr_col+1,
            sel=sel_part,
            ro='+' if editor.getReadOnly() else '-'
            )
        

        to

        line_col_sel_info_for_sb = 'Ln : {user_line}     Col : {user_col}     Sel : {sel}     {w}'.format(
            user_line=curr_line+1,
            user_col=curr_col+1,
            sel=sel_part,
            w='W' if editor.getWrapMode() == 1 else ''  # show 'W' in status bar if wrap mode is on for this file
            )
        
        Claudia FrankC 1 Reply Last reply Reply Quote 0
        • Claudia FrankC
          Claudia Frank @Scott Sumner
          last edited by

          Scott,

          don’t dig to deep to find my all of my youthful follies. ;-)

          Cheers
          Claudia

          Scott SumnerS 1 Reply Last reply Reply Quote 1
          • Scott SumnerS
            Scott Sumner @Claudia Frank
            last edited by

            @Claudia-Frank

            Yea, I can tell that is earlier code from you, but it works!

            1 Reply Last reply Reply Quote 0
            • Clyfton InC
              Clyfton In
              last edited by

              I know this topic old but I tried the referenced solution and could not get it to work.
              I went to PLUGINS > PYTHON SCRIPT > NEW SCRIPT and saved the example code as file_word_wrap.
              When I go to PLUGINS > PYTHON SCRIPT > SCRIPTS and click on file_word_wrap I get error: AN EXCEPTION OCCURRED DUE TO PLUGIN: PYTHONSCRIPT.DLL EXCEPTION REASON: ACCESS VIOLATION

              I also added …
              <Item PluginEntryName=“Python Script” PluginCommandItemName=“file_word_wrap” />
              … at the bottom of contextMenu.xml as instructed but did not see it as a right-click option.

              astrosofistaA 1 Reply Last reply Reply Quote 0
              • astrosofistaA
                astrosofista @Clyfton In
                last edited by

                Hi @Clyfton-In , All:

                I also know that this topic is old, but tried today the python script and it worked fine for me.

                The following picture includes the relevant code and highlights the status bar zone that shows the requested info:

                684b9764-8455-4a33-9904-674d5957fc55-imagen.png

                BR

                Alan KilbornA 1 Reply Last reply Reply Quote 3
                • Alan KilbornA
                  Alan Kilborn @astrosofista
                  last edited by

                  The Pythonscript is great and all, but this surely feels like something that should be offered as a feature in stock Notepad++. My 2c.

                  astrosofistaA 1 Reply Last reply Reply Quote 2
                  • astrosofistaA
                    astrosofista @Alan Kilborn
                    last edited by

                    @Alan-Kilborn

                    I think so. I also think that the regex indicators —not shown in my picture— are a nice and helpfull add-on.

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

                      @astrosofista said in File Specific word wrap (vs. global enable):

                      regex indicators

                      What “regex indicators” are you referring to? Did I miss something?

                      astrosofistaA 1 Reply Last reply Reply Quote 0
                      • astrosofistaA
                        astrosofista @Alan Kilborn
                        last edited by

                        @Alan-Kilborn said in File Specific word wrap (vs. global enable):

                        @astrosofista said in File Specific word wrap (vs. global enable):

                        regex indicators

                        What “regex indicators” are you referring to? Did I miss something?

                        Sorry, my wording wasn’t clear enough. I was referring to the regex metacharacters that Scott Sumner used to enrich the info about the selected characters and lines. They are listed here:

                        link text

                        Alan KilbornA 1 Reply Last reply Reply Quote 2
                        • Alan KilbornA Alan Kilborn referenced this topic on
                        • Alan KilbornA Alan Kilborn referenced this topic on
                        • Alan KilbornA
                          Alan Kilborn @astrosofista
                          last edited by

                          I revisit the original topic of this thread HERE.

                          1 Reply Last reply Reply Quote 0
                          • Alan KilbornA Alan Kilborn referenced this topic on
                          • First post
                            Last post
                          The Community of users of the Notepad++ text editor.
                          Powered by NodeBB | Contributors