Skip to content

Instantly share code, notes, and snippets.

@jsbain
Created January 29, 2016 16:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsbain/bbd5ef7e2e4010a631bd to your computer and use it in GitHub Desktop.
Save jsbain/bbd5ef7e2e4010a631bd to your computer and use it in GitHub Desktop.
togglelinenumbers.py
# 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()
if tv.gutterView():
tv.gutterView().backgroundColor=tv.backgroundColor()
tv.gutterWidth=20 #adjust per preference. 35 is default
#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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment