Make primary-selection unknown when not supported

This lfun will not appear in menus anymore in macOS and Windows.

Part of bug #12436.
This commit is contained in:
Jean-Marc Lasgouttes 2021-11-19 10:21:55 +01:00
parent b0983e1c5a
commit 2311f42f41
4 changed files with 8 additions and 1 deletions

View File

@ -3417,7 +3417,7 @@ void LyXAction::init()
/*!
* \var lyx::FuncCode lyx::LFUN_PRIMARY_SELECTION_PASTE
* \li Action: Pastes the currently selected text.
* \li Notion: Primary selection mechanism is linux-only thing.
* \li Notion: Primary selection mechanism is X11/Wayland-only thing.
* \li Syntax: primary-selection-paste [<ARG>]
* \li Params: <ARG>: "paragraph" will cause pasting as one paragraph, i.e. "Join lines".
* \endvar

View File

@ -3437,6 +3437,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
break;
case LFUN_PRIMARY_SELECTION_PASTE:
status.setUnknown(!theSelection().supported());
enable = cur.selection() || !theSelection().empty();
break;

View File

@ -27,6 +27,11 @@ class Selection
public:
virtual ~Selection() {}
/**
* Returns true if the underlying system supports mouse selection
* (basically X11 and Wayland).
*/
virtual bool supported() const = 0;
/**
* Tell the window system whether we set or cleared our selection.
* This is a noop on systems that don't have a selection.

View File

@ -34,6 +34,7 @@ public:
/** Selection overloaded methods
*/
//@{
bool supported() const override { return selection_supported_; }
void haveSelection(bool own) override;
docstring const get() const override;
void put(docstring const & str) override;