Created
November 25, 2012 10:31
-
-
Save GuyCarver/4143021 to your computer and use it in GitHub Desktop.
Pythonista editor script to paste clipboard to buffer.
This file contains hidden or 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
#paste clipboard to buffer. | |
import clipboard | |
import editor | |
cliptext = clipboard.get() | |
if cliptext != '': | |
text = editor.get_text() | |
selection = editor.get_selection() | |
selected_text = text[selection[0]:selection[1]] | |
replacement = cliptext + selected_text | |
editor.replace_text(selection[0], selection[1], replacement) | |
# editor.set_selection(selection[0], selection[0] + len(replacement) - 1) | |
# Paste the current clipboard text into the editor replacing the current selection. import clipboard, editor cliptext = clipboard.get() if cliptext: selection = editor.get_selection() editor.replace_text(selection[0], selection[1], cliptext)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I find it easier to paste with this command rather than attempting to use the popup menu.