omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Show Lines Number

    Pythonista
    10
    16
    11065
    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.
    • mncfre
      mncfre last edited by

      Hi,

      A new Pythonista user here, is there a way to show the line numbers in the code editor?

      Thanks for your help.

      1 Reply Last reply Reply Quote 0
      • dgelessus
        dgelessus last edited by

        I'm not sure what you mean exactly... Pythonista always shows line numbers on the left side of the main editor, and it doesn't look like there's a way to disable that. If you're talking about the console window, it's not possible to show line numbers there. (Though I can't think of any situation where numbered lines in the console would be useful.)

        1 Reply Last reply Reply Quote 0
        • omz
          omz last edited by

          I guess you're running Pythonista on an iPhone? Line numbers are currently only supported on iPad, sorry.

          I might change that at some point, not sure yet – up until the iPhone 6/Plus, there simply wasn't enough room on the screen for line numbers, but on these bigger phones, it might make sense to show them optionally.

          1 Reply Last reply Reply Quote 1
          • zencuke
            zencuke last edited by

            @omz. Thanks. I Intentionally got 6 Plus hoping it would be easier for Pythonista editing. Already selection works much better. Landscape editing is possible now. The keypad is so big on the iphone5 in landscape mode only a couple of lines of text are visible. The difference between the 6+ and the mini-est ipad is not a lot at least height wise. Some features would work as well so thanks for considering it.

            1 Reply Last reply Reply Quote 0
            • mncfre
              mncfre last edited by

              Hi @omz I have an iPhone 5, it would be nice to have an option maybe in the keyboard special line that show/hide the line numbers, it would be useful and way more productive, thanks a lot everyone for your answers.

              1 Reply Last reply Reply Quote 0
              • Tizzy
                Tizzy last edited by

                I vote for line numbers. 6 plus here.

                1 Reply Last reply Reply Quote 0
                • Webmaster4o
                  Webmaster4o last edited by

                  I'm on a 5, I'd like at least an option for line numbers. I do most stuff on my iPad, but iPhone productivity is decreased because of this. When it throws a syntax error on line 65, but doesn't highlight and jump to it, I can't find line 65 without significant trouble.

                  1 Reply Last reply Reply Quote 0
                  • JonB
                    JonB last edited by JonB

                    I don't have an iphone to test this on, but you could try this:

                    # coding: utf-8
                    from objc_util import *
                    app=UIApplication.sharedApplication()
                    rootVC = app.keyWindow().rootViewController()
                    tabVC = rootVC.detailViewController()
                    tvc=tabVC.selectedTabViewController()
                    ed=tvc.editorView()
                    tv=ed.textView()
                    tv.showLineNumbers=not tv.showLineNumbers()
                    #not sure how to force a redraw.  changing frame size works
                    oldframe=tv.frame()
                    newframe=oldframe
                    newframe.size.width-=1
                    tv.frame=newframe
                    import time
                    time.sleep(0.1)
                    tv.frame=oldframe
                    

                    maybe use in an action script, and it should toggle line numbers in the current tab. Not sure if the view heirarchy is the same on iphone, so maybe this won't work.

                    antibody 1 Reply Last reply Reply Quote 5
                    • miwagner1
                      miwagner1 last edited by

                      This script is fantastic on my iPhone 6s. It even shows line wraps with a dot. This really needs to be added in a new update by default.

                      1 Reply Last reply Reply Quote 1
                      • Webmaster4o
                        Webmaster4o last edited by Webmaster4o

                        @JonB is there any way to change the color? Black really clashes with my theme. Also, can I make it flush with the edge of the editor?

                        1 Reply Last reply Reply Quote 1
                        • JonB
                          JonB last edited by

                          updated... https://gist.github.com/bbd5ef7e2e4010a631bd
                          background color works. I didn't bother messing with the gutterSeparatorView, but you should be able to adjust that color to match the theme ( i forget where the theme is actually stored)

                          note you cam change gutterWidth and the number font changes, so you can go as small as your eyes will work. 20 seems reasonable, the default seemed to be 35 on my ipad. I suppose I should put this inside a function so it does not mash globals, and you can toggle on/off as desired.

                          1 Reply Last reply Reply Quote 2
                          • Webmaster4o
                            Webmaster4o last edited by Webmaster4o

                            @JonB thanks. There's still black stripes around it, but they're not too obtrusive. This is also a relatively impermanent solution because it goes away after switching scripts

                            1 Reply Last reply Reply Quote 0
                            • brumm
                              brumm last edited by

                              I think a short description might be useful:

                              1. Touch the script name (togglelinenumbers.py)
                              2. Go to Actions (tool symbol)
                              3. Edit => + => Done => Done => Cancel
                              4. Open your script
                              5. Repeat step 1, 2 and run togglelinenumbers.py
                              1 Reply Last reply Reply Quote 0
                              • Webmaster4o
                                Webmaster4o last edited by

                                @brumm I understand. I just wish they were always on.

                                1 Reply Last reply Reply Quote 0
                                • antibody
                                  antibody @JonB last edited by

                                  @JonB

                                  Thank you very much!!
                                  Now I now where line 69 is with the run error.

                                  -=b=- (bert)

                                  Webmaster4o 1 Reply Last reply Reply Quote 0
                                  • Webmaster4o
                                    Webmaster4o @antibody last edited by

                                    @antibody Note that the better way to this is now as mentioned here

                                    1 Reply Last reply Reply Quote 0
                                    • First post
                                      Last post
                                    Powered by NodeBB Forums | Contributors