summaryrefslogtreecommitdiff
path: root/erts/emulator/drivers
diff options
context:
space:
mode:
authorDan Gudmundsson <dgud@erlang.org>2017-08-23 08:20:54 +0200
committerDan Gudmundsson <dgud@erlang.org>2017-08-23 08:20:54 +0200
commit6016375096c293925c42d73cbbb72e29e5c38131 (patch)
tree242c20bf2d2c8fe6240732b4f3089bc5172c0da7 /erts/emulator/drivers
parent00300bf14f2806d6272bfb215efb8fade5e23f7f (diff)
parent557a20b04e9e9c379295ca666e94658abcfbc1e3 (diff)
downloaderlang-6016375096c293925c42d73cbbb72e29e5c38131.tar.gz
Merge branch 'maint'
* maint: Fix ANSI support in the console
Diffstat (limited to 'erts/emulator/drivers')
-rw-r--r--erts/emulator/drivers/unix/ttsl_drv.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/erts/emulator/drivers/unix/ttsl_drv.c b/erts/emulator/drivers/unix/ttsl_drv.c
index bce097d944..f3c1aa1c4a 100644
--- a/erts/emulator/drivers/unix/ttsl_drv.c
+++ b/erts/emulator/drivers/unix/ttsl_drv.c
@@ -1094,15 +1094,13 @@ static int insert_buf(byte *s, int n)
lbuf[lpos++] = (CONTROL_TAG | ((Uint32) ch));
ch = 0;
} while (lpos % 8);
- } else if (ch == '\e' || ch == '\n' || ch == '\r') {
+ } else if (ch == '\e') {
+ lbuf[lpos++] = (CONTROL_TAG | ((Uint32) ch));
+ } else if (ch == '\n' || ch == '\r') {
write_buf(lbuf + buffpos, lpos - buffpos);
- if (ch == '\e') {
- outc('\e');
- } else {
outc('\r');
if (ch == '\n')
outc('\n');
- }
if (llen > lpos) {
memcpy(lbuf, lbuf + lpos, llen - lpos);
}
@@ -1150,14 +1148,17 @@ static int write_buf(Uint32 *s, int n)
}
--n;
++s;
- }
- else if (*s == (CONTROL_TAG | ((Uint32) '\t'))) {
+ } else if (*s == (CONTROL_TAG | ((Uint32) '\t'))) {
outc(lastput = ' ');
--n; s++;
while (n > 0 && *s == CONTROL_TAG) {
outc(lastput = ' ');
--n; s++;
}
+ } else if (*s == (CONTROL_TAG | ((Uint32) '\e'))) {
+ outc('\e');
+ --n;
+ ++s;
} else if (*s & CONTROL_TAG) {
outc('^');
outc(lastput = ((byte) ((*s == 0177) ? '?' : *s | 0x40)));