aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Lohmann <20h@r-36.net>2012-09-02 19:43:29 +0200
committerChristoph Lohmann <20h@r-36.net>2012-09-02 19:43:29 +0200
commit7f17a70834961cd1ff748b2621c6fc87c069be22 (patch)
tree322efba019c282e9f08af32473b157bf882b920c
parent588ba51a539d18de5f9497a38ab7875e7b3e1429 (diff)
downloadst-7f17a70834961cd1ff748b2621c6fc87c069be22.tar.gz
st-7f17a70834961cd1ff748b2621c6fc87c069be22.zip
Cleaning up lonely tabs.
-rw-r--r--st.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/st.c b/st.c
index 9ad4f89..8e1afe2 100644
--- a/st.c
+++ b/st.c
@@ -504,7 +504,7 @@ mousereport(XEvent *e) {
504 int state = e->xbutton.state; 504 int state = e->xbutton.state;
505 char buf[] = { '\033', '[', 'M', 0, 32+x+1, 32+y+1 }; 505 char buf[] = { '\033', '[', 'M', 0, 32+x+1, 32+y+1 };
506 static int ob, ox, oy; 506 static int ob, ox, oy;
507 507
508 /* from urxvt */ 508 /* from urxvt */
509 if(e->xbutton.type == MotionNotify) { 509 if(e->xbutton.type == MotionNotify) {
510 if(!IS_SET(MODE_MOUSEMOTION) || (x == ox && y == oy)) 510 if(!IS_SET(MODE_MOUSEMOTION) || (x == ox && y == oy))
@@ -522,11 +522,11 @@ mousereport(XEvent *e) {
522 ox = x, oy = y; 522 ox = x, oy = y;
523 } 523 }
524 } 524 }
525 525
526 buf[3] = 32 + button + (state & ShiftMask ? 4 : 0) 526 buf[3] = 32 + button + (state & ShiftMask ? 4 : 0)
527 + (state & Mod4Mask ? 8 : 0) 527 + (state & Mod4Mask ? 8 : 0)
528 + (state & ControlMask ? 16 : 0); 528 + (state & ControlMask ? 16 : 0);
529 529
530 ttywrite(buf, sizeof(buf)); 530 ttywrite(buf, sizeof(buf));
531} 531}
532 532
@@ -751,7 +751,7 @@ sigchld(int a) {
751void 751void
752ttynew(void) { 752ttynew(void) {
753 int m, s; 753 int m, s;
754 754
755 /* seems to work fine on linux, openbsd and freebsd */ 755 /* seems to work fine on linux, openbsd and freebsd */
756 struct winsize w = {term.row, term.col, 0, 0}; 756 struct winsize w = {term.row, term.col, 0, 0};
757 if(openpty(&m, &s, NULL, NULL, &w) < 0) 757 if(openpty(&m, &s, NULL, NULL, &w) < 0)
@@ -910,11 +910,11 @@ void
910tscrolldown(int orig, int n) { 910tscrolldown(int orig, int n) {
911 int i; 911 int i;
912 Line temp; 912 Line temp;
913 913
914 LIMIT(n, 0, term.bot-orig+1); 914 LIMIT(n, 0, term.bot-orig+1);
915 915
916 tclearregion(0, term.bot-n+1, term.col-1, term.bot); 916 tclearregion(0, term.bot-n+1, term.col-1, term.bot);
917 917
918 for(i = term.bot; i >= orig+n; i--) { 918 for(i = term.bot; i >= orig+n; i--) {
919 temp = term.line[i]; 919 temp = term.line[i];
920 term.line[i] = term.line[i-n]; 920 term.line[i] = term.line[i-n];
@@ -932,9 +932,9 @@ tscrollup(int orig, int n) {
932 int i; 932 int i;
933 Line temp; 933 Line temp;
934 LIMIT(n, 0, term.bot-orig+1); 934 LIMIT(n, 0, term.bot-orig+1);
935 935
936 tclearregion(0, orig, term.col-1, orig+n-1); 936 tclearregion(0, orig, term.col-1, orig+n-1);
937 937
938 for(i = orig; i <= term.bot-n; i++) { 938 for(i = orig; i <= term.bot-n; i++) {
939 temp = term.line[i]; 939 temp = term.line[i];
940 term.line[i] = term.line[i+n]; 940 term.line[i] = term.line[i+n];
@@ -951,7 +951,7 @@ void
951selscroll(int orig, int n) { 951selscroll(int orig, int n) {
952 if(sel.bx == -1) 952 if(sel.bx == -1)
953 return; 953 return;
954 954
955 if(BETWEEN(sel.by, orig, term.bot) || BETWEEN(sel.ey, orig, term.bot)) { 955 if(BETWEEN(sel.by, orig, term.bot) || BETWEEN(sel.ey, orig, term.bot)) {
956 if((sel.by += n) > term.bot || (sel.ey += n) < term.top) { 956 if((sel.by += n) > term.bot || (sel.ey += n) < term.top) {
957 sel.bx = -1; 957 sel.bx = -1;
@@ -988,7 +988,7 @@ csiparse(void) {
988 csiescseq.narg = 0; 988 csiescseq.narg = 0;
989 if(*p == '?') 989 if(*p == '?')
990 csiescseq.priv = 1, p++; 990 csiescseq.priv = 1, p++;
991 991
992 while(p < csiescseq.buf+csiescseq.len) { 992 while(p < csiescseq.buf+csiescseq.len) {
993 while(isdigit(*p)) { 993 while(isdigit(*p)) {
994 csiescseq.arg[csiescseq.narg] *= 10; 994 csiescseq.arg[csiescseq.narg] *= 10;
@@ -1047,7 +1047,7 @@ tdeletechar(int n) {
1047 int src = term.c.x + n; 1047 int src = term.c.x + n;
1048 int dst = term.c.x; 1048 int dst = term.c.x;
1049 int size = term.col - src; 1049 int size = term.col - src;
1050 1050
1051 term.dirty[term.c.y] = 1; 1051 term.dirty[term.c.y] = 1;
1052 1052
1053 if(src >= term.col) { 1053 if(src >= term.col) {
@@ -1765,7 +1765,7 @@ xloadcols(void) {
1765 } else 1765 } else
1766 dc.col[i] = color.pixel; 1766 dc.col[i] = color.pixel;
1767 } 1767 }
1768 1768
1769 /* load colors [16-255] ; same colors as xterm */ 1769 /* load colors [16-255] ; same colors as xterm */
1770 for(i = 16, r = 0; r < 6; r++) 1770 for(i = 16, r = 0; r < 6; r++)
1771 for(g = 0; g < 6; g++) 1771 for(g = 0; g < 6; g++)
@@ -1868,7 +1868,7 @@ xinit(void) {
1868 if(!(xw.dpy = XOpenDisplay(NULL))) 1868 if(!(xw.dpy = XOpenDisplay(NULL)))
1869 die("Can't open display\n"); 1869 die("Can't open display\n");
1870 xw.scr = XDefaultScreen(xw.dpy); 1870 xw.scr = XDefaultScreen(xw.dpy);
1871 1871
1872 /* font */ 1872 /* font */
1873 initfonts(FONT, BOLDFONT); 1873 initfonts(FONT, BOLDFONT);
1874 1874
@@ -1910,7 +1910,7 @@ xinit(void) {
1910 XNFocusWindow, xw.win, NULL); 1910 XNFocusWindow, xw.win, NULL);
1911 /* gc */ 1911 /* gc */
1912 dc.gc = XCreateGC(xw.dpy, xw.win, 0, NULL); 1912 dc.gc = XCreateGC(xw.dpy, xw.win, 0, NULL);
1913 1913
1914 /* white cursor, black outline */ 1914 /* white cursor, black outline */
1915 cursor = XCreateFontCursor(xw.dpy, XC_xterm); 1915 cursor = XCreateFontCursor(xw.dpy, XC_xterm);
1916 XDefineCursor(xw.dpy, xw.win, cursor); 1916 XDefineCursor(xw.dpy, xw.win, cursor);
@@ -1932,7 +1932,7 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) {
1932 int winx = BORDER+x*xw.cw, winy = BORDER+y*xw.ch + dc.font.ascent, width = charlen*xw.cw; 1932 int winx = BORDER+x*xw.cw, winy = BORDER+y*xw.ch + dc.font.ascent, width = charlen*xw.cw;
1933 XFontSet fontset = dc.font.set; 1933 XFontSet fontset = dc.font.set;
1934 int i; 1934 int i;
1935 1935
1936 /* only switch default fg/bg if term is in RV mode */ 1936 /* only switch default fg/bg if term is in RV mode */
1937 if(IS_SET(MODE_REVERSE)) { 1937 if(IS_SET(MODE_REVERSE)) {
1938 if(fg == DefaultFG) 1938 if(fg == DefaultFG)
@@ -1963,7 +1963,7 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) {
1963 } 1963 }
1964 1964
1965 XmbDrawImageString(xw.dpy, xw.buf, fontset, dc.gc, winx, winy, s, bytelen); 1965 XmbDrawImageString(xw.dpy, xw.buf, fontset, dc.gc, winx, winy, s, bytelen);
1966 1966
1967 if(base.mode & ATTR_UNDERLINE) 1967 if(base.mode & ATTR_UNDERLINE)
1968 XDrawLine(xw.dpy, xw.buf, dc.gc, winx, winy+1, winx+width-1, winy+1); 1968 XDrawLine(xw.dpy, xw.buf, dc.gc, winx, winy+1, winx+width-1, winy+1);
1969} 1969}
@@ -1982,10 +1982,10 @@ xdrawcursor(void) {
1982 static int oldy = 0; 1982 static int oldy = 0;
1983 int sl; 1983 int sl;
1984 Glyph g = {{' '}, ATTR_NULL, DefaultBG, DefaultCS, 0}; 1984 Glyph g = {{' '}, ATTR_NULL, DefaultBG, DefaultCS, 0};
1985 1985
1986 LIMIT(oldx, 0, term.col-1); 1986 LIMIT(oldx, 0, term.col-1);
1987 LIMIT(oldy, 0, term.row-1); 1987 LIMIT(oldy, 0, term.row-1);
1988 1988
1989 if(term.line[term.c.y][term.c.x].state & GLYPH_SET) 1989 if(term.line[term.c.y][term.c.x].state & GLYPH_SET)
1990 memcpy(g.c, term.line[term.c.y][term.c.x].c, UTF_SIZ); 1990 memcpy(g.c, term.line[term.c.y][term.c.x].c, UTF_SIZ);
1991 1991
@@ -2132,7 +2132,7 @@ kpress(XEvent *ev) {
2132 meta = e->state & Mod1Mask; 2132 meta = e->state & Mod1Mask;
2133 shift = e->state & ShiftMask; 2133 shift = e->state & ShiftMask;
2134 len = XmbLookupString(xw.xic, e, buf, sizeof(buf), &ksym, &status); 2134 len = XmbLookupString(xw.xic, e, buf, sizeof(buf), &ksym, &status);
2135 2135
2136 /* 1. custom keys from config.h */ 2136 /* 1. custom keys from config.h */
2137 if((customkey = kmap(ksym, e->state))) 2137 if((customkey = kmap(ksym, e->state)))
2138 ttywrite(customkey, strlen(customkey)); 2138 ttywrite(customkey, strlen(customkey));
@@ -2186,10 +2186,10 @@ cmessage(XEvent *e) {
2186void 2186void
2187resize(XEvent *e) { 2187resize(XEvent *e) {
2188 int col, row; 2188 int col, row;
2189 2189
2190 if(e->xconfigure.width == xw.w && e->xconfigure.height == xw.h) 2190 if(e->xconfigure.width == xw.w && e->xconfigure.height == xw.h)
2191 return; 2191 return;
2192 2192
2193 xw.w = e->xconfigure.width; 2193 xw.w = e->xconfigure.width;
2194 xw.h = e->xconfigure.height; 2194 xw.h = e->xconfigure.height;
2195 col = (xw.w - 2*BORDER) / xw.cw; 2195 col = (xw.w - 2*BORDER) / xw.cw;
@@ -2216,7 +2216,7 @@ run(void) {
2216 int xfd = XConnectionNumber(xw.dpy); 2216 int xfd = XConnectionNumber(xw.dpy);
2217 struct timeval timeout = {0}; 2217 struct timeval timeout = {0};
2218 bool stuff_to_print = 0; 2218 bool stuff_to_print = 0;
2219 2219
2220 for(;;) { 2220 for(;;) {
2221 FD_ZERO(&rfd); 2221 FD_ZERO(&rfd);
2222 FD_SET(cmdfd, &rfd); 2222 FD_SET(cmdfd, &rfd);
@@ -2251,7 +2251,7 @@ run(void) {
2251int 2251int
2252main(int argc, char *argv[]) { 2252main(int argc, char *argv[]) {
2253 int i; 2253 int i;
2254 2254
2255 for(i = 1; i < argc; i++) { 2255 for(i = 1; i < argc; i++) {
2256 switch(argv[i][0] != '-' || argv[i][2] ? -1 : argv[i][1]) { 2256 switch(argv[i][0] != '-' || argv[i][2] ? -1 : argv[i][1]) {
2257 case 't': 2257 case 't':