• Login
Community
  • Login

How to add a gap between letters and border of N++ window?

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
25 Posts 9 Posters 2.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.
  • E
    Evgeny Morozov @Nick Brown
    last edited by Oct 15, 2020, 11:52 AM

    @Nick-Brown said in How to add a gap between letters and border of N++ window?:

    @Evgeny-Morozov

    using the Python Script plugin and the following

    editor.setMarginLeft(99)

    where 99 is the number of pixels for the left margin, the default is 1 pixel.

    It does not work for me…

    I added editor.setMarginLeft(99) in startup.py

    c9496913-8aef-4198-9e90-caad9164b28f-image.png

    and choosed ATSTARTUP option in confog window:

    eba44f65-2c76-4697-bdd7-de6523b3398e-image.png

    What do I do wrong?

    A 1 Reply Last reply Oct 15, 2020, 12:06 PM Reply Quote 0
    • A
      Alan Kilborn @Evgeny Morozov
      last edited by Oct 15, 2020, 12:06 PM

      @Evgeny-Morozov

      You probably don’t have any margin turned on, so setting a width doesn’t do much for you.

      Why not turn on the line-number or bookmark margins?

      I have trouble understanding why a small number of people are bothered by how close their text is to a window edge.

      1 Reply Last reply Reply Quote 0
      • T
        TroshinDV @Nick Brown
        last edited by Oct 15, 2020, 12:46 PM

        @Nick-Brown Screenshot_241.png

        A 1 Reply Last reply Oct 15, 2020, 12:54 PM Reply Quote 0
        • A
          Alan Kilborn @TroshinDV
          last edited by Oct 15, 2020, 12:54 PM

          @Дмитрий-Трошин

          Border Width doesn’t do anything for what seems to be the OP’s complaint. I’ll show you:

          Border Width = 2:

          Imgur

          Border Width = 30 (max):

          Imgur

          See how the b in blah has nothing like the “1 mm gap” the OP desires with EITHER border width setting?

          1 Reply Last reply Reply Quote 0
          • E
            Ekopalypse
            last edited by Ekopalypse Oct 15, 2020, 1:07 PM Oct 15, 2020, 1:06 PM

            @Alan-Kilborn said in How to add a gap between letters and border of N++ window?:

            You probably don’t have any margin turned on

            Curious, how would one do that? I was under the impression that the
            blank margin is always active.

            @Evgeny-Morozov
            Npp knows two editor objects named editor1 and editor2.
            editor points to one of those and is the current one used.
            Change your code to

            editor1.set...
            editor2.set...
            

            to be sure that both editor objects are affected. In addition I would recommend not to use the standard startup.py file but to create a user startup.py . Simply by using the PythonScript menu and choose New script and name it startup.py.

            Can you check if you see an error in the PythonScript console?
            Plugins->PythonScript->Show Console

            A E 2 Replies Last reply Oct 15, 2020, 2:50 PM Reply Quote 1
            • A
              ArkadiuszMichalski
              last edited by Oct 15, 2020, 1:23 PM

              https://github.com/notepad-plus-plus/notepad-plus-plus/issues/2323 << closed unnecessarily because the extra space may be important for some. You can ask to reopen.

              1 Reply Last reply Reply Quote 1
              • A
                Alan Kilborn @Ekopalypse
                last edited by Alan Kilborn Oct 15, 2020, 2:51 PM Oct 15, 2020, 2:50 PM

                Regarding:

                “You probably don’t have any margin turned on”

                @Ekopalypse said :

                Curious, how would one do that? I was under the impression that the
                blank margin is always active.

                What is this “blank margin”??

                So without any plugins that might create additional margins, I think N++ has 3 possible margins:

                1. Line number
                2. Bookmark
                3. Fold (for certain Language types, e.g. Python)

                If you have them all turned off, like this (see the red dots):

                6b059aba-e086-47a7-a7dd-21c4a096628a-image.png

                Then you have a “don’t have any margin turned on” situation – or maybe I’m misunderstanding something?

                1 Reply Last reply Reply Quote 2
                • E
                  Ekopalypse
                  last edited by Oct 15, 2020, 3:28 PM

                  @Alan-Kilborn

                  https://www.scintilla.org/ScintillaDoc.html#SCI_SETMARGINLEFT

                  uses the blank margin to insert space between the border and the text.
                  Hence the solution provided by @Nick-Brown should work and this
                  margin is not, as far as I know, related to the other “visible” margins.

                  A 1 Reply Last reply Oct 15, 2020, 3:39 PM Reply Quote 2
                  • A
                    Alan Kilborn @Ekopalypse
                    last edited by Alan Kilborn Oct 15, 2020, 3:41 PM Oct 15, 2020, 3:39 PM

                    @Ekopalypse

                    Ah, it is somewhat confusing because it isn’t a real “margin” like the others I called out.
                    So, apparently it was just that the OP had some sort of problem getting the Pythonscript solution to work.
                    Maybe should try a NppExec solution?

                    1 Reply Last reply Reply Quote 0
                    • E
                      Ekopalypse
                      last edited by Oct 15, 2020, 3:43 PM

                      Yes, took me some time to figure out that this isn’t one of the other
                      margins while I was testing it some time ago. :-)

                      1 Reply Last reply Reply Quote 1
                      • E
                        Evgeny Morozov @Ekopalypse
                        last edited by Oct 15, 2020, 4:19 PM

                        @Ekopalypse said in How to add a gap between letters and border of N++ window?:

                        @Alan-Kilborn said in How to add a gap between letters and border of N++ window?:

                        You probably don’t have any margin turned on

                        Curious, how would one do that? I was under the impression that the
                        blank margin is always active.

                        @Evgeny-Morozov
                        Npp knows two editor objects named editor1 and editor2.
                        editor points to one of those and is the current one used.
                        Change your code to

                        editor1.set...
                        editor2.set...
                        

                        to be sure that both editor objects are affected. In addition I would recommend not to use the standard startup.py file but to create a user startup.py . Simply by using the PythonScript menu and choose New script and name it startup.py.

                        Can you check if you see an error in the PythonScript console?
                        Plugins->PythonScript->Show Console

                        It does not work too. :((((

                        I created user scrypt startup.py .

                        Here is contents:

                        87c7027b-625b-4bff-afd7-5688f28cbebf-image.png

                        I restarted Notepad++
                        Run scrupt using menu:

                        e7f8f92c-abd3-411d-9c55-86e05f61fd9a-image.png

                        But there is still no space:
                        ff216fea-7565-46ee-b19d-65eaa29e0e25-image.png

                        Console is empty
                        247de44e-27a3-448d-a316-c42f07abe2c7-image.png

                        I enter commands manually:
                        6bc86517-d5eb-4b5d-b7f3-129e67a4dae1-image.png

                        But nothing happens

                        E 1 Reply Last reply Oct 15, 2020, 5:00 PM Reply Quote 0
                        • E
                          Ekopalypse @Evgeny Morozov
                          last edited by Oct 15, 2020, 5:00 PM

                          @Evgeny-Morozov

                          Can you post your debug-info, which is available from ? menu?

                          E 1 Reply Last reply Oct 15, 2020, 5:38 PM Reply Quote 1
                          • E
                            Evgeny Morozov @Ekopalypse
                            last edited by Oct 15, 2020, 5:38 PM

                            @Ekopalypse said in How to add a gap between letters and border of N++ window?:

                            @Evgeny-Morozov

                            Can you post your debug-info, which is available from ? menu?

                            Can you please explain there to find that debug info?

                            E 1 Reply Last reply Oct 15, 2020, 5:39 PM Reply Quote 1
                            • E
                              Ekopalypse @Evgeny Morozov
                              last edited by Oct 15, 2020, 5:39 PM

                              @Evgeny-Morozov

                              b3d5c721-8f4d-4b46-b790-d37521c520b9-image.png

                              E 1 Reply Last reply Oct 15, 2020, 6:06 PM Reply Quote 1
                              • E
                                Evgeny Morozov @Ekopalypse
                                last edited by Oct 15, 2020, 6:06 PM

                                @Ekopalypse said in How to add a gap between letters and border of N++ window?:

                                @Evgeny-Morozov

                                b3d5c721-8f4d-4b46-b790-d37521c520b9-image.png

                                Surprisingly it works!
                                Maybe I have not closed one txt file opened in N++

                                1 Reply Last reply Reply Quote 0
                                • E
                                  Ekopalypse
                                  last edited by Oct 15, 2020, 6:10 PM

                                  @Evgeny-Morozov

                                  Great that it works - still confused that calling the two methods from the console didn’t work.

                                  So the only other thing is that your user startup.py should only contain the two setMarginLeft… lines. The other stuff will get initialized from the standard startup.py .

                                  1 Reply Last reply Reply Quote 1
                                  • M
                                    Makwana Prahlad Banned
                                    last edited by Oct 16, 2020, 3:39 AM

                                    Hello,@Evgeny-Morozov

                                    Please follow this steps,To How to add a gap between letters and border of N++ window?

                                    Step 1:- Open your file in Notepad++
                                    Step 2:- Press Ctrl+H to open the Replace window.
                                    Step 3:- Change the “Search Mode” to Regular expression.
                                    Step 4:- In the “Find what” box, type (\n|^)
                                    Step 5:- In the “Replace with” box, type \1
                                    Step 6:- Then click “Replace All”

                                    Note: If you want tabs instead of spaces, a tab character can be typed with Alt+09

                                    I hope this information will be useful to you.
                                    Thank you.

                                    A 1 Reply Last reply Oct 16, 2020, 11:56 AM Reply Quote -4
                                    • A
                                      Alan Kilborn @Makwana Prahlad
                                      last edited by Oct 16, 2020, 11:56 AM

                                      Future readers: Please disregard the posting here (and anywhere else on this site) by @Makwana-Prahlad . It is talking about something irrelevant to the topic at hand.

                                      E 1 Reply Last reply Oct 17, 2020, 6:11 PM Reply Quote 2
                                      • E
                                        Ekopalypse @Alan Kilborn
                                        last edited by Oct 17, 2020, 6:11 PM

                                        @Alan-Kilborn

                                        If we consider how often the answers are far off, I start to think that this is a Bot/AI someone is testing against the forum.

                                        A 1 Reply Last reply Oct 17, 2020, 6:47 PM Reply Quote 1
                                        • A
                                          Alan Kilborn @Ekopalypse
                                          last edited by Oct 17, 2020, 6:47 PM

                                          @Ekopalypse

                                          Yea, I think I suggested that same thing in a prior time I posted something like my last post in this thread. What I don’t understand is why we haven’t banned this “thing”.

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