Skip to content

Commit 21ca02f

Browse files
committed
Add clipboard configuration option. Resolve #43.
1 parent 45c37bb commit 21ca02f

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

examples/ptpython_config/config.py

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from prompt_toolkit.filters import ViInsertMode
88
from prompt_toolkit.key_binding.input_processor import KeyPress
99
from prompt_toolkit.keys import Keys
10+
from prompt_toolkit.clipboard.pyperclip import PyperclipClipboard
1011
from pygments.token import Token
1112

1213
from ptpython.layout import CompletionVisualisation
@@ -156,6 +157,9 @@ def _(event):
156157
b.insert_text(' ')
157158
"""
158159

160+
# Use system clipboard.
161+
repl.clipboard = PyperclipClipboard()
162+
159163

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

ptpython/python_input.py

+1
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,7 @@ def create_application(self):
515515
buffers=buffers,
516516
key_bindings_registry=self.key_bindings_registry,
517517
paste_mode=Condition(lambda cli: self.paste_mode),
518+
clipboard=getattr(self, 'clipboard', None),
518519
mouse_support=Condition(lambda cli: self.enable_mouse_support),
519520
on_abort=AbortAction.RETRY,
520521
on_exit=self._on_exit,

0 commit comments

Comments
 (0)