Does prompt-toolkit have clipboard buffers? #1939
Replies: 1 comment
|
prompt-toolkit does have its own clipboard abstraction, and its default clipboard is already separate from the OS clipboard.
The system-synchronized behavior only happens if the application is configured with So for the behavior you describe, make sure the Xonsh integration is using an from prompt_toolkit.clipboard import InMemoryClipboard
from prompt_toolkit import PromptSession
session = PromptSession(clipboard=InMemoryClipboard())There is also a useful distinction here: terminal bracketed-paste / OS paste can still insert text into the prompt even though prompt-toolkit's vi kill/yank register is independent. Separating the clipboard therefore doesn't prevent normal Ctrl/terminal paste; it prevents prompt-toolkit's own delete/yank operations from overwriting the system clipboard. For Xonsh specifically, the remaining question is which clipboard implementation its prompt-toolkit shell instance supplies; that configuration belongs on the Xonsh side, but prompt-toolkit itself supports the separation directly. |
Uh oh!
There was an error while loading. Please reload this page.
I use Xonsh and they directed me here as it uses prompt-toolkit underneath.
I frequently with copy a string from an IDE or web browser to paste it into a Xonsh session in VI mode. I'll use normal mode's
c+word+t+<char>prior to pasting. This overwrites the clipboard buffer.is there a good approach to keep buffers separate so deleting/yanking in prompt-toolkit does not replace the system clipboard?
All reactions