Browse code

Fix formatting

John Hawthorn authored on 09/09/2018 21:12:00
Showing 1 changed files

... ...
@@ -7,12 +7,12 @@
7 7
 #include "tty_interface.h"
8 8
 #include "../config.h"
9 9
 
10
-static int isprint_unicode(char c){
11
-	return isprint(c) || c & (1<<7);
10
+static int isprint_unicode(char c) {
11
+	return isprint(c) || c & (1 << 7);
12 12
 }
13 13
 
14 14
 static int is_boundary(char c) {
15
-	return ~c & (1<<7) || c & (1<<6);
15
+	return ~c & (1 << 7) || c & (1 << 6);
16 16
 }
17 17
 
18 18
 static void clear(tty_interface_t *state) {
... ...
@@ -103,7 +103,7 @@ static void draw(tty_interface_t *state) {
103 103
 
104 104
 	tty_setcol(tty, 0);
105 105
 	fputs(options->prompt, tty->fout);
106
-	for(size_t i=0; i<state->cursor; i++)
106
+	for (size_t i = 0; i < state->cursor; i++)
107 107
 		fputc(state->search[i], tty->fout);
108 108
 	tty_flush(tty);
109 109
 }
... ...
@@ -144,13 +144,13 @@ static void action_emit(tty_interface_t *state) {
144 144
 static void action_del_char(tty_interface_t *state) {
145 145
 	if (*state->search) {
146 146
 		size_t length = strlen(state->search);
147
-		if(state->cursor == 0) {
147
+		if (state->cursor == 0) {
148 148
 			return;
149 149
 		}
150 150
 		size_t original_cursor = state->cursor;
151 151
 
152 152
 		state->cursor--;
153
-		while(!is_boundary(state->search[state->cursor]) && state->cursor)
153
+		while (!is_boundary(state->search[state->cursor]) && state->cursor)
154 154
 			state->cursor--;
155 155
 
156 156
 		memmove(&state->search[state->cursor], &state->search[original_cursor], length - original_cursor + 1);
... ...
@@ -182,7 +182,7 @@ static void action_prev(tty_interface_t *state) {
182 182
 }
183 183
 
184 184
 static void action_ignore(tty_interface_t *state) {
185
-	(void) state;
185
+	(void)state;
186 186
 }
187 187
 
188 188
 static void action_next(tty_interface_t *state) {
... ...
@@ -191,17 +191,17 @@ static void action_next(tty_interface_t *state) {
191 191
 }
192 192
 
193 193
 static void action_left(tty_interface_t *state) {
194
-	if (state->cursor > 0){
194
+	if (state->cursor > 0) {
195 195
 		state->cursor--;
196
-		while(!is_boundary(state->search[state->cursor]) && state->cursor)
196
+		while (!is_boundary(state->search[state->cursor]) && state->cursor)
197 197
 			state->cursor--;
198 198
 	}
199 199
 }
200 200
 
201 201
 static void action_right(tty_interface_t *state) {
202
-	if (state->cursor < strlen(state->search)){
202
+	if (state->cursor < strlen(state->search)) {
203 203
 		state->cursor++;
204
-		while(!is_boundary(state->search[state->cursor]))
204
+		while (!is_boundary(state->search[state->cursor]))
205 205
 			state->cursor++;
206 206
 	}
207 207
 }
... ...
@@ -216,13 +216,13 @@ static void action_end(tty_interface_t *state) {
216 216
 
217 217
 static void action_pageup(tty_interface_t *state) {
218 218
 	update_state(state);
219
-	for(size_t i = 0; i < state->options->num_lines && state->choices->selection > 0; i++)
219
+	for (size_t i = 0; i < state->options->num_lines && state->choices->selection > 0; i++)
220 220
 		choices_prev(state->choices);
221 221
 }
222 222
 
223 223
 static void action_pagedown(tty_interface_t *state) {
224 224
 	update_state(state);
225
-	for(size_t i = 0; i < state->options->num_lines && state->choices->selection < state->choices->available-1; i++)
225
+	for (size_t i = 0; i < state->options->num_lines && state->choices->selection < state->choices->available - 1; i++)
226 226
 		choices_next(state->choices);
227 227
 }
228 228