Repository navigation
Eliminate Paste Mode #43
Description
Activity
Hi @ryneeverett
How would you distinguish between a user pasting text and a user typing text? As far as i know from the application's point of view there is no difference.
It's like Vi also has a:set pasteoption.In paste mode, automatic indentation is off. This will paste verbatim and not insert additional spaces.
Jonathan
@jonathanslenders Got it. I understand why it is currently needed. But couldn't we bind
y,p, etc. to clipboard operations?That could be possible, but system clipboard synchronisation is hard to do correctly without using libraries like gtk or qt. I prefer to not depend on this for now.
@jonathanslenders Have you seen pyperclip? It's cross platform, lean (~200 loc), and appears to depend on any one of xclip, xsel, gtk, or qt on Linux. Would you be open to adding pyperclip as a dependency?
Yes, I have seen that. I'm not going to add another dependency, but I'll try to create an example of how to create an extension using this clipboard.
You can pass in any clipboard object in prompt-toolkit: https://github.com/jonathanslenders/python-prompt-toolkit/blob/master/prompt_toolkit/application.py#L49 I'll try to update ptpython, so that you can pass that through.
Is it possible to add this in via some configuration? or would it require a fork as of today?
This is work in progress. I'm going to make this easier.
A PyperclipClipboard is already in prompt-toolkit: https://github.com/jonathanslenders/python-prompt-toolkit/blob/master/examples/system-clipboard-integration.py
Sweet! The example implementation looks pretty good.
It doesn't appear that there is any way to override the clipboard without forking ptpython so I'm assuming such a mechanism is forthcoming.
- added a commit that references this issue
on Dec 3, 2015 A tip for my fellow
viusers:repl.enable_open_in_editor = False.- added a commit that references this issue
on Dec 15, 2016 Wouldn't bracketed paste be useful here?
I'm sure there's a history behind it and a good rationale for initially adding it, but is there any possibility of getting rid of it? I'd prefer to not have to choose between clipboard access and "returning".