aboutsummaryrefslogtreecommitdiff
path: root/st.c
diff options
context:
space:
mode:
Diffstat (limited to 'st.c')
-rw-r--r--st.c32
1 files changed, 29 insertions, 3 deletions
diff --git a/st.c b/st.c
index 9f9c161..c97712c 100644
--- a/st.c
+++ b/st.c
@@ -314,6 +314,7 @@ static void clippaste(const Arg *);
314static void numlock(const Arg *); 314static void numlock(const Arg *);
315static void selpaste(const Arg *); 315static void selpaste(const Arg *);
316static void xzoom(const Arg *); 316static void xzoom(const Arg *);
317static void printsel(const Arg *);
317static void printscreen(const Arg *) ; 318static void printscreen(const Arg *) ;
318static void toggleprinter(const Arg *); 319static void toggleprinter(const Arg *);
319 320
@@ -359,6 +360,7 @@ static void strreset(void);
359 360
360static int tattrset(int); 361static int tattrset(int);
361static void tprinter(char *s, size_t len); 362static void tprinter(char *s, size_t len);
363static void tdumpsel(void);
362static void tdumpline(int); 364static void tdumpline(int);
363static void tdump(void); 365static void tdump(void);
364static void tclearregion(int, int, int, int); 366static void tclearregion(int, int, int, int);
@@ -435,6 +437,7 @@ static void selrequest(XEvent *);
435static void selinit(void); 437static void selinit(void);
436static void selsort(void); 438static void selsort(void);
437static inline bool selected(int, int); 439static inline bool selected(int, int);
440static char *getsel(void);
438static void selcopy(void); 441static void selcopy(void);
439static void selscroll(int, int); 442static void selscroll(int, int);
440static void selsnap(int, int *, int *, int); 443static void selsnap(int, int *, int *, int);
@@ -955,8 +958,8 @@ bpress(XEvent *e) {
955 } 958 }
956} 959}
957 960
958void 961char *
959selcopy(void) { 962getsel(void) {
960 char *str, *ptr; 963 char *str, *ptr;
961 int x, y, bufsize, size, i, ex; 964 int x, y, bufsize, size, i, ex;
962 Glyph *gp, *last; 965 Glyph *gp, *last;
@@ -1015,7 +1018,12 @@ selcopy(void) {
1015 } 1018 }
1016 *ptr = 0; 1019 *ptr = 0;
1017 } 1020 }
1018 xsetsel(str); 1021 return str;
1022}
1023
1024void
1025selcopy(void) {
1026 xsetsel(getsel());
1019} 1027}
1020 1028
1021void 1029void
@@ -1994,6 +2002,9 @@ csihandle(void) {
1994 case 1: 2002 case 1:
1995 tdumpline(term.c.y); 2003 tdumpline(term.c.y);
1996 break; 2004 break;
2005 case 2:
2006 tdumpsel();
2007 break;
1997 case 4: 2008 case 4:
1998 term.mode &= ~MODE_PRINT; 2009 term.mode &= ~MODE_PRINT;
1999 break; 2010 break;
@@ -2295,6 +2306,21 @@ printscreen(const Arg *arg) {
2295} 2306}
2296 2307
2297void 2308void
2309printsel(const Arg *arg) {
2310 tdumpsel();
2311}
2312
2313void
2314tdumpsel(void)
2315{
2316 char *ptr;
2317
2318 ptr = getsel();
2319 tprinter(ptr, strlen(ptr));
2320 free(ptr);
2321}
2322
2323void
2298tdumpline(int n) { 2324tdumpline(int n) {
2299 Glyph *bp, *end; 2325 Glyph *bp, *end;
2300 2326