Copy and paste the clipboard with C-S-c and C-S-v
authorDana Jansens <danakj@orodu.net>
Sat, 1 Mar 2008 01:46:57 +0000 (20:46 -0500)
committerDana Jansens <danakj@orodu.net>
Wed, 19 May 2010 18:13:28 +0000 (14:13 -0400)
src/command.C
src/rxvt.h
src/screen.C

index 85f27d5..5386e43 100644 (file)
@@ -598,6 +598,24 @@ rxvt_term::key_press (XKeyEvent &ev)
 # endif
               return;
             }
+          else if (keysym == XK_C)
+            {
+              selection_make (ev.time, true);
+# if ISO_14755
+              scr_overlay_off ();
+# endif
+              iso14755buf = 0;
+              return;
+            }
+          else if (keysym == XK_V)
+            {
+              selection_request (ev.time, Sel_Clipboard);
+# if ISO_14755
+              scr_overlay_off ();
+# endif
+              iso14755buf = 0;
+              return;
+            }
           else if (keysym == XK_BackSpace)
             {
               iso14755buf = ((iso14755buf & ISO_14755_MASK) >> 4) | ISO_14755_51;
index d2cda9e..c05c9fe 100644 (file)
@@ -1475,7 +1475,7 @@ struct rxvt_term : zero_initialized, rxvt_vars, rxvt_screen
   int selection_request_other (Atom target, int selnum) NOTHROW;
   void selection_clear (bool clipboard = false) NOTHROW;
   void clipboard_copy (Time tm);
-  void selection_make (Time tm);
+  void selection_make (Time tm, bool clipboard = false);
   bool selection_grab (Time tm, bool clipboard = false) NOTHROW;
   void selection_start_colrow (int col, int row) NOTHROW;
   void selection_delimit_word (enum page_dirn dirn, const row_col_t *mark, row_col_t *ret) NOTHROW;
index 0f06e66..6eaeebd 100644 (file)
@@ -2920,6 +2920,9 @@ rxvt_term::selection_request (Time tm, int selnum) NOTHROW
 #endif
     }
 
+  if (selnum == Sel_Clipboard)
+    return;
+
   selection_wait = Sel_none;       /* don't loop in selection_paste () */
   selection_paste (display->root, XA_CUT_BUFFER0, false);
 }
@@ -2995,15 +2998,21 @@ rxvt_term::clipboard_copy (Time tm)
 /* ------------------------------------------------------------------------- */
 /*
  * Copy a selection into the cut buffer
- * EXT: button 1 or 3 release
+ * EXT: button 1 or 3 release, or C-A-c key press
  */
 void
-rxvt_term::selection_make (Time tm)
+rxvt_term::selection_make (Time tm, bool clipboard)
 {
   int i;
   wchar_t *new_selection_text;
   text_t *t;
 
+  if (clipboard)
+    {
+      clipboard_copy(tm);
+      return;
+    }
+
   switch (selection.op)
     {
       case SELECTION_CONT:
@@ -3121,7 +3130,7 @@ rxvt_term::selection_make (Time tm)
   if (HOOK_INVOKE ((this, HOOK_SEL_GRAB, DT_LONG, (long)tm, DT_END)))
     return;
 
-  selection_grab (tm);
+  selection_grab (tm, clipboard);
 }
 
 bool