Skip to content

enter_to_paste=True makes both Enter and Shift+Enter paste #19

Description

@dcaixinha

First of all, thanks for this great package 🙌

One issue that I currently have is that with enter_to_paste=True, both Enter and Shift+Enter paste. No setting gives "Enter pastes, Shift+Enter copies-only".

keyboard_mixin.py hardcodes plain Enter, and clipboard_mixin.py (~L269) short-circuits on ENTER_TO_PASTE:

# keyboard_mixin.py
(False, False, KEY_Return): lambda: self._handle_return(False),             # Enter
(False, True,  KEY_Return): lambda: self._handle_return(not ENTER_TO_PASTE) # Shift+Enter
# clipboard_mixin.py
if ENTER_TO_PASTE or with_paste_simulation:  # paste
False True
Enter copy paste
Shift+Enter paste paste

I'd like for the two keys to be the inverse — True → Enter pastes / Shift+Enter copies-only; False → vice versa, so that I can have the default be to paste, but then have an escape hatch with Shift+Enter to not paste on certain cases.

The fix I see is to bind plain Enter to _handle_return(ENTER_TO_PASTE) and drop the ENTER_TO_PASTE or short-circuit.

Would you accept a PR with this change? And if so, should it be a new configuration field, or when people enable enter_to_paste we always make Shift+Enter not paste?

Version: 0.9.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions