236 | 236 |
GMenu encodingMenu;
|
237 | 237 |
|
238 | 238 |
SimpleAction saCopy;
|
|
239 |
SimpleAction saCopyAsHtml;
|
239 | 240 |
SimpleAction saPaste;
|
240 | 241 |
SimpleAction saAdvancedPaste;
|
241 | 242 |
Popover pmContext;
|
|
517 | 518 |
vte.copyClipboard();
|
518 | 519 |
}
|
519 | 520 |
});
|
|
521 |
saCopyAsHtml = registerActionWithSettings(group, ACTION_PREFIX, ACTION_COPY_AS_HTML, gsShortcuts, delegate(GVariant, SimpleAction) {
|
|
522 |
if (vte.getHasSelection()) {
|
|
523 |
vte.copyClipboardFormat(VteFormat.HTML);
|
|
524 |
}
|
|
525 |
});
|
520 | 526 |
saPaste = registerActionWithSettings(group, ACTION_PREFIX, ACTION_PASTE, gsShortcuts, delegate(GVariant, SimpleAction) {
|
521 | 527 |
// Check to see if something other then terminal has focus
|
522 | 528 |
Window window = cast(Window) getToplevel();
|
|
1018 | 1024 |
event.getKeyval(keyval);
|
1019 | 1025 |
if ((keyval == GdkKeysyms.GDK_c) && (event.key.state & ModifierType.CONTROL_MASK)) {
|
1020 | 1026 |
string[] actions = tilix.getActionsForAccel("<Ctrl>c");
|
1021 | |
if (actions.length > 0 && actions[0] == getActionDetailedName(ACTION_PREFIX,ACTION_COPY) && !vte.getHasSelection()) {
|
|
1027 |
if (actions.length > 0 &&
|
|
1028 |
(actions[0] == getActionDetailedName(ACTION_PREFIX,ACTION_COPY) || actions[0] == getActionDetailedName(ACTION_PREFIX,ACTION_COPY_AS_HTML)) &&
|
|
1029 |
!vte.getHasSelection()) {
|
1022 | 1030 |
string controlc = "\u0003";
|
1023 | 1031 |
vte.feedChild(controlc, controlc.length);
|
1024 | 1032 |
return true;
|
|
1074 | 1082 |
pmContext.addOnClosed(delegate(Popover) {
|
1075 | 1083 |
// See #305 for more info on why this is here
|
1076 | 1084 |
saCopy.setEnabled(true);
|
|
1085 |
saCopyAsHtml.setEnabled(true);
|
1077 | 1086 |
saPaste.setEnabled(true);
|
1078 | 1087 |
});
|
1079 | 1088 |
|
|
1665 | 1674 |
GMenu clipSection = new GMenu();
|
1666 | 1675 |
if (!CLIPBOARD_BTN_IN_CONTEXT) {
|
1667 | 1676 |
clipSection.append(_("Copy"), getActionDetailedName(ACTION_PREFIX, ACTION_COPY));
|
|
1677 |
clipSection.append(_("Copy as HTML"), getActionDetailedName(ACTION_PREFIX, ACTION_COPY_AS_HTML));
|
1668 | 1678 |
clipSection.append(_("Paste"), getActionDetailedName(ACTION_PREFIX, ACTION_PASTE));
|
1669 | 1679 |
clipSection.append(_("Select All"), getActionDetailedName(ACTION_PREFIX, ACTION_SELECT_ALL));
|
1670 | 1680 |
mmContext.appendSection(null, clipSection);
|
|
1673 | 1683 |
copy.setAttributeValue("verb-icon", new GVariant("edit-copy-symbolic"));
|
1674 | 1684 |
copy.setAttributeValue("label", new GVariant(_("Copy")));
|
1675 | 1685 |
clipSection.appendItem(copy);
|
|
1686 |
|
|
1687 |
GMenuItem copyAsHTML = new GMenuItem(null, getActionDetailedName(ACTION_PREFIX, ACTION_COPY_AS_HTML));
|
|
1688 |
copyAsHTML.setAttributeValue("verb-icon", new GVariant("edit-copy-symbolic"));
|
|
1689 |
copyAsHTML.setAttributeValue("label", new GVariant(_("Copy as HTML")));
|
|
1690 |
clipSection.appendItem(copyAsHTML);
|
1676 | 1691 |
|
1677 | 1692 |
GMenuItem paste = new GMenuItem(null, getActionDetailedName(ACTION_PREFIX, ACTION_PASTE));
|
1678 | 1693 |
paste.setAttributeValue("verb-icon", new GVariant("edit-paste-symbolic"));
|
|
1820 | 1835 |
void showContextPopover(Event event = null) {
|
1821 | 1836 |
buildContextMenu();
|
1822 | 1837 |
saCopy.setEnabled(vte.getHasSelection());
|
|
1838 |
saCopyAsHtml.setEnabled(vte.getHasSelection());
|
1823 | 1839 |
saPaste.setEnabled(Clipboard.get(null).waitIsTextAvailable());
|
1824 | 1840 |
if (event !is null) {
|
1825 | 1841 |
GdkRectangle rect = GdkRectangle(to!int(event.button.x), to!int(event.button.y), 1, 1);
|