Skip to content

Commit 3bf8958

Browse files
committed
Add clipboard configuration option. Resolve #43.
1 parent 0f9f701 commit 3bf8958

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

examples/ptpython_config/config.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"""
66
from __future__ import unicode_literals
77
from prompt_toolkit.keys import Keys
8+
from prompt_toolkit.clipboard.pyperclip import PyperclipClipboard
89
from pygments.token import Token
910
from ptpython.layout import CompletionVisualisation
1011

@@ -138,6 +139,9 @@ def _(event):
138139
b.insert_text(' ')
139140
"""
140141

142+
# Use system clipboard.
143+
repl.clipboard = PyperclipClipboard()
144+
141145

142146
# Custom colorscheme for the UI. See `ptpython/layout.py` and
143147
# `ptpython/style.py` for all possible tokens.

ptpython/python_input.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,7 @@ def create_application(self):
504504
buffers=buffers,
505505
key_bindings_registry=self.key_bindings_registry,
506506
paste_mode=Condition(lambda cli: self.paste_mode),
507+
clipboard=getattr(self, 'clipboard', None),
507508
mouse_support=Condition(lambda cli: self.enable_mouse_support),
508509
on_abort=AbortAction.RETRY,
509510
on_exit=self._on_exit,

0 commit comments

Comments
 (0)