diff options
author | Markus Teich <markus.teich@stusta.mhn.de> | 2013-06-22 23:07:00 +0200 |
---|---|---|
committer | Roberto E. Vargas Caballero <k0ga@shike2.com> | 2013-07-04 09:58:14 +0200 |
commit | 40e4d76d227d9c517054036f546acd49431bca42 (patch) | |
tree | e34e2fa5963e772a206b18d6daf007fb7abf6295 /st.c | |
parent | fbc589d50603e8b0de9239e4800e227ab5d0ea69 (diff) | |
download | st-40e4d76d227d9c517054036f546acd49431bca42.tar.gz st-40e4d76d227d9c517054036f546acd49431bca42.zip |
fix: whitespace
Diffstat (limited to 'st.c')
-rw-r--r-- | st.c | 124 |
1 files changed, 62 insertions, 62 deletions
@@ -98,37 +98,37 @@ enum cursor_movement { | |||
98 | enum cursor_state { | 98 | enum cursor_state { |
99 | CURSOR_DEFAULT = 0, | 99 | CURSOR_DEFAULT = 0, |
100 | CURSOR_WRAPNEXT = 1, | 100 | CURSOR_WRAPNEXT = 1, |
101 | CURSOR_ORIGIN = 2 | 101 | CURSOR_ORIGIN = 2 |
102 | }; | 102 | }; |
103 | 103 | ||
104 | enum term_mode { | 104 | enum term_mode { |
105 | MODE_WRAP = 1, | 105 | MODE_WRAP = 1, |
106 | MODE_INSERT = 2, | 106 | MODE_INSERT = 2, |
107 | MODE_APPKEYPAD = 4, | 107 | MODE_APPKEYPAD = 4, |
108 | MODE_ALTSCREEN = 8, | 108 | MODE_ALTSCREEN = 8, |
109 | MODE_CRLF = 16, | 109 | MODE_CRLF = 16, |
110 | MODE_MOUSEBTN = 32, | 110 | MODE_MOUSEBTN = 32, |
111 | MODE_MOUSEMOTION = 64, | 111 | MODE_MOUSEMOTION = 64, |
112 | MODE_REVERSE = 128, | 112 | MODE_REVERSE = 128, |
113 | MODE_KBDLOCK = 256, | 113 | MODE_KBDLOCK = 256, |
114 | MODE_HIDE = 512, | 114 | MODE_HIDE = 512, |
115 | MODE_ECHO = 1024, | 115 | MODE_ECHO = 1024, |
116 | MODE_APPCURSOR = 2048, | 116 | MODE_APPCURSOR = 2048, |
117 | MODE_MOUSESGR = 4096, | 117 | MODE_MOUSESGR = 4096, |
118 | MODE_8BIT = 8192, | 118 | MODE_8BIT = 8192, |
119 | MODE_BLINK = 16384, | 119 | MODE_BLINK = 16384, |
120 | MODE_FBLINK = 32768, | 120 | MODE_FBLINK = 32768, |
121 | MODE_FOCUS = 65536, | 121 | MODE_FOCUS = 65536, |
122 | MODE_MOUSEX10 = 131072, | 122 | MODE_MOUSEX10 = 131072, |
123 | MODE_MOUSEMANY = 262144, | 123 | MODE_MOUSEMANY = 262144, |
124 | MODE_MOUSE = MODE_MOUSEBTN|MODE_MOUSEMOTION|MODE_MOUSEX10\ | 124 | MODE_MOUSE = MODE_MOUSEBTN|MODE_MOUSEMOTION|MODE_MOUSEX10\ |
125 | |MODE_MOUSEMANY, | 125 | |MODE_MOUSEMANY, |
126 | }; | 126 | }; |
127 | 127 | ||
128 | enum escape_state { | 128 | enum escape_state { |
129 | ESC_START = 1, | 129 | ESC_START = 1, |
130 | ESC_CSI = 2, | 130 | ESC_CSI = 2, |
131 | ESC_STR = 4, /* DSC, OSC, PM, APC */ | 131 | ESC_STR = 4, /* DSC, OSC, PM, APC */ |
132 | ESC_ALTCHARSET = 8, | 132 | ESC_ALTCHARSET = 8, |
133 | ESC_STR_END = 16, /* a final string was encountered */ | 133 | ESC_STR_END = 16, /* a final string was encountered */ |
134 | ESC_TEST = 32, /* Enter in test mode */ | 134 | ESC_TEST = 32, /* Enter in test mode */ |
@@ -156,16 +156,16 @@ typedef unsigned long ulong; | |||
156 | typedef unsigned short ushort; | 156 | typedef unsigned short ushort; |
157 | 157 | ||
158 | typedef struct { | 158 | typedef struct { |
159 | char c[UTF_SIZ]; /* character code */ | 159 | char c[UTF_SIZ]; /* character code */ |
160 | uchar mode; /* attribute flags */ | 160 | uchar mode; /* attribute flags */ |
161 | ushort fg; /* foreground */ | 161 | ushort fg; /* foreground */ |
162 | ushort bg; /* background */ | 162 | ushort bg; /* background */ |
163 | } Glyph; | 163 | } Glyph; |
164 | 164 | ||
165 | typedef Glyph *Line; | 165 | typedef Glyph *Line; |
166 | 166 | ||
167 | typedef struct { | 167 | typedef struct { |
168 | Glyph attr; /* current char attributes */ | 168 | Glyph attr; /* current char attributes */ |
169 | int x; | 169 | int x; |
170 | int y; | 170 | int y; |
171 | char state; | 171 | char state; |
@@ -175,36 +175,36 @@ typedef struct { | |||
175 | /* ESC '[' [[ [<priv>] <arg> [;]] <mode>] */ | 175 | /* ESC '[' [[ [<priv>] <arg> [;]] <mode>] */ |
176 | typedef struct { | 176 | typedef struct { |
177 | char buf[ESC_BUF_SIZ]; /* raw string */ | 177 | char buf[ESC_BUF_SIZ]; /* raw string */ |
178 | int len; /* raw string length */ | 178 | int len; /* raw string length */ |
179 | char priv; | 179 | char priv; |
180 | int arg[ESC_ARG_SIZ]; | 180 | int arg[ESC_ARG_SIZ]; |
181 | int narg; /* nb of args */ | 181 | int narg; /* nb of args */ |
182 | char mode; | 182 | char mode; |
183 | } CSIEscape; | 183 | } CSIEscape; |
184 | 184 | ||
185 | /* STR Escape sequence structs */ | 185 | /* STR Escape sequence structs */ |
186 | /* ESC type [[ [<priv>] <arg> [;]] <mode>] ESC '\' */ | 186 | /* ESC type [[ [<priv>] <arg> [;]] <mode>] ESC '\' */ |
187 | typedef struct { | 187 | typedef struct { |
188 | char type; /* ESC type ... */ | 188 | char type; /* ESC type ... */ |
189 | char buf[STR_BUF_SIZ]; /* raw string */ | 189 | char buf[STR_BUF_SIZ]; /* raw string */ |
190 | int len; /* raw string length */ | 190 | int len; /* raw string length */ |
191 | char *args[STR_ARG_SIZ]; | 191 | char *args[STR_ARG_SIZ]; |
192 | int narg; /* nb of args */ | 192 | int narg; /* nb of args */ |
193 | } STREscape; | 193 | } STREscape; |
194 | 194 | ||
195 | /* Internal representation of the screen */ | 195 | /* Internal representation of the screen */ |
196 | typedef struct { | 196 | typedef struct { |
197 | int row; /* nb row */ | 197 | int row; /* nb row */ |
198 | int col; /* nb col */ | 198 | int col; /* nb col */ |
199 | Line *line; /* screen */ | 199 | Line *line; /* screen */ |
200 | Line *alt; /* alternate screen */ | 200 | Line *alt; /* alternate screen */ |
201 | bool *dirty; /* dirtyness of lines */ | 201 | bool *dirty; /* dirtyness of lines */ |
202 | TCursor c; /* cursor */ | 202 | TCursor c; /* cursor */ |
203 | int top; /* top scroll limit */ | 203 | int top; /* top scroll limit */ |
204 | int bot; /* bottom scroll limit */ | 204 | int bot; /* bottom scroll limit */ |
205 | int mode; /* terminal mode flags */ | 205 | int mode; /* terminal mode flags */ |
206 | int esc; /* escape state flags */ | 206 | int esc; /* escape state flags */ |
207 | bool numlock; /* lock numbers in keyboard */ | 207 | bool numlock; /* lock numbers in keyboard */ |
208 | bool *tabs; | 208 | bool *tabs; |
209 | } Term; | 209 | } Term; |
210 | 210 | ||
@@ -241,9 +241,9 @@ typedef struct { | |||
241 | uint mask; | 241 | uint mask; |
242 | char s[ESC_BUF_SIZ]; | 242 | char s[ESC_BUF_SIZ]; |
243 | /* three valued logic variables: 0 indifferent, 1 on, -1 off */ | 243 | /* three valued logic variables: 0 indifferent, 1 on, -1 off */ |
244 | signed char appkey; /* application keypad */ | 244 | signed char appkey; /* application keypad */ |
245 | signed char appcursor; /* application cursor */ | 245 | signed char appcursor; /* application cursor */ |
246 | signed char crlf; /* crlf mode */ | 246 | signed char crlf; /* crlf mode */ |
247 | } Key; | 247 | } Key; |
248 | 248 | ||
249 | typedef struct { | 249 | typedef struct { |
@@ -1182,7 +1182,7 @@ sigchld(int a) { | |||
1182 | int stat = 0; | 1182 | int stat = 0; |
1183 | 1183 | ||
1184 | if(waitpid(pid, &stat, 0) < 0) | 1184 | if(waitpid(pid, &stat, 0) < 0) |
1185 | die("Waiting for pid %hd failed: %s\n", pid, SERRNO); | 1185 | die("Waiting for pid %hd failed: %s\n", pid, SERRNO); |
1186 | 1186 | ||
1187 | if(WIFEXITED(stat)) { | 1187 | if(WIFEXITED(stat)) { |
1188 | exit(WEXITSTATUS(stat)); | 1188 | exit(WEXITSTATUS(stat)); |
@@ -1821,7 +1821,7 @@ tsetmode(bool priv, bool set, int *args, int narg) { | |||
1821 | tclearregion(0, 0, term.col-1, | 1821 | tclearregion(0, 0, term.col-1, |
1822 | term.row-1); | 1822 | term.row-1); |
1823 | } | 1823 | } |
1824 | if(set ^ alt) /* set is always 1 or 0 */ | 1824 | if(set ^ alt) /* set is always 1 or 0 */ |
1825 | tswapscreen(); | 1825 | tswapscreen(); |
1826 | if(*args != 1049) | 1826 | if(*args != 1049) |
1827 | break; | 1827 | break; |
@@ -2184,10 +2184,10 @@ techo(char *buf, int len) { | |||
2184 | for(; len > 0; buf++, len--) { | 2184 | for(; len > 0; buf++, len--) { |
2185 | char c = *buf; | 2185 | char c = *buf; |
2186 | 2186 | ||
2187 | if(c == '\033') { /* escape */ | 2187 | if(c == '\033') { /* escape */ |
2188 | tputc("^", 1); | 2188 | tputc("^", 1); |
2189 | tputc("[", 1); | 2189 | tputc("[", 1); |
2190 | } else if(c < '\x20') { /* control code */ | 2190 | } else if(c < '\x20') { /* control code */ |
2191 | if(c != '\n' && c != '\r' && c != '\t') { | 2191 | if(c != '\n' && c != '\r' && c != '\t') { |
2192 | c |= '\x40'; | 2192 | c |= '\x40'; |
2193 | tputc("^", 1); | 2193 | tputc("^", 1); |
@@ -2258,31 +2258,31 @@ tputc(char *c, int len) { | |||
2258 | */ | 2258 | */ |
2259 | if(control) { | 2259 | if(control) { |
2260 | switch(ascii) { | 2260 | switch(ascii) { |
2261 | case '\t': /* HT */ | 2261 | case '\t': /* HT */ |
2262 | tputtab(1); | 2262 | tputtab(1); |
2263 | return; | 2263 | return; |
2264 | case '\b': /* BS */ | 2264 | case '\b': /* BS */ |
2265 | tmoveto(term.c.x-1, term.c.y); | 2265 | tmoveto(term.c.x-1, term.c.y); |
2266 | return; | 2266 | return; |
2267 | case '\r': /* CR */ | 2267 | case '\r': /* CR */ |
2268 | tmoveto(0, term.c.y); | 2268 | tmoveto(0, term.c.y); |
2269 | return; | 2269 | return; |
2270 | case '\f': /* LF */ | 2270 | case '\f': /* LF */ |
2271 | case '\v': /* VT */ | 2271 | case '\v': /* VT */ |
2272 | case '\n': /* LF */ | 2272 | case '\n': /* LF */ |
2273 | /* go to first col if the mode is set */ | 2273 | /* go to first col if the mode is set */ |
2274 | tnewline(IS_SET(MODE_CRLF)); | 2274 | tnewline(IS_SET(MODE_CRLF)); |
2275 | return; | 2275 | return; |
2276 | case '\a': /* BEL */ | 2276 | case '\a': /* BEL */ |
2277 | if(!(xw.state & WIN_FOCUSED)) | 2277 | if(!(xw.state & WIN_FOCUSED)) |
2278 | xseturgency(1); | 2278 | xseturgency(1); |
2279 | return; | 2279 | return; |
2280 | case '\033': /* ESC */ | 2280 | case '\033': /* ESC */ |
2281 | csireset(); | 2281 | csireset(); |
2282 | term.esc = ESC_START; | 2282 | term.esc = ESC_START; |
2283 | return; | 2283 | return; |
2284 | case '\016': /* SO */ | 2284 | case '\016': /* SO */ |
2285 | case '\017': /* SI */ | 2285 | case '\017': /* SI */ |
2286 | /* | 2286 | /* |
2287 | * Different charsets are hard to handle. Applications | 2287 | * Different charsets are hard to handle. Applications |
2288 | * should use the right alt charset escapes for the | 2288 | * should use the right alt charset escapes for the |
@@ -2290,15 +2290,15 @@ tputc(char *c, int len) { | |||
2290 | * rest is incompatible history st should not support. | 2290 | * rest is incompatible history st should not support. |
2291 | */ | 2291 | */ |
2292 | return; | 2292 | return; |
2293 | case '\032': /* SUB */ | 2293 | case '\032': /* SUB */ |
2294 | case '\030': /* CAN */ | 2294 | case '\030': /* CAN */ |
2295 | csireset(); | 2295 | csireset(); |
2296 | return; | 2296 | return; |
2297 | case '\005': /* ENQ (IGNORED) */ | 2297 | case '\005': /* ENQ (IGNORED) */ |
2298 | case '\000': /* NUL (IGNORED) */ | 2298 | case '\000': /* NUL (IGNORED) */ |
2299 | case '\021': /* XON (IGNORED) */ | 2299 | case '\021': /* XON (IGNORED) */ |
2300 | case '\023': /* XOFF (IGNORED) */ | 2300 | case '\023': /* XOFF (IGNORED) */ |
2301 | case 0177: /* DEL (IGNORED) */ | 2301 | case 0177: /* DEL (IGNORED) */ |
2302 | return; | 2302 | return; |
2303 | } | 2303 | } |
2304 | } else if(term.esc & ESC_START) { | 2304 | } else if(term.esc & ESC_START) { |
@@ -2963,9 +2963,9 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) { | |||
2963 | } | 2963 | } |
2964 | /* | 2964 | /* |
2965 | * Those ranges will not be brightened: | 2965 | * Those ranges will not be brightened: |
2966 | * 8 - 15 – bright system colors | 2966 | * 8 - 15 – bright system colors |
2967 | * 196 - 231 – highest 256 color cube | 2967 | * 196 - 231 – highest 256 color cube |
2968 | * 252 - 255 – brightest colors in greyscale | 2968 | * 252 - 255 – brightest colors in greyscale |
2969 | */ | 2969 | */ |
2970 | font = &dc.bfont; | 2970 | font = &dc.bfont; |
2971 | frcflags = FRC_BOLD; | 2971 | frcflags = FRC_BOLD; |