Xinqi Bao's Git
projects
/
st.git
/ commitdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
patch
|
inline
| side by side (parent:
939e149
)
New ttysend() function calls ttywrite() and techo(). Honor MODE_ECHO when pasting...
author
Mark Edgar <
[email protected]
>
Sat, 5 Oct 2013 09:49:35 +0000
(11:49 +0200)
committer
Roberto E. Vargas Caballero <
[email protected]
>
Mon, 7 Oct 2013 19:05:21 +0000
(21:05 +0200)
st.c
patch
|
blob
|
history
diff --git
a/st.c
b/st.c
index
16bf68b
..
9df6707
100644
(file)
--- a/
st.c
+++ b/
st.c
@@
-386,6
+386,7
@@
static inline bool match(uint, uint);
static void ttynew(void);
static void ttyread(void);
static void ttyresize(void);
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);
static void ttywrite(const char *, size_t);
static void xdraws(char *, Glyph, int, int, int, int);
@@
-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)) {
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;
}
}
return;
}
}
@@
-1031,7
+1030,7
@@
selnotify(XEvent *e) {
if(IS_SET(MODE_BRCKTPASTE))
ttywrite("\033[200~", 6);
if(IS_SET(MODE_BRCKTPASTE))
ttywrite("\033[200~", 6);
- tty
write((const
char *)data, nitems * format / 8);
+ tty
send((
char *)data, nitems * format / 8);
if(IS_SET(MODE_BRCKTPASTE))
ttywrite("\033[201~", 6);
XFree(data);
if(IS_SET(MODE_BRCKTPASTE))
ttywrite("\033[201~", 6);
XFree(data);
@@
-1299,6
+1298,13
@@
ttywrite(const char *s, size_t n) {
die("write error on tty: %s\n", SERRNO);
}
die("write error on tty: %s\n", SERRNO);
}
+void
+ttysend(char *s, size_t n) {
+ ttywrite(s, n);
+ if(IS_SET(MODE_ECHO))
+ techo(s, n);
+}
+
void
ttyresize(void) {
struct winsize w;
void
ttyresize(void) {
struct winsize w;
@@
-3584,10
+3590,7
@@
kpress(XEvent *ev) {
/* 2. custom keys from config.h */
if((customkey = kmap(ksym, e->state))) {
/* 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;
}
return;
}
@@
-3606,9
+3609,7
@@
kpress(XEvent *ev) {
len = 2;
}
}
len = 2;
}
}
- ttywrite(buf, len);
- if(IS_SET(MODE_ECHO))
- techo(buf, len);
+ ttysend(buf, len);
}
}