fix: whitespace

master
Markus Teich 12 years ago committed by Roberto E. Vargas Caballero
parent fbc589d506
commit 40e4d76d22

@ -160,7 +160,7 @@ static Key key[] = {
{ XK_KP_Right, XK_ANY_MOD, "\033[C", 0, -1, 0}, { XK_KP_Right, XK_ANY_MOD, "\033[C", 0, -1, 0},
{ XK_KP_Right, XK_ANY_MOD, "\033OC", 0, +1, 0}, { XK_KP_Right, XK_ANY_MOD, "\033OC", 0, +1, 0},
{ XK_KP_Prior, ShiftMask, "\033[5;2~", 0, 0, 0}, { XK_KP_Prior, ShiftMask, "\033[5;2~", 0, 0, 0},
{ XK_KP_Prior, XK_ANY_MOD, "\033[5~", 0, 0, 0}, { XK_KP_Prior, XK_ANY_MOD, "\033[5~", 0, 0, 0},
{ XK_KP_Begin, XK_ANY_MOD, "\033[E", 0, 0, 0}, { XK_KP_Begin, XK_ANY_MOD, "\033[E", 0, 0, 0},
{ XK_KP_End, ControlMask, "\033[J", -1, 0, 0}, { XK_KP_End, ControlMask, "\033[J", -1, 0, 0},
{ XK_KP_End, ControlMask, "\033[1;5F", +1, 0, 0}, { XK_KP_End, ControlMask, "\033[1;5F", +1, 0, 0},
@ -213,7 +213,7 @@ static Key key[] = {
{ XK_Left, ShiftMask, "\033[1;2D", 0, 0, 0}, { XK_Left, ShiftMask, "\033[1;2D", 0, 0, 0},
{ XK_Left, ControlMask, "\033[1;5D", 0, 0, 0}, { XK_Left, ControlMask, "\033[1;5D", 0, 0, 0},
{ XK_Left, Mod1Mask, "\033[1;3D", 0, 0, 0}, { XK_Left, Mod1Mask, "\033[1;3D", 0, 0, 0},
{ XK_Left, XK_ANY_MOD, "\033[D", 0, -1, 0}, { XK_Left, XK_ANY_MOD, "\033[D", 0, -1, 0},
{ XK_Left, XK_ANY_MOD, "\033OD", 0, +1, 0}, { XK_Left, XK_ANY_MOD, "\033OD", 0, +1, 0},
{ XK_Right, ShiftMask, "\033[1;2C", 0, 0, 0}, { XK_Right, ShiftMask, "\033[1;2C", 0, 0, 0},
{ XK_Right, ControlMask, "\033[1;5C", 0, 0, 0}, { XK_Right, ControlMask, "\033[1;5C", 0, 0, 0},

124
st.c

@ -98,37 +98,37 @@ enum cursor_movement {
enum cursor_state { enum cursor_state {
CURSOR_DEFAULT = 0, CURSOR_DEFAULT = 0,
CURSOR_WRAPNEXT = 1, CURSOR_WRAPNEXT = 1,
CURSOR_ORIGIN = 2 CURSOR_ORIGIN = 2
}; };
enum term_mode { enum term_mode {
MODE_WRAP = 1, MODE_WRAP = 1,
MODE_INSERT = 2, MODE_INSERT = 2,
MODE_APPKEYPAD = 4, MODE_APPKEYPAD = 4,
MODE_ALTSCREEN = 8, MODE_ALTSCREEN = 8,
MODE_CRLF = 16, MODE_CRLF = 16,
MODE_MOUSEBTN = 32, MODE_MOUSEBTN = 32,
MODE_MOUSEMOTION = 64, MODE_MOUSEMOTION = 64,
MODE_REVERSE = 128, MODE_REVERSE = 128,
MODE_KBDLOCK = 256, MODE_KBDLOCK = 256,
MODE_HIDE = 512, MODE_HIDE = 512,
MODE_ECHO = 1024, MODE_ECHO = 1024,
MODE_APPCURSOR = 2048, MODE_APPCURSOR = 2048,
MODE_MOUSESGR = 4096, MODE_MOUSESGR = 4096,
MODE_8BIT = 8192, MODE_8BIT = 8192,
MODE_BLINK = 16384, MODE_BLINK = 16384,
MODE_FBLINK = 32768, MODE_FBLINK = 32768,
MODE_FOCUS = 65536, MODE_FOCUS = 65536,
MODE_MOUSEX10 = 131072, MODE_MOUSEX10 = 131072,
MODE_MOUSEMANY = 262144, MODE_MOUSEMANY = 262144,
MODE_MOUSE = MODE_MOUSEBTN|MODE_MOUSEMOTION|MODE_MOUSEX10\ MODE_MOUSE = MODE_MOUSEBTN|MODE_MOUSEMOTION|MODE_MOUSEX10\
|MODE_MOUSEMANY, |MODE_MOUSEMANY,
}; };
enum escape_state { enum escape_state {
ESC_START = 1, ESC_START = 1,
ESC_CSI = 2, ESC_CSI = 2,
ESC_STR = 4, /* DSC, OSC, PM, APC */ ESC_STR = 4, /* DSC, OSC, PM, APC */
ESC_ALTCHARSET = 8, ESC_ALTCHARSET = 8,
ESC_STR_END = 16, /* a final string was encountered */ ESC_STR_END = 16, /* a final string was encountered */
ESC_TEST = 32, /* Enter in test mode */ ESC_TEST = 32, /* Enter in test mode */
@ -156,16 +156,16 @@ typedef unsigned long ulong;
typedef unsigned short ushort; typedef unsigned short ushort;
typedef struct { typedef struct {
char c[UTF_SIZ]; /* character code */ char c[UTF_SIZ]; /* character code */
uchar mode; /* attribute flags */ uchar mode; /* attribute flags */
ushort fg; /* foreground */ ushort fg; /* foreground */
ushort bg; /* background */ ushort bg; /* background */
} Glyph; } Glyph;
typedef Glyph *Line; typedef Glyph *Line;
typedef struct { typedef struct {
Glyph attr; /* current char attributes */ Glyph attr; /* current char attributes */
int x; int x;
int y; int y;
char state; char state;
@ -175,36 +175,36 @@ typedef struct {
/* ESC '[' [[ [<priv>] <arg> [;]] <mode>] */ /* ESC '[' [[ [<priv>] <arg> [;]] <mode>] */
typedef struct { typedef struct {
char buf[ESC_BUF_SIZ]; /* raw string */ char buf[ESC_BUF_SIZ]; /* raw string */
int len; /* raw string length */ int len; /* raw string length */
char priv; char priv;
int arg[ESC_ARG_SIZ]; int arg[ESC_ARG_SIZ];
int narg; /* nb of args */ int narg; /* nb of args */
char mode; char mode;
} CSIEscape; } CSIEscape;
/* STR Escape sequence structs */ /* STR Escape sequence structs */
/* ESC type [[ [<priv>] <arg> [;]] <mode>] ESC '\' */ /* ESC type [[ [<priv>] <arg> [;]] <mode>] ESC '\' */
typedef struct { typedef struct {
char type; /* ESC type ... */ char type; /* ESC type ... */
char buf[STR_BUF_SIZ]; /* raw string */ char buf[STR_BUF_SIZ]; /* raw string */
int len; /* raw string length */ int len; /* raw string length */
char *args[STR_ARG_SIZ]; char *args[STR_ARG_SIZ];
int narg; /* nb of args */ int narg; /* nb of args */
} STREscape; } STREscape;
/* Internal representation of the screen */ /* Internal representation of the screen */
typedef struct { typedef struct {
int row; /* nb row */ int row; /* nb row */
int col; /* nb col */ int col; /* nb col */
Line *line; /* screen */ Line *line; /* screen */
Line *alt; /* alternate screen */ Line *alt; /* alternate screen */
bool *dirty; /* dirtyness of lines */ bool *dirty; /* dirtyness of lines */
TCursor c; /* cursor */ TCursor c; /* cursor */
int top; /* top scroll limit */ int top; /* top scroll limit */
int bot; /* bottom scroll limit */ int bot; /* bottom scroll limit */
int mode; /* terminal mode flags */ int mode; /* terminal mode flags */
int esc; /* escape state flags */ int esc; /* escape state flags */
bool numlock; /* lock numbers in keyboard */ bool numlock; /* lock numbers in keyboard */
bool *tabs; bool *tabs;
} Term; } Term;
@ -241,9 +241,9 @@ typedef struct {
uint mask; uint mask;
char s[ESC_BUF_SIZ]; char s[ESC_BUF_SIZ];
/* three valued logic variables: 0 indifferent, 1 on, -1 off */ /* three valued logic variables: 0 indifferent, 1 on, -1 off */
signed char appkey; /* application keypad */ signed char appkey; /* application keypad */
signed char appcursor; /* application cursor */ signed char appcursor; /* application cursor */
signed char crlf; /* crlf mode */ signed char crlf; /* crlf mode */
} Key; } Key;
typedef struct { typedef struct {
@ -1182,7 +1182,7 @@ sigchld(int a) {
int stat = 0; int stat = 0;
if(waitpid(pid, &stat, 0) < 0) if(waitpid(pid, &stat, 0) < 0)
die("Waiting for pid %hd failed: %s\n", pid, SERRNO); die("Waiting for pid %hd failed: %s\n", pid, SERRNO);
if(WIFEXITED(stat)) { if(WIFEXITED(stat)) {
exit(WEXITSTATUS(stat)); exit(WEXITSTATUS(stat));
@ -1821,7 +1821,7 @@ tsetmode(bool priv, bool set, int *args, int narg) {
tclearregion(0, 0, term.col-1, tclearregion(0, 0, term.col-1,
term.row-1); term.row-1);
} }
if(set ^ alt) /* set is always 1 or 0 */ if(set ^ alt) /* set is always 1 or 0 */
tswapscreen(); tswapscreen();
if(*args != 1049) if(*args != 1049)
break; break;
@ -2184,10 +2184,10 @@ techo(char *buf, int len) {
for(; len > 0; buf++, len--) { for(; len > 0; buf++, len--) {
char c = *buf; char c = *buf;
if(c == '\033') { /* escape */ if(c == '\033') { /* escape */
tputc("^", 1); tputc("^", 1);
tputc("[", 1); tputc("[", 1);
} else if(c < '\x20') { /* control code */ } else if(c < '\x20') { /* control code */
if(c != '\n' && c != '\r' && c != '\t') { if(c != '\n' && c != '\r' && c != '\t') {
c |= '\x40'; c |= '\x40';
tputc("^", 1); tputc("^", 1);
@ -2258,31 +2258,31 @@ tputc(char *c, int len) {
*/ */
if(control) { if(control) {
switch(ascii) { switch(ascii) {
case '\t': /* HT */ case '\t': /* HT */
tputtab(1); tputtab(1);
return; return;
case '\b': /* BS */ case '\b': /* BS */
tmoveto(term.c.x-1, term.c.y); tmoveto(term.c.x-1, term.c.y);
return; return;
case '\r': /* CR */ case '\r': /* CR */
tmoveto(0, term.c.y); tmoveto(0, term.c.y);
return; return;
case '\f': /* LF */ case '\f': /* LF */
case '\v': /* VT */ case '\v': /* VT */
case '\n': /* LF */ case '\n': /* LF */
/* go to first col if the mode is set */ /* go to first col if the mode is set */
tnewline(IS_SET(MODE_CRLF)); tnewline(IS_SET(MODE_CRLF));
return; return;
case '\a': /* BEL */ case '\a': /* BEL */
if(!(xw.state & WIN_FOCUSED)) if(!(xw.state & WIN_FOCUSED))
xseturgency(1); xseturgency(1);
return; return;
case '\033': /* ESC */ case '\033': /* ESC */
csireset(); csireset();
term.esc = ESC_START; term.esc = ESC_START;
return; return;
case '\016': /* SO */ case '\016': /* SO */
case '\017': /* SI */ case '\017': /* SI */
/* /*
* Different charsets are hard to handle. Applications * Different charsets are hard to handle. Applications
* should use the right alt charset escapes for the * should use the right alt charset escapes for the
@ -2290,15 +2290,15 @@ tputc(char *c, int len) {
* rest is incompatible history st should not support. * rest is incompatible history st should not support.
*/ */
return; return;
case '\032': /* SUB */ case '\032': /* SUB */
case '\030': /* CAN */ case '\030': /* CAN */
csireset(); csireset();
return; return;
case '\005': /* ENQ (IGNORED) */ case '\005': /* ENQ (IGNORED) */
case '\000': /* NUL (IGNORED) */ case '\000': /* NUL (IGNORED) */
case '\021': /* XON (IGNORED) */ case '\021': /* XON (IGNORED) */
case '\023': /* XOFF (IGNORED) */ case '\023': /* XOFF (IGNORED) */
case 0177: /* DEL (IGNORED) */ case 0177: /* DEL (IGNORED) */
return; return;
} }
} else if(term.esc & ESC_START) { } else if(term.esc & ESC_START) {
@ -2963,9 +2963,9 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) {
} }
/* /*
* Those ranges will not be brightened: * Those ranges will not be brightened:
* 8 - 15 bright system colors * 8 - 15 bright system colors
* 196 - 231 highest 256 color cube * 196 - 231 highest 256 color cube
* 252 - 255 brightest colors in greyscale * 252 - 255 brightest colors in greyscale
*/ */
font = &dc.bfont; font = &dc.bfont;
frcflags = FRC_BOLD; frcflags = FRC_BOLD;

Loading…
Cancel
Save