• boing

    When I have a file open, and using an external keyboard, I noticed that clicking a line in the currently open file causes the editor to “jump” (scroll down) automatically. The issue occurs whether I tap the screen or use the keyboard trackpad. For some reason it seems to scroll down so that the top line in the editor is four lines below the line I actually clicked / tapped. It’s almost like the behavior we see when the on-screen virtual keyboard is displayed when we select a line and the IDE automatically scrolls down so that the line we selected is not hidden by our action…but the on-screen keyboard is disabled / hidden when an external keyboard is present. Oddly, the issue does not occur when we have the library pane displayed (file explorer on the left of the IDE), everything works normally.

    I don’t know what is causing this; the only culprit I can think of is a recent update to IPadOS 15.
    Anyone else experiencing this issue?

    posted in Pythonista read more
  • boing

    I use the following method to comment out code using the keyboard. It works on single and multiple lines and you don’t need to select the whole line to comment it out.

    I used the examples provided with Pythonista to create an extension script:

    import editor, console
    script = editor.get_text()
    sel_start, sel_end = editor.get_line_selection()
    selected_text = script[sel_start:sel_end].splitlines()
    r = '\n'.join('#' + i for i in selected_text)
    editor.replace_text(sel_start, sel_end, r)

    From there, you can add the script as an IDE extension:
    click the wrench icon at the top-right of the window. The bottom section of the popup menu that appears is reserved for extensions. Click “Edit” then the “+” icon and browse and add the script you created in the previous step.

    You can comment out lines by selecting the wrench icon and clicking the newly added icon. You can also run the extension using your keyboard if it has the Apple “Command” and “Option” keys available. Hitting Command + Option + a number on the keyboard will trigger that script. So if the extension you added is the only extension script in your IDE, you would hit Command + Option + 1.

    It should only take a few minutes to set up and then you’re good to go.

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!