diff options
| author | Aurélien Aptel <aurelien.aptel@gmail.com> | 2011-04-26 20:29:28 +0200 |
|---|---|---|
| committer | Aurélien Aptel <aurelien.aptel@gmail.com> | 2011-04-26 20:29:28 +0200 |
| commit | 8eaed2cdda375e8e951eb389af3859e18761eddc (patch) | |
| tree | 719847accef5cf3184c77a5908081ead08d0edc1 | |
| parent | babf4db52b58da74c9e1072d14cb0b9ef5b4dee7 (diff) | |
| download | st-8eaed2cdda375e8e951eb389af3859e18761eddc.tar.gz st-8eaed2cdda375e8e951eb389af3859e18761eddc.zip | |
whitespace.
| -rw-r--r-- | st.c | 66 |
1 files changed, 33 insertions, 33 deletions
| @@ -398,7 +398,7 @@ selected(int x, int y) { | |||
| 398 | 398 | ||
| 399 | void | 399 | void |
| 400 | getbuttoninfo(XEvent *e, int *b, int *x, int *y) { | 400 | getbuttoninfo(XEvent *e, int *b, int *x, int *y) { |
| 401 | if(b) | 401 | if(b) |
| 402 | *b = e->xbutton.button; | 402 | *b = e->xbutton.button; |
| 403 | 403 | ||
| 404 | *x = (e->xbutton.x - BORDER)/xw.cw; | 404 | *x = (e->xbutton.x - BORDER)/xw.cw; |
| @@ -543,17 +543,17 @@ brelease(XEvent *e) { | |||
| 543 | } else if(TIMEDIFFERENCE(now, sel.tclick1) <= DOUBLECLICK_TIMEOUT) { | 543 | } else if(TIMEDIFFERENCE(now, sel.tclick1) <= DOUBLECLICK_TIMEOUT) { |
| 544 | /* double click to select word */ | 544 | /* double click to select word */ |
| 545 | sel.bx = sel.ex; | 545 | sel.bx = sel.ex; |
| 546 | while(term.line[sel.ey][sel.bx-1].state & GLYPH_SET && | 546 | while(term.line[sel.ey][sel.bx-1].state & GLYPH_SET && |
| 547 | term.line[sel.ey][sel.bx-1].c[0] != ' ') sel.bx--; | 547 | term.line[sel.ey][sel.bx-1].c[0] != ' ') sel.bx--; |
| 548 | sel.b.x = sel.bx; | 548 | sel.b.x = sel.bx; |
| 549 | while(term.line[sel.ey][sel.ex+1].state & GLYPH_SET && | 549 | while(term.line[sel.ey][sel.ex+1].state & GLYPH_SET && |
| 550 | term.line[sel.ey][sel.ex+1].c[0] != ' ') sel.ex++; | 550 | term.line[sel.ey][sel.ex+1].c[0] != ' ') sel.ex++; |
| 551 | sel.e.x = sel.ex; | 551 | sel.e.x = sel.ex; |
| 552 | sel.b.y = sel.e.y = sel.ey; | 552 | sel.b.y = sel.e.y = sel.ey; |
| 553 | selcopy(); | 553 | selcopy(); |
| 554 | } | 554 | } |
| 555 | } | 555 | } |
| 556 | } else if(b == 1) | 556 | } else if(b == 1) |
| 557 | selcopy(); | 557 | selcopy(); |
| 558 | memcpy(&sel.tclick2, &sel.tclick1, sizeof(struct timeval)); | 558 | memcpy(&sel.tclick2, &sel.tclick1, sizeof(struct timeval)); |
| 559 | gettimeofday(&sel.tclick1, NULL); | 559 | gettimeofday(&sel.tclick1, NULL); |
| @@ -563,7 +563,7 @@ brelease(XEvent *e) { | |||
| 563 | void | 563 | void |
| 564 | bmotion(XEvent *e) { | 564 | bmotion(XEvent *e) { |
| 565 | if(sel.mode) { | 565 | if(sel.mode) { |
| 566 | int oldey = sel.ey, | 566 | int oldey = sel.ey, |
| 567 | oldex = sel.ex; | 567 | oldex = sel.ex; |
| 568 | getbuttoninfo(e, NULL, &sel.ex, &sel.ey); | 568 | getbuttoninfo(e, NULL, &sel.ex, &sel.ey); |
| 569 | 569 | ||
| @@ -597,7 +597,7 @@ execsh(void) { | |||
| 597 | exit(EXIT_FAILURE); | 597 | exit(EXIT_FAILURE); |
| 598 | } | 598 | } |
| 599 | 599 | ||
| 600 | void | 600 | void |
| 601 | sigchld(int a) { | 601 | sigchld(int a) { |
| 602 | int stat = 0; | 602 | int stat = 0; |
| 603 | if(waitpid(pid, &stat, 0) < 0) | 603 | if(waitpid(pid, &stat, 0) < 0) |
| @@ -650,7 +650,7 @@ dump(char c) { | |||
| 650 | void | 650 | void |
| 651 | ttyread(void) { | 651 | ttyread(void) { |
| 652 | static char buf[BUFSIZ]; | 652 | static char buf[BUFSIZ]; |
| 653 | static int buflen = 0; | 653 | static int buflen = 0; |
| 654 | char *ptr; | 654 | char *ptr; |
| 655 | char s[UTF_SIZ]; | 655 | char s[UTF_SIZ]; |
| 656 | int charsize; /* size of utf8 char in bytes */ | 656 | int charsize; /* size of utf8 char in bytes */ |
| @@ -706,8 +706,8 @@ tcursor(int mode) { | |||
| 706 | void | 706 | void |
| 707 | treset(void) { | 707 | treset(void) { |
| 708 | term.c = (TCursor){{ | 708 | term.c = (TCursor){{ |
| 709 | .mode = ATTR_NULL, | 709 | .mode = ATTR_NULL, |
| 710 | .fg = DefaultFG, | 710 | .fg = DefaultFG, |
| 711 | .bg = DefaultBG | 711 | .bg = DefaultBG |
| 712 | }, .x = 0, .y = 0, .state = CURSOR_DEFAULT}; | 712 | }, .x = 0, .y = 0, .state = CURSOR_DEFAULT}; |
| 713 | 713 | ||
| @@ -762,9 +762,9 @@ tscrollup(int orig, int n) { | |||
| 762 | 762 | ||
| 763 | tclearregion(0, orig, term.col-1, orig+n-1); | 763 | tclearregion(0, orig, term.col-1, orig+n-1); |
| 764 | 764 | ||
| 765 | for(i = orig; i <= term.bot-n; i++) { | 765 | for(i = orig; i <= term.bot-n; i++) { |
| 766 | temp = term.line[i]; | 766 | temp = term.line[i]; |
| 767 | term.line[i] = term.line[i+n]; | 767 | term.line[i] = term.line[i+n]; |
| 768 | term.line[i+n] = temp; | 768 | term.line[i+n] = temp; |
| 769 | } | 769 | } |
| 770 | } | 770 | } |
| @@ -894,22 +894,22 @@ tsetattr(int *attr, int l) { | |||
| 894 | term.c.attr.bg = DefaultBG; | 894 | term.c.attr.bg = DefaultBG; |
| 895 | break; | 895 | break; |
| 896 | case 1: | 896 | case 1: |
| 897 | term.c.attr.mode |= ATTR_BOLD; | 897 | term.c.attr.mode |= ATTR_BOLD; |
| 898 | break; | 898 | break; |
| 899 | case 4: | 899 | case 4: |
| 900 | term.c.attr.mode |= ATTR_UNDERLINE; | 900 | term.c.attr.mode |= ATTR_UNDERLINE; |
| 901 | break; | 901 | break; |
| 902 | case 7: | 902 | case 7: |
| 903 | term.c.attr.mode |= ATTR_REVERSE; | 903 | term.c.attr.mode |= ATTR_REVERSE; |
| 904 | break; | 904 | break; |
| 905 | case 22: | 905 | case 22: |
| 906 | term.c.attr.mode &= ~ATTR_BOLD; | 906 | term.c.attr.mode &= ~ATTR_BOLD; |
| 907 | break; | 907 | break; |
| 908 | case 24: | 908 | case 24: |
| 909 | term.c.attr.mode &= ~ATTR_UNDERLINE; | 909 | term.c.attr.mode &= ~ATTR_UNDERLINE; |
| 910 | break; | 910 | break; |
| 911 | case 27: | 911 | case 27: |
| 912 | term.c.attr.mode &= ~ATTR_REVERSE; | 912 | term.c.attr.mode &= ~ATTR_REVERSE; |
| 913 | break; | 913 | break; |
| 914 | case 38: | 914 | case 38: |
| 915 | if(i + 2 < l && attr[i + 1] == 5) { | 915 | if(i + 2 < l && attr[i + 1] == 5) { |
| @@ -920,7 +920,7 @@ tsetattr(int *attr, int l) { | |||
| 920 | fprintf(stderr, "erresc: bad fgcolor %d\n", attr[i]); | 920 | fprintf(stderr, "erresc: bad fgcolor %d\n", attr[i]); |
| 921 | } | 921 | } |
| 922 | else | 922 | else |
| 923 | fprintf(stderr, "erresc: gfx attr %d unknown\n", attr[i]); | 923 | fprintf(stderr, "erresc: gfx attr %d unknown\n", attr[i]); |
| 924 | break; | 924 | break; |
| 925 | case 39: | 925 | case 39: |
| 926 | term.c.attr.fg = DefaultFG; | 926 | term.c.attr.fg = DefaultFG; |
| @@ -934,7 +934,7 @@ tsetattr(int *attr, int l) { | |||
| 934 | fprintf(stderr, "erresc: bad bgcolor %d\n", attr[i]); | 934 | fprintf(stderr, "erresc: bad bgcolor %d\n", attr[i]); |
| 935 | } | 935 | } |
| 936 | else | 936 | else |
| 937 | fprintf(stderr, "erresc: gfx attr %d unknown\n", attr[i]); | 937 | fprintf(stderr, "erresc: gfx attr %d unknown\n", attr[i]); |
| 938 | break; | 938 | break; |
| 939 | case 49: | 939 | case 49: |
| 940 | term.c.attr.bg = DefaultBG; | 940 | term.c.attr.bg = DefaultBG; |
| @@ -948,7 +948,7 @@ tsetattr(int *attr, int l) { | |||
| 948 | term.c.attr.fg = attr[i] - 90 + 8; | 948 | term.c.attr.fg = attr[i] - 90 + 8; |
| 949 | else if(BETWEEN(attr[i], 100, 107)) | 949 | else if(BETWEEN(attr[i], 100, 107)) |
| 950 | term.c.attr.fg = attr[i] - 100 + 8; | 950 | term.c.attr.fg = attr[i] - 100 + 8; |
| 951 | else | 951 | else |
| 952 | fprintf(stderr, "erresc: gfx attr %d unknown\n", attr[i]), csidump(); | 952 | fprintf(stderr, "erresc: gfx attr %d unknown\n", attr[i]), csidump(); |
| 953 | 953 | ||
| 954 | break; | 954 | break; |
| @@ -968,7 +968,7 @@ tsetscroll(int t, int b) { | |||
| 968 | b = temp; | 968 | b = temp; |
| 969 | } | 969 | } |
| 970 | term.top = t; | 970 | term.top = t; |
| 971 | term.bot = b; | 971 | term.bot = b; |
| 972 | } | 972 | } |
| 973 | 973 | ||
| 974 | void | 974 | void |
| @@ -1193,7 +1193,7 @@ csihandle(void) { | |||
| 1193 | } | 1193 | } |
| 1194 | 1194 | ||
| 1195 | void | 1195 | void |
| 1196 | csidump(void) { | 1196 | csidump(void) { |
| 1197 | int i; | 1197 | int i; |
| 1198 | printf("ESC [ %s", escseq.priv ? "? " : ""); | 1198 | printf("ESC [ %s", escseq.priv ? "? " : ""); |
| 1199 | if(escseq.narg) | 1199 | if(escseq.narg) |
| @@ -1226,7 +1226,7 @@ tputc(char *c) { | |||
| 1226 | csiparse(), csihandle(); | 1226 | csiparse(), csihandle(); |
| 1227 | } | 1227 | } |
| 1228 | /* TODO: handle other OSC */ | 1228 | /* TODO: handle other OSC */ |
| 1229 | } else if(term.esc & ESC_OSC) { | 1229 | } else if(term.esc & ESC_OSC) { |
| 1230 | if(ascii == ';') { | 1230 | if(ascii == ';') { |
| 1231 | term.titlelen = 0; | 1231 | term.titlelen = 0; |
| 1232 | term.esc = ESC_START | ESC_TITLE; | 1232 | term.esc = ESC_START | ESC_TITLE; |
| @@ -1550,7 +1550,7 @@ xinit(void) { | |||
| 1550 | initfonts(FONT, BOLDFONT); | 1550 | initfonts(FONT, BOLDFONT); |
| 1551 | 1551 | ||
| 1552 | /* XXX: Assuming same size for bold font */ | 1552 | /* XXX: Assuming same size for bold font */ |
| 1553 | xw.cw = dc.font.rbearing - dc.font.lbearing; | 1553 | xw.cw = dc.font.rbearing - dc.font.lbearing; |
| 1554 | xw.ch = dc.font.ascent + dc.font.descent; | 1554 | xw.ch = dc.font.ascent + dc.font.descent; |
| 1555 | 1555 | ||
| 1556 | /* colors */ | 1556 | /* colors */ |
| @@ -1582,8 +1582,8 @@ xinit(void) { | |||
| 1582 | 1582 | ||
| 1583 | /* input methods */ | 1583 | /* input methods */ |
| 1584 | xw.xim = XOpenIM(xw.dpy, NULL, NULL, NULL); | 1584 | xw.xim = XOpenIM(xw.dpy, NULL, NULL, NULL); |
| 1585 | xw.xic = XCreateIC(xw.xim, XNInputStyle, XIMPreeditNothing | 1585 | xw.xic = XCreateIC(xw.xim, XNInputStyle, XIMPreeditNothing |
| 1586 | | XIMStatusNothing, XNClientWindow, xw.win, | 1586 | | XIMStatusNothing, XNClientWindow, xw.win, |
| 1587 | XNFocusWindow, xw.win, NULL); | 1587 | XNFocusWindow, xw.win, NULL); |
| 1588 | /* gc */ | 1588 | /* gc */ |
| 1589 | dc.gc = XCreateGC(xw.dpy, xw.win, 0, NULL); | 1589 | dc.gc = XCreateGC(xw.dpy, xw.win, 0, NULL); |
| @@ -1591,7 +1591,7 @@ xinit(void) { | |||
| 1591 | /* white cursor, black outline */ | 1591 | /* white cursor, black outline */ |
| 1592 | cursor = XCreateFontCursor(xw.dpy, XC_xterm); | 1592 | cursor = XCreateFontCursor(xw.dpy, XC_xterm); |
| 1593 | XDefineCursor(xw.dpy, xw.win, cursor); | 1593 | XDefineCursor(xw.dpy, xw.win, cursor); |
| 1594 | XRecolorCursor(xw.dpy, cursor, | 1594 | XRecolorCursor(xw.dpy, cursor, |
| 1595 | &(XColor){.red = 0xffff, .green = 0xffff, .blue = 0xffff}, | 1595 | &(XColor){.red = 0xffff, .green = 0xffff, .blue = 0xffff}, |
| 1596 | &(XColor){.red = 0x0000, .green = 0x0000, .blue = 0x0000}); | 1596 | &(XColor){.red = 0x0000, .green = 0x0000, .blue = 0x0000}); |
| 1597 | 1597 | ||
| @@ -1626,7 +1626,7 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) { | |||
| 1626 | } | 1626 | } |
| 1627 | 1627 | ||
| 1628 | XmbDrawImageString(xw.dpy, xw.buf, base.mode & ATTR_BOLD ? dc.bfont.set : dc.font.set, | 1628 | XmbDrawImageString(xw.dpy, xw.buf, base.mode & ATTR_BOLD ? dc.bfont.set : dc.font.set, |
| 1629 | dc.gc, winx, winy, s, bytelen); | 1629 | dc.gc, winx, winy, s, bytelen); |
| 1630 | 1630 | ||
| 1631 | if(base.mode & ATTR_UNDERLINE) | 1631 | if(base.mode & ATTR_UNDERLINE) |
| 1632 | XDrawLine(xw.dpy, xw.buf, dc.gc, winx, winy+1, winx+width-1, winy+1); | 1632 | XDrawLine(xw.dpy, xw.buf, dc.gc, winx, winy+1, winx+width-1, winy+1); |
| @@ -1660,7 +1660,7 @@ xdrawcursor(void) { | |||
| 1660 | } | 1660 | } |
| 1661 | } | 1661 | } |
| 1662 | 1662 | ||
| 1663 | void | 1663 | void |
| 1664 | draw() { | 1664 | draw() { |
| 1665 | drawregion(0, 0, term.col, term.row); | 1665 | drawregion(0, 0, term.col, term.row); |
| 1666 | } | 1666 | } |
| @@ -1846,7 +1846,7 @@ run(void) { | |||
| 1846 | } | 1846 | } |
| 1847 | if(FD_ISSET(cmdfd, &rfd)) { | 1847 | if(FD_ISSET(cmdfd, &rfd)) { |
| 1848 | ttyread(); | 1848 | ttyread(); |
| 1849 | draw(); | 1849 | draw(); |
| 1850 | } | 1850 | } |
| 1851 | while(XPending(xw.dpy)) { | 1851 | while(XPending(xw.dpy)) { |
| 1852 | XNextEvent(xw.dpy, &ev); | 1852 | XNextEvent(xw.dpy, &ev); |
