aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Edgar <medgar123@gmail.com>2013-10-05 11:49:35 +0200
committerRoberto E. Vargas Caballero <k0ga@shike2.com>2013-10-07 21:05:21 +0200
commit8e577322a3a55abf2f8226218ec87a7eec7fc3b1 (patch)
tree1d85600b28b7d80a255e533e0430d29a5c5a09a7
parent939e149544e4da958c333f3b6d00991d459c2e34 (diff)
downloadst-patched-8e577322a3a55abf2f8226218ec87a7eec7fc3b1.tar.bz2
st-patched-8e577322a3a55abf2f8226218ec87a7eec7fc3b1.tar.xz
st-patched-8e577322a3a55abf2f8226218ec87a7eec7fc3b1.zip
New ttysend() function calls ttywrite() and techo(). Honor MODE_ECHO when pasting in selnotify().
-rw-r--r--st.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/st.c b/st.c
index 16bf68b..9df6707 100644
--- a/st.c
+++ b/st.c
@@ -386,6 +386,7 @@ static inline bool match(uint, uint);
386static void ttynew(void); 386static void ttynew(void);
387static void ttyread(void); 387static void ttyread(void);
388static void ttyresize(void); 388static void ttyresize(void);
389static void ttysend(char *, size_t);
389static void ttywrite(const char *, size_t); 390static void ttywrite(const char *, size_t);
390 391
391static void xdraws(char *, Glyph, int, int, int, int); 392static void xdraws(char *, Glyph, int, int, int, int);
@@ -893,9 +894,7 @@ bpress(XEvent *e) {
893 for(mk = mshortcuts; mk < mshortcuts + LEN(mshortcuts); mk++) { 894 for(mk = mshortcuts; mk < mshortcuts + LEN(mshortcuts); mk++) {
894 if(e->xbutton.button == mk->b 895 if(e->xbutton.button == mk->b
895 && match(mk->mask, e->xbutton.state)) { 896 && match(mk->mask, e->xbutton.state)) {
896 ttywrite(mk->s, strlen(mk->s)); 897 ttysend(mk->s, strlen(mk->s));
897 if(IS_SET(MODE_ECHO))
898 techo(mk->s, strlen(mk->s));
899 return; 898 return;
900 } 899 }
901 } 900 }
@@ -1031,7 +1030,7 @@ selnotify(XEvent *e) {
1031 1030
1032 if(IS_SET(MODE_BRCKTPASTE)) 1031 if(IS_SET(MODE_BRCKTPASTE))
1033 ttywrite("\033[200~", 6); 1032 ttywrite("\033[200~", 6);
1034 ttywrite((const char *)data, nitems * format / 8); 1033 ttysend((char *)data, nitems * format / 8);
1035 if(IS_SET(MODE_BRCKTPASTE)) 1034 if(IS_SET(MODE_BRCKTPASTE))
1036 ttywrite("\033[201~", 6); 1035 ttywrite("\033[201~", 6);
1037 XFree(data); 1036 XFree(data);
@@ -1300,6 +1299,13 @@ ttywrite(const char *s, size_t n) {
1300} 1299}
1301 1300
1302void 1301void
1302ttysend(char *s, size_t n) {
1303 ttywrite(s, n);
1304 if(IS_SET(MODE_ECHO))
1305 techo(s, n);
1306}
1307
1308void
1303ttyresize(void) { 1309ttyresize(void) {
1304 struct winsize w; 1310 struct winsize w;
1305 1311
@@ -3584,10 +3590,7 @@ kpress(XEvent *ev) {
3584 3590
3585 /* 2. custom keys from config.h */ 3591 /* 2. custom keys from config.h */
3586 if((customkey = kmap(ksym, e->state))) { 3592 if((customkey = kmap(ksym, e->state))) {
3587 len = strlen(customkey); 3593 ttysend(customkey, strlen(customkey));
3588 ttywrite(customkey, len);
3589 if(IS_SET(MODE_ECHO))
3590 techo(customkey, len);
3591 return; 3594 return;
3592 } 3595 }
3593 3596
@@ -3606,9 +3609,7 @@ kpress(XEvent *ev) {
3606 len = 2; 3609 len = 2;
3607 } 3610 }
3608 } 3611 }
3609 ttywrite(buf, len); 3612 ttysend(buf, len);
3610 if(IS_SET(MODE_ECHO))
3611 techo(buf, len);
3612} 3613}
3613 3614
3614 3615