Created
April 22, 2013 14:55
-
-
Save cclauss/5435710 to your computer and use it in GitHub Desktop.
Simple Pythonista utility script that you need to put this Pythonista Actions menu. It goes though the script currently open in the Pythonista Editor, converting all tab characters ('\t') into four space characters.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# replace ALL tab characters with four spaces | |
import editor, sys | |
theText = editor.get_text() | |
theCount = theText.count('\t') | |
if not theText.count('\t'): | |
print('no tabs found.') | |
sys.exit() | |
theLength = len(theText) | |
theText = theText.splitlines() | |
#theSelection = editor.get_selection() | |
for i in range(len(theText)): | |
theText[i] = theText[i].replace('\t', ' ') | |
editor.replace_text(0, theLength, '\n'.join(theText)) | |
#editor.set_selection(theSelection[0]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment