commit - cfc7acdfd923924ae150a32061fb95987697b159
commit + 52d6fb1ab1f7d41839edebb63c3408578cd44e3c
blob - b7e215e7841ab5de18726ce8b2ca3c1309143773
blob + 7d546da077538f2d15acebcce81548ef7517eec2
--- st.c
+++ st.c
}
void
-ttywrite(const char *s, size_t n)
+ttywrite(const char *s, size_t n, int may_echo)
{
fd_set wfd, rfd;
ssize_t r;
size_t lim = 256;
+ if (may_echo && IS_SET(MODE_ECHO))
+ twrite(s, n, 1);
+
/*
* Remember that we are using a pty, which might be a modem line.
* Writing too much will clog the line. That's why we are doing this
}
void
-ttysend(char *s, size_t n)
-{
- ttywrite(s, n);
- if (IS_SET(MODE_ECHO))
- twrite(s, n, 1);
-}
-
-void
ttyresize(int tw, int th)
{
struct winsize w;
break;
case 'c': /* DA -- Device Attributes */
if (csiescseq.arg[0] == 0)
- ttywrite(vtiden, strlen(vtiden));
+ ttywrite(vtiden, strlen(vtiden), 0);
break;
case 'C': /* CUF -- Cursor <n> Forward */
case 'a': /* HPR -- Cursor <n> Forward */
if (csiescseq.arg[0] == 6) {
len = snprintf(buf, sizeof(buf),"\033[%i;%iR",
term.c.y+1, term.c.x+1);
- ttywrite(buf, len);
+ ttywrite(buf, len, 0);
}
break;
case 'r': /* DECSTBM -- Set Scrolling Region */
(*e != '\n' && *e != '\0'))
return;
- ttysend(uc, utf8encode(utf32, uc));
+ ttywrite(uc, utf8encode(utf32, uc), 1);
}
void
case 0x99: /* TODO: SGCI */
break;
case 0x9a: /* DECID -- Identify Terminal */
- ttywrite(vtiden, strlen(vtiden));
+ ttywrite(vtiden, strlen(vtiden), 0);
break;
case 0x9b: /* TODO: CSI */
case 0x9c: /* TODO: ST */
}
break;
case 'Z': /* DECID -- Identify Terminal */
- ttywrite(vtiden, strlen(vtiden));
+ ttywrite(vtiden, strlen(vtiden), 0);
break;
case 'c': /* RIS -- Reset to inital state */
treset();
blob - a34e31c5d3f61bdae7419e5be880460bd1b6dc10
blob + d7738a090f623117183ed521d1136f460c2d0e32
--- st.h
+++ st.h
void ttynew(char *, char *, char **);
size_t ttyread(void);
void ttyresize(int, int);
-void ttysend(char *, size_t);
-void ttywrite(const char *, size_t);
+void ttywrite(const char *, size_t, int);
void resettitle(void);
blob - a7f619eee3ee0fce1d7723c8f0b401d40f256601
blob + 49a22e4c7474133291388bafc203ffaa15aff1b9
--- x.c
+++ x.c
return;
}
- ttywrite(buf, len);
+ ttywrite(buf, len, 0);
}
void
for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) {
if (e->xbutton.button == ms->b
&& match(ms->mask, e->xbutton.state)) {
- ttysend(ms->s, strlen(ms->s));
+ ttywrite(ms->s, strlen(ms->s), 1);
return;
}
}
}
if (IS_SET(MODE_BRCKTPASTE) && ofs == 0)
- ttywrite("\033[200~", 6);
- ttysend((char *)data, nitems * format / 8);
+ ttywrite("\033[200~", 6, 0);
+ ttywrite((char *)data, nitems * format / 8, 1);
if (IS_SET(MODE_BRCKTPASTE) && rem == 0)
- ttywrite("\033[201~", 6);
+ ttywrite("\033[201~", 6, 0);
XFree(data);
/* number of 32-bit chunks returned */
ofs += nitems * format / 32;
win.state |= WIN_FOCUSED;
xseturgency(0);
if (IS_SET(MODE_FOCUS))
- ttywrite("\033[I", 3);
+ ttywrite("\033[I", 3, 0);
} else {
XUnsetICFocus(xw.xic);
win.state &= ~WIN_FOCUSED;
if (IS_SET(MODE_FOCUS))
- ttywrite("\033[O", 3);
+ ttywrite("\033[O", 3, 0);
}
}
/* 2. custom keys from config.h */
if ((customkey = kmap(ksym, e->state))) {
- ttysend(customkey, strlen(customkey));
+ ttywrite(customkey, strlen(customkey), 1);
return;
}
len = 2;
}
}
- ttysend(buf, len);
+ ttywrite(buf, len, 1);
}