[hackers] [st] New ttysend() function calls ttywrite() and techo(). Honor MODE_ECHO when pasting in selnotify(). || Mark Edgar
commit 8e577322a3a55abf2f8226218ec87a7eec7fc3b1
Author: Mark Edgar <medgar123_AT_gmail.com>
Date: Sat Oct 5 11:49:35 2013 +0200
New ttysend() function calls ttywrite() and techo(). Honor MODE_ECHO when pasting in selnotify().
diff --git a/st.c b/st.c
index 16bf68b..9df6707 100644
--- a/st.c
+++ b/st.c
_AT_@ -386,6 +386,7 @@ static inline bool match(uint, uint);
static void ttynew(void);
static void ttyread(void);
static void ttyresize(void);
+static void ttysend(char *, size_t);
static void ttywrite(const char *, size_t);
static void xdraws(char *, Glyph, int, int, int, int);
_AT_@ -893,9 +894,7 @@ bpress(XEvent *e) {
for(mk = mshortcuts; mk < mshortcuts + LEN(mshortcuts); mk++) {
if(e->xbutton.button == mk->b
&& match(mk->mask, e->xbutton.state)) {
- ttywrite(mk->s, strlen(mk->s));
- if(IS_SET(MODE_ECHO))
- techo(mk->s, strlen(mk->s));
+ ttysend(mk->s, strlen(mk->s));
return;
}
}
_AT_@ -1031,7 +1030,7 @@ selnotify(XEvent *e) {
if(IS_SET(MODE_BRCKTPASTE))
ttywrite("[200~", 6);
- ttywrite((const char *)data, nitems * format / 8);
+ ttysend((char *)data, nitems * format / 8);
if(IS_SET(MODE_BRCKTPASTE))
ttywrite("[201~", 6);
XFree(data);
_AT_@ -1300,6 +1299,13 @@ ttywrite(const char *s, size_t n) {
}
void
+ttysend(char *s, size_t n) {
+ ttywrite(s, n);
+ if(IS_SET(MODE_ECHO))
+ techo(s, n);
+}
+
+void
ttyresize(void) {
struct winsize w;
_AT_@ -3584,10 +3590,7 @@ kpress(XEvent *ev) {
/* 2. custom keys from config.h */
if((customkey = kmap(ksym, e->state))) {
- len = strlen(customkey);
- ttywrite(customkey, len);
- if(IS_SET(MODE_ECHO))
- techo(customkey, len);
+ ttysend(customkey, strlen(customkey));
return;
}
_AT_@ -3606,9 +3609,7 @@ kpress(XEvent *ev) {
len = 2;
}
}
- ttywrite(buf, len);
- if(IS_SET(MODE_ECHO))
- techo(buf, len);
+ ttysend(buf, len);
}
Received on Tue Oct 15 2013 - 17:44:45 CEST
This archive was generated by hypermail 2.3.0
: Tue Oct 15 2013 - 17:48:38 CEST