Codebase list tilix / ed3cb79
Fix #1216 gnunn1 6 years ago
4 changed file(s) with 28 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
10891089 <default>'&lt;Ctrl&gt;&lt;Shift&gt;c'</default>
10901090 <summary>Keyboard shortcut to copy selected text in terminal</summary>
10911091 </key>
1092 <key name="terminal-copy-as-html" type="s">
1093 <default>'disabled'</default>
1094 <summary>Keyboard shortcut to copy selected text in terminal as HTML</summary>
1095 </key>
10921096 <key name="terminal-paste" type="s">
10931097 <default>'&lt;Ctrl&gt;&lt;Shift&gt;v'</default>
10941098 <summary>Keyboard shortcut to paste text in terminal from clipboard</summary>
383383 </object>
384384 </child>
385385 <child>
386 <object class="GtkShortcutsShortcut" id ="terminal-copy-as-html">
387 <property name="visible">1</property>
388 <property name="title" translatable="yes" context="shortcut window">Copy As HTML</property>
389 </object>
390 </child>
391 <child>
386392 <object class="GtkShortcutsShortcut" id ="terminal-paste">
387393 <property name="visible">1</property>
388394 <property name="title" translatable="yes" context="shortcut window">Paste</property>
1818 enum ACTION_RESET = "reset";
1919 enum ACTION_RESET_AND_CLEAR = "reset-and-clear";
2020 enum ACTION_COPY = "copy";
21 enum ACTION_COPY_AS_HTML = "copy-as-html";
2122 enum ACTION_PASTE = "paste";
2223 enum ACTION_PASTE_PRIMARY = "paste-primary";
2324 enum ACTION_ADVANCED_PASTE = "advanced-paste";
236236 GMenu encodingMenu;
237237
238238 SimpleAction saCopy;
239 SimpleAction saCopyAsHtml;
239240 SimpleAction saPaste;
240241 SimpleAction saAdvancedPaste;
241242 Popover pmContext;
517518 vte.copyClipboard();
518519 }
519520 });
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 });
520526 saPaste = registerActionWithSettings(group, ACTION_PREFIX, ACTION_PASTE, gsShortcuts, delegate(GVariant, SimpleAction) {
521527 // Check to see if something other then terminal has focus
522528 Window window = cast(Window) getToplevel();
10181024 event.getKeyval(keyval);
10191025 if ((keyval == GdkKeysyms.GDK_c) && (event.key.state & ModifierType.CONTROL_MASK)) {
10201026 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()) {
10221030 string controlc = "\u0003";
10231031 vte.feedChild(controlc, controlc.length);
10241032 return true;
10741082 pmContext.addOnClosed(delegate(Popover) {
10751083 // See #305 for more info on why this is here
10761084 saCopy.setEnabled(true);
1085 saCopyAsHtml.setEnabled(true);
10771086 saPaste.setEnabled(true);
10781087 });
10791088
16651674 GMenu clipSection = new GMenu();
16661675 if (!CLIPBOARD_BTN_IN_CONTEXT) {
16671676 clipSection.append(_("Copy"), getActionDetailedName(ACTION_PREFIX, ACTION_COPY));
1677 clipSection.append(_("Copy as HTML"), getActionDetailedName(ACTION_PREFIX, ACTION_COPY_AS_HTML));
16681678 clipSection.append(_("Paste"), getActionDetailedName(ACTION_PREFIX, ACTION_PASTE));
16691679 clipSection.append(_("Select All"), getActionDetailedName(ACTION_PREFIX, ACTION_SELECT_ALL));
16701680 mmContext.appendSection(null, clipSection);
16731683 copy.setAttributeValue("verb-icon", new GVariant("edit-copy-symbolic"));
16741684 copy.setAttributeValue("label", new GVariant(_("Copy")));
16751685 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);
16761691
16771692 GMenuItem paste = new GMenuItem(null, getActionDetailedName(ACTION_PREFIX, ACTION_PASTE));
16781693 paste.setAttributeValue("verb-icon", new GVariant("edit-paste-symbolic"));
18201835 void showContextPopover(Event event = null) {
18211836 buildContextMenu();
18221837 saCopy.setEnabled(vte.getHasSelection());
1838 saCopyAsHtml.setEnabled(vte.getHasSelection());
18231839 saPaste.setEnabled(Clipboard.get(null).waitIsTextAvailable());
18241840 if (event !is null) {
18251841 GdkRectangle rect = GdkRectangle(to!int(event.button.x), to!int(event.button.y), 1, 1);