Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add clipboard configuration option. Resolve #43. #85

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions examples/ptpython_config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from prompt_toolkit.filters import ViInsertMode
from prompt_toolkit.key_binding.input_processor import KeyPress
from prompt_toolkit.keys import Keys
from prompt_toolkit.clipboard.pyperclip import PyperclipClipboard
from pygments.token import Token

from ptpython.layout import CompletionVisualisation
Expand Down Expand Up @@ -156,6 +157,9 @@ def _(event):
b.insert_text(' ')
"""

# Use system clipboard.
repl.clipboard = PyperclipClipboard()


# Custom colorscheme for the UI. See `ptpython/layout.py` and
# `ptpython/style.py` for all possible tokens.
Expand Down
1 change: 1 addition & 0 deletions ptpython/python_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@ def create_application(self):
buffers=buffers,
key_bindings_registry=self.key_bindings_registry,
paste_mode=Condition(lambda cli: self.paste_mode),
clipboard=getattr(self, 'clipboard', None),
mouse_support=Condition(lambda cli: self.enable_mouse_support),
on_abort=AbortAction.RETRY,
on_exit=self._on_exit,
Expand Down