diff options
author | gabrielgio <gabrielgio@workstation.lan> | 2024-02-17 17:13:07 +0100 |
---|---|---|
committer | gabrielgio <gabrielgio@workstation.lan> | 2024-02-17 17:13:07 +0100 |
commit | 0a2e62f57734f820cd20e151d1150342408552ed (patch) | |
tree | e1e9c786571bf1d856ba42c4c6cf014b008822c4 /lib/ui.c | |
parent | 78b0ba12073b0940541d91a7568e8b7ada572848 (diff) | |
download | dict-0a2e62f57734f820cd20e151d1150342408552ed.tar.gz dict-0a2e62f57734f820cd20e151d1150342408552ed.tar.bz2 dict-0a2e62f57734f820cd20e151d1150342408552ed.zip |
ref: Apply astyle --style=linux
Diffstat (limited to 'lib/ui.c')
-rw-r--r-- | lib/ui.c | 36 |
1 files changed, 19 insertions, 17 deletions
@@ -9,7 +9,8 @@ const char *uload = "█"; -PROGRESS_BAR* new_progress_bar(WINDOW* scr, float total) { +PROGRESS_BAR* new_progress_bar(WINDOW* scr, float total) +{ PROGRESS_BAR *bar = (PROGRESS_BAR*)malloc(sizeof(PROGRESS_BAR)); bar->scr = scr; bar->total = total; @@ -17,7 +18,8 @@ PROGRESS_BAR* new_progress_bar(WINDOW* scr, float total) { return bar; } -void bar_step(PROGRESS_BAR* bar, float step){ +void bar_step(PROGRESS_BAR* bar, float step) +{ bar->current += step; int x, y; @@ -42,13 +44,12 @@ void bar_step(PROGRESS_BAR* bar, float step){ wmove(bar->scr, hy+1, hx - len); wprintw(bar->scr, "%.0f/%.0f", bar->current, bar->total); - wmove(bar->scr,0,0); wrefresh(bar->scr); } - -TEXT_BOX* new_text_box(WINDOW* scr, int length) { +TEXT_BOX* new_text_box(WINDOW* scr, int length) +{ TEXT_BOX *text = (TEXT_BOX*)malloc(sizeof(TEXT_BOX)); text->scr = scr; text->length = length; @@ -58,22 +59,23 @@ TEXT_BOX* new_text_box(WINDOW* scr, int length) { return text; } -void get_char(TEXT_BOX* text, void (*sch)(char*, int)) { - while(1){ +void get_char(TEXT_BOX* text, void (*sch)(char*, int)) +{ + while(1) { wchar_t c; get_wch((wint_t*)&c); switch(c) { - case KEY_BACKSPACE: - if (text->current > 0) { - text->text[text->current--] = '\0'; - } - break; - default: - if (text->current < (text->length-2)) { - text->text[text->current] = c; - text->text[++text->current] = '\0'; - } + case KEY_BACKSPACE: + if (text->current > 0) { + text->text[text->current--] = '\0'; + } + break; + default: + if (text->current < (text->length-2)) { + text->text[text->current] = c; + text->text[++text->current] = '\0'; + } } char str[text->length]; |