Index: uspace/lib/clui/tinput.c
===================================================================
--- uspace/lib/clui/tinput.c	(revision 1b20da07baaa3e3c424f62c927274e676e4295cd)
+++ uspace/lib/clui/tinput.c	(revision f1380b76772fb5d1aa03637b5e57bd9b929fea61)
@@ -75,9 +75,9 @@
 {
 	tinput_t *ti;
-	
+
 	ti = calloc(1, sizeof(tinput_t));
 	if (ti == NULL)
 		return NULL;
-	
+
 	tinput_init(ti);
 	return ti;
@@ -107,12 +107,12 @@
 	if (!dbuf)
 		return;
-	
+
 	size_t sa;
 	size_t sb;
 	tinput_sel_get_bounds(ti, &sa, &sb);
-	
+
 	tinput_console_set_lpos(ti, ti->text_coord + start);
 	console_set_style(ti->console, STYLE_NORMAL);
-	
+
 	size_t p = start;
 	if (p < sa) {
@@ -122,9 +122,9 @@
 		p = sa;
 	}
-	
+
 	if (p < sb) {
 		console_flush(ti->console);
 		console_set_style(ti->console, STYLE_SELECTED);
-		
+
 		memcpy(dbuf, ti->buffer + p,
 		    (sb - p) * sizeof(wchar_t));
@@ -133,8 +133,8 @@
 		p = sb;
 	}
-	
+
 	console_flush(ti->console);
 	console_set_style(ti->console, STYLE_NORMAL);
-	
+
 	if (p < ti->nc) {
 		memcpy(dbuf, ti->buffer + p,
@@ -143,8 +143,8 @@
 		printf("%ls", dbuf);
 	}
-	
+
 	for (p = 0; p < pad; p++)
 		putchar(' ');
-	
+
 	console_flush(ti->console);
 
@@ -188,8 +188,8 @@
 {
 	sysarg_t col0, row0;
-	
+
 	if (console_get_pos(ti->console, &col0, &row0) != EOK)
 		return EIO;
-	
+
 	ti->prompt_coord = row0 * ti->con_cols + col0;
 	ti->text_coord = ti->prompt_coord + str_length(ti->prompt);
@@ -206,5 +206,5 @@
 	if (ti->nc == INPUT_MAX_SIZE)
 		return;
-	
+
 	unsigned new_width = LIN_TO_COL(ti, ti->text_coord) + ti->nc + 1;
 	if (new_width % ti->con_cols == 0) {
@@ -216,9 +216,9 @@
 		}
 	}
-	
+
 	size_t i;
 	for (i = ti->nc; i > ti->pos; i--)
 		ti->buffer[i] = ti->buffer[i - 1];
-	
+
 	ti->buffer[ti->pos] = c;
 	ti->pos += 1;
@@ -226,5 +226,5 @@
 	ti->buffer[ti->nc] = '\0';
 	ti->sel_start = ti->pos;
-	
+
 	tinput_display_tail(ti, ti->pos - 1, 0);
 	tinput_update_origin(ti);
@@ -237,5 +237,5 @@
 	if (ilen == 0)
 		return;
-	
+
 	unsigned new_width = LIN_TO_COL(ti, ti->text_coord) + ti->nc + ilen;
 	unsigned new_height = (new_width / ti->con_cols) + 1;
@@ -244,5 +244,5 @@
 		return;
 	}
-	
+
 	if (ti->nc > 0) {
 		size_t i;
@@ -250,5 +250,5 @@
 			ti->buffer[i + ilen - 1] = ti->buffer[i - 1];
 	}
-	
+
 	size_t off = 0;
 	size_t i = 0;
@@ -257,18 +257,18 @@
 		if (c == '\0')
 			break;
-		
+
 		/* Filter out non-printable chars. */
 		if (c < 32)
 			c = 32;
-		
+
 		ti->buffer[ti->pos + i] = c;
 		i++;
 	}
-	
+
 	ti->pos += ilen;
 	ti->nc += ilen;
 	ti->buffer[ti->nc] = '\0';
 	ti->sel_start = ti->pos;
-	
+
 	tinput_display_tail(ti, ti->pos - ilen, 0);
 	tinput_update_origin(ti);
@@ -282,17 +282,17 @@
 		return;
 	}
-	
+
 	if (ti->pos == 0)
 		return;
-	
+
 	size_t i;
 	for (i = ti->pos; i < ti->nc; i++)
 		ti->buffer[i - 1] = ti->buffer[i];
-	
+
 	ti->pos -= 1;
 	ti->nc -= 1;
 	ti->buffer[ti->nc] = '\0';
 	ti->sel_start = ti->pos;
-	
+
 	tinput_display_tail(ti, ti->pos, 1);
 	tinput_position_caret(ti);
@@ -305,11 +305,11 @@
 		return;
 	}
-	
+
 	if (ti->pos == ti->nc)
 		return;
-	
+
 	ti->pos += 1;
 	ti->sel_start = ti->pos;
-	
+
 	tinput_backspace(ti);
 }
@@ -318,5 +318,5 @@
 {
 	tinput_pre_seek(ti, shift_held);
-	
+
 	if (dir == seek_forward) {
 		if (ti->pos < ti->nc)
@@ -326,5 +326,5 @@
 			ti->pos -= 1;
 	}
-	
+
 	tinput_post_seek(ti, shift_held);
 }
@@ -333,15 +333,15 @@
 {
 	tinput_pre_seek(ti, shift_held);
-	
+
 	if (dir == seek_forward) {
 		if (ti->pos == ti->nc)
 			return;
-		
+
 		while (true) {
 			ti->pos += 1;
-			
+
 			if (ti->pos == ti->nc)
 				break;
-			
+
 			if ((ti->buffer[ti->pos - 1] == ' ') &&
 			    (ti->buffer[ti->pos] != ' '))
@@ -351,18 +351,18 @@
 		if (ti->pos == 0)
 			return;
-		
+
 		while (true) {
 			ti->pos -= 1;
-			
+
 			if (ti->pos == 0)
 				break;
-			
+
 			if (ti->buffer[ti->pos - 1] == ' ' &&
 			    ti->buffer[ti->pos] != ' ')
 				break;
 		}
-	
-	}
-	
+
+	}
+
 	tinput_post_seek(ti, shift_held);
 }
@@ -371,5 +371,5 @@
 {
 	tinput_pre_seek(ti, shift_held);
-	
+
 	if (dir == seek_forward) {
 		if (ti->pos + ti->con_cols <= ti->nc)
@@ -379,5 +379,5 @@
 			ti->pos = ti->pos - ti->con_cols;
 	}
-	
+
 	tinput_post_seek(ti, shift_held);
 }
@@ -403,10 +403,10 @@
 {
 	tinput_pre_seek(ti, shift_held);
-	
+
 	if (dir == seek_backward)
 		ti->pos = 0;
 	else
 		ti->pos = ti->nc;
-	
+
 	tinput_post_seek(ti, shift_held);
 }
@@ -431,5 +431,5 @@
 		ti->sel_start = ti->pos;
 	}
-	
+
 	tinput_position_caret(ti);
 }
@@ -443,11 +443,11 @@
 			free(ti->history[HISTORY_LEN]);
 	}
-	
+
 	size_t i;
 	for (i = ti->hnum; i > 1; i--)
 		ti->history[i] = ti->history[i - 1];
-	
+
 	ti->history[1] = str_dup(str);
-	
+
 	if (ti->history[0] != NULL) {
 		free(ti->history[0]);
@@ -492,16 +492,16 @@
 	size_t sa;
 	size_t sb;
-	
+
 	tinput_sel_get_bounds(ti, &sa, &sb);
 	if (sa == sb)
 		return;
-	
+
 	memmove(ti->buffer + sa, ti->buffer + sb,
 	    (ti->nc - sb) * sizeof(wchar_t));
-	
+
 	ti->pos = ti->sel_start = sa;
 	ti->nc -= (sb - sa);
 	ti->buffer[ti->nc] = '\0';
-	
+
 	tinput_display_tail(ti, sa, sb - sa);
 	tinput_position_caret(ti);
@@ -512,9 +512,9 @@
 	size_t sa;
 	size_t sb;
-	
+
 	tinput_sel_get_bounds(ti, &sa, &sb);
-	
+
 	char *str;
-	
+
 	if (sb < ti->nc) {
 		wchar_t tmp_c = ti->buffer[sb];
@@ -524,14 +524,14 @@
 	} else
 		str = wstr_to_astr(ti->buffer + sa);
-	
+
 	if (str == NULL)
 		goto error;
-	
+
 	if (clipboard_put_str(str) != EOK)
 		goto error;
-	
+
 	free(str);
 	return;
-	
+
 error:
 	/* TODO: Give the user some kind of warning. */
@@ -543,10 +543,10 @@
 	char *str;
 	errno_t rc = clipboard_get_str(&str);
-	
+
 	if ((rc != EOK) || (str == NULL)) {
 		/* TODO: Give the user some kind of warning. */
 		return;
 	}
-	
+
 	tinput_insert_string(ti, str);
 	free(str);
@@ -562,17 +562,17 @@
 			return;
 	}
-	
+
 	if (ti->history[ti->hpos] != NULL) {
 		free(ti->history[ti->hpos]);
 		ti->history[ti->hpos] = NULL;
 	}
-	
+
 	ti->history[ti->hpos] = tinput_get_str(ti);
 	ti->hpos += offs;
-	
+
 	int pad = (int) ti->nc - str_length(ti->history[ti->hpos]);
 	if (pad < 0)
 		pad = 0;
-	
+
 	tinput_set_str(ti, ti->history[ti->hpos]);
 	tinput_display_tail(ti, 0, pad);
@@ -620,5 +620,5 @@
 	for (i = 0; i < cnum; i++)
 		max_width = max(max_width, str_width(compl[i]));
-	
+
 	unsigned int cols = max(1, (ti->con_cols + 1) / (max_width + 1));
 	unsigned int padding = 0;
@@ -628,7 +628,7 @@
 	unsigned int col_width = max_width + padding / cols;
 	unsigned int rows = cnum / cols + ((cnum % cols) != 0);
-	
+
 	unsigned int row, col;
-	
+
 	for (row = 0; row < rows; row++) {
 		unsigned int display_col = 0;
@@ -786,9 +786,9 @@
 	if (ti->prompt != NULL)
 		free(ti->prompt);
-	
+
 	ti->prompt = str_dup(prompt);
 	if (ti->prompt == NULL)
 		return ENOMEM;
-	
+
 	return EOK;
 }
@@ -815,17 +815,17 @@
 	    ((kev->mods & (KM_ALT | KM_SHIFT)) == 0))
 		tinput_key_ctrl(ti, kev);
-	
+
 	if (((kev->mods & KM_SHIFT) != 0) &&
 	    ((kev->mods & (KM_CTRL | KM_ALT)) == 0))
 		tinput_key_shift(ti, kev);
-	
+
 	if (((kev->mods & KM_CTRL) != 0) &&
 	    ((kev->mods & KM_SHIFT) != 0) &&
 	    ((kev->mods & KM_ALT) == 0))
 		tinput_key_ctrl_shift(ti, kev);
-	
+
 	if ((kev->mods & (KM_CTRL | KM_ALT | KM_SHIFT)) == 0)
 		tinput_key_unmod(ti, kev);
-	
+
 	if (kev->c >= ' ') {
 		tinput_sel_delete(ti);
@@ -868,5 +868,5 @@
 	if (console_get_size(ti->console, &ti->con_cols, &ti->con_rows) != EOK)
 		return EIO;
-	
+
 	tinput_set_str(ti, istr);
 
@@ -874,15 +874,15 @@
 	ti->done = false;
 	ti->exit_clui = false;
-	
+
 	if (tinput_display(ti) != EOK)
 		return EIO;
-	
+
 	while (!ti->done) {
 		console_flush(ti->console);
-		
+
 		cons_event_t ev;
 		if (!console_get_event(ti->console, &ev))
 			return EIO;
-		
+
 		switch (ev.type) {
 		case CEV_KEY:
@@ -897,18 +897,18 @@
 		}
 	}
-	
+
 	if (ti->exit_clui)
 		return ENOENT;
-	
+
 	ti->pos = ti->nc;
 	tinput_position_caret(ti);
 	putchar('\n');
-	
+
 	char *str = tinput_get_str(ti);
 	if (str_cmp(str, "") != 0)
 		tinput_history_insert(ti, str);
-	
+
 	ti->hpos = 0;
-	
+
 	*dstr = str;
 	return EOK;
