Community
    • Login

    starting the Line number with 0

    Scheduled Pinned Locked Moved General Discussion
    4 Posts 2 Posters 7.8k 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.
    • themine702T
      themine702
      last edited by

      i need notepad++ to start the line Count Margin with 0 so that it’s start counting By 0 and not by one 1(sry i dont know it’s name :3)

      i know it sounds silly but im using a personal language based on GoTo instead of : { }, so every time i have to make that Line-- in my head and after 3 years of doing this it would be realy cool if the line counting margin would start with 0

      Mikhail VM 2 Replies Last reply Reply Quote 0
      • Mikhail VM
        Mikhail V @themine702
        last edited by Mikhail V

        @themine702

        It seems to me it is not possible to set the starting line count for line numbers.
        One option is to set a text margin and fill it in.
        But it will require you manually reset the numbers each time you edit the document.
        Here is a PythonScript solution:

        editor.setMarginWidthN(3, 48)	# set last margin width
        editor.setMarginTypeN(3, 4)		# set last margin type to text
        total = editor.getLineCount() 		#  get lines total 
        
        for i in range (0,total):
        	mark = str(i)
        	editor.marginSetText(i, mark)
        

        If that works for you, then you can try to setup some event watch,
        so that happens automatically each time the document is edited.
        Auto filling might be tricky to get it work, or slow down the editor.
        I would try to watch for an event which fires when the total line
        count chages, but I am not sure about how exactly to do it.

        Or just reset run the fill when you save the document.

        1 Reply Last reply Reply Quote 1
        • Mikhail VM
          Mikhail V
          last edited by

          Just tested it, and it is really slow so better not do this if
          you have big files, it can hang NPP

          1 Reply Last reply Reply Quote 0
          • Mikhail VM
            Mikhail V @themine702
            last edited by Mikhail V

            @themine702
            By the way, why can’t you just use default numbering from 1?
            For example you have a file :
            (1) A+B
            (2) goto 1

            And then just use a script to save the file with appended line:
            (0) ; empty line
            (1) A + B
            (2) goto 1

            Or just pass the the compiler the file with appended “'\r\n” in the beginning.
            Or am I missing something?

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