From 38e5a69c9ad0b6d2da7021c2c00e1db35d78fecd Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Fri, 29 Feb 2008 20:46:57 -0500 Subject: [PATCH] Copy and paste the clipboard with C-S-c and C-S-v --- src/command.C | 18 ++++++++++++++++++ src/rxvt.h | 2 +- src/screen.C | 15 ++++++++++++--- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/command.C b/src/command.C index 85f27d5..5386e43 100644 --- a/src/command.C +++ b/src/command.C @@ -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; diff --git a/src/rxvt.h b/src/rxvt.h index d2cda9e..c05c9fe 100644 --- a/src/rxvt.h +++ b/src/rxvt.h @@ -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; diff --git a/src/screen.C b/src/screen.C index 0f06e66..6eaeebd 100644 --- a/src/screen.C +++ b/src/screen.C @@ -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 -- 1.9.1