+ if (cmd.argument().empty()) {
+ if (theClipboard().isInternal())
+ enable = cap::numberOfSelections() > 0;
+ else
+ enable = !theClipboard().empty();
+ } else {
+ string const arg = to_utf8(cmd.argument());
+ if (isStrUnsignedInt(arg)) {
+ unsigned int n = convert<unsigned int>(arg);
+ enable = cap::numberOfSelections() > n;
+ } else
+ // unknown argument
+ enable = false;
+ }
+ break;
+
+ case LFUN_CLIPBOARD_PASTE:
+ enable = !theClipboard().empty();
+ break;
+
+ case LFUN_PRIMARY_SELECTION_PASTE:
+ enable = cur.selection() || !theSelection().empty();
+ break;
+
+ case LFUN_PARAGRAPH_MOVE_UP:
+ enable = cur.pit() > 0 && !cur.selection();
+ break;
+
+ case LFUN_PARAGRAPH_MOVE_DOWN:
+ enable = cur.pit() < cur.lastpit() && !cur.selection();
+ break;
+
+ case LFUN_INSET_DISSOLVE:
+ enable = !isMainText(*cur.bv().buffer()) && cur.inset().nargs() == 1;
+ break;
+
+ case LFUN_CHANGE_ACCEPT:
+ case LFUN_CHANGE_REJECT:
+ // TODO: context-sensitive enabling of LFUN_CHANGE_ACCEPT/REJECT
+ // In principle, these LFUNs should only be enabled if there
+ // is a change at the current position/in the current selection.
+ // However, without proper optimizations, this will inevitably
+ // result in unacceptable performance - just imagine a user who
+ // wants to select the complete content of a long document.
+ enable = true;
+ break;
+
+ case LFUN_WORD_DELETE_FORWARD:
+ case LFUN_WORD_DELETE_BACKWARD:
+ case LFUN_LINE_DELETE:
+ case LFUN_WORD_FORWARD:
+ case LFUN_WORD_BACKWARD:
+ case LFUN_CHAR_FORWARD:
+ case LFUN_CHAR_FORWARD_SELECT:
+ case LFUN_CHAR_BACKWARD:
+ case LFUN_CHAR_BACKWARD_SELECT: