/* mask keysym function argument */
{ ControlMask, XK_Print, toggleprinter, {.i = 0} },
{ ShiftMask, XK_Print, printscreen, {.i = 0} },
+ { XK_ANY_MOD, XK_Print, printsel, {.i = 0} },
{ MODKEY|ShiftMask, XK_Prior, xzoom, {.i = +1} },
{ MODKEY|ShiftMask, XK_Next, xzoom, {.i = -1} },
{ ShiftMask, XK_Insert, selpaste, {.i = 0} },
static void numlock(const Arg *);
static void selpaste(const Arg *);
static void xzoom(const Arg *);
+static void printsel(const Arg *);
static void printscreen(const Arg *) ;
static void toggleprinter(const Arg *);
static int tattrset(int);
static void tprinter(char *s, size_t len);
+static void tdumpsel(void);
static void tdumpline(int);
static void tdump(void);
static void tclearregion(int, int, int, int);
static void selinit(void);
static void selsort(void);
static inline bool selected(int, int);
+static char *getsel(void);
static void selcopy(void);
static void selscroll(int, int);
static void selsnap(int, int *, int *, int);
}
}
-void
-selcopy(void) {
+char *
+getsel(void) {
char *str, *ptr;
int x, y, bufsize, size, i, ex;
Glyph *gp, *last;
}
*ptr = 0;
}
- xsetsel(str);
+ return str;
+}
+
+void
+selcopy(void) {
+ xsetsel(getsel());
}
void
case 1:
tdumpline(term.c.y);
break;
+ case 2:
+ tdumpsel();
+ break;
case 4:
term.mode &= ~MODE_PRINT;
break;
tdump();
}
+void
+printsel(const Arg *arg) {
+ tdumpsel();
+}
+
+void
+tdumpsel(void)
+{
+ char *ptr;
+
+ ptr = getsel();
+ tprinter(ptr, strlen(ptr));
+ free(ptr);
+}
+
void
tdumpline(int n) {
Glyph *bp, *end;