X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=st.c;h=5e8cf0256550ea8a729e4f8da2c563afc1ae911c;hb=121d9109e8202aaa8df836f2d23922008bdf2c72;hp=fd5e0fd408402481db2dea46dd2e185c1e2435c4;hpb=f2da43a0b66f76532ebef5ed2b2c9135aca771a5;p=st.git diff --git a/st.c b/st.c index fd5e0fd..5e8cf02 100644 --- a/st.c +++ b/st.c @@ -77,6 +77,7 @@ enum glyph_attribute { ATTR_BOLD = 4, ATTR_GFX = 8, ATTR_ITALIC = 16, + ATTR_BLINK = 32, }; enum cursor_movement { @@ -551,7 +552,6 @@ bpress(XEvent *e) { sel.mode = 1; sel.ex = sel.bx = X2COL(e->xbutton.x); sel.ey = sel.by = Y2ROW(e->xbutton.y); - draw(); } } @@ -801,9 +801,15 @@ ttynew(void) { close(s); cmdfd = m; signal(SIGCHLD, sigchld); - if(opt_io && !(fileio = fopen(opt_io, "w"))) { - fprintf(stderr, "Error opening %s:%s\n", - opt_io, strerror(errno)); + if(opt_io) { + if(!strcmp(opt_io, "-")) { + fileio = stdout; + } else { + if(!(fileio = fopen(opt_io, "w"))) { + fprintf(stderr, "Error opening %s:%s\n", + opt_io, strerror(errno)); + } + } } } } @@ -1128,7 +1134,7 @@ tsetattr(int *attr, int l) { switch(attr[i]) { case 0: term.c.attr.mode &= ~(ATTR_REVERSE | ATTR_UNDERLINE | ATTR_BOLD \ - | ATTR_ITALIC); + | ATTR_ITALIC | ATTR_BLINK); term.c.attr.fg = DefaultFG; term.c.attr.bg = DefaultBG; break; @@ -1141,6 +1147,9 @@ tsetattr(int *attr, int l) { case 4: term.c.attr.mode |= ATTR_UNDERLINE; break; + case 5: + term.c.attr.mode |= ATTR_BLINK; + break; case 7: term.c.attr.mode |= ATTR_REVERSE; break; @@ -1153,6 +1162,9 @@ tsetattr(int *attr, int l) { case 24: term.c.attr.mode &= ~ATTR_UNDERLINE; break; + case 25: + term.c.attr.mode &= ~ATTR_BLINK; + break; case 27: term.c.attr.mode &= ~ATTR_REVERSE; break; @@ -1504,6 +1516,9 @@ strhandle(void) { break; } break; + case 'k': /* old title set compatibility */ + XStoreName(xw.dpy, xw.win, strescseq.buf); + break; case 'P': /* DSC -- Device Control String */ case '_': /* APC -- Application Program Command */ case '^': /* PM -- Privacy Message */ @@ -1619,6 +1634,7 @@ tputc(char *c) { case '_': /* APC -- Application Program Command */ case '^': /* PM -- Privacy Message */ case ']': /* OSC -- Operating System Command */ + case 'k': /* old title set compatibility */ strreset(); strescseq.type = ascii; term.esc |= ESC_STR; @@ -1928,6 +1944,17 @@ xinit(void) { die("Can't open display\n"); xw.scr = XDefaultScreen(xw.dpy); + /* font */ + initfonts(FONT, BOLDFONT, ITALICFONT); + + /* XXX: Assuming same size for bold font */ + xw.cw = dc.font.rbearing - dc.font.lbearing; + xw.ch = dc.font.ascent + dc.font.descent; + + /* colors */ + xw.cmap = XDefaultColormap(xw.dpy, xw.scr); + xloadcols(); + /* adjust fixed window geometry */ if(xw.isfixed) { sw = DisplayWidth(xw.dpy, xw.scr); @@ -1947,17 +1974,6 @@ xinit(void) { xw.fy = 0; } - /* font */ - initfonts(FONT, BOLDFONT, ITALICFONT); - - /* XXX: Assuming same size for bold font */ - xw.cw = dc.font.rbearing - dc.font.lbearing; - xw.ch = dc.font.ascent + dc.font.descent; - - /* colors */ - xw.cmap = XDefaultColormap(xw.dpy, xw.scr); - xloadcols(); - attrs.background_pixel = dc.col[DefaultBG]; attrs.border_pixel = dc.col[DefaultBG]; attrs.bit_gravity = NorthWestGravity;