diff options
author | Sam Ravnborg <sam@mars.ravnborg.org> | 2005-11-19 21:56:20 +0100 |
---|---|---|
committer | Sam Ravnborg <sam@mars.ravnborg.org> | 2005-11-19 21:56:20 +0100 |
commit | dec69da856653772d7ee7b2f98dc69da27274a22 (patch) | |
tree | 020cf19de028a402a6bfc792caaffeddaf5a3e9b /scripts/lxdialog/inputbox.c | |
parent | b1c5f1c635f4a821f834ed51ccd8a2a1515fffd2 (diff) |
kconfig: fixup after Lindent
Readability are more important then the 80 coloumn limit, so fold
several lines to greatly improve readability.
Also keep return type on same line as function definition.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts/lxdialog/inputbox.c')
-rw-r--r-- | scripts/lxdialog/inputbox.c | 49 |
1 files changed, 15 insertions, 34 deletions
diff --git a/scripts/lxdialog/inputbox.c b/scripts/lxdialog/inputbox.c index 9e969156726..bc135c7093d 100644 --- a/scripts/lxdialog/inputbox.c +++ b/scripts/lxdialog/inputbox.c @@ -41,9 +41,8 @@ static void print_buttons(WINDOW * dialog, int height, int width, int selected) /* * Display a dialog box for inputing a string */ -int -dialog_inputbox(const char *title, const char *prompt, int height, int width, - const char *init) +int dialog_inputbox(const char *title, const char *prompt, int height, int width, + const char *init) { int i, x, y, box_y, box_x, box_width; int input_x = 0, scroll = 0, key = 0, button = -1; @@ -90,8 +89,7 @@ dialog_inputbox(const char *title, const char *prompt, int height, int width, getyx(dialog, y, x); box_y = y + 2; box_x = (width - box_width) / 2; - draw_box(dialog, y + 1, box_x - 1, 3, box_width + 2, - border_attr, dialog_attr); + draw_box(dialog, y + 1, box_x - 1, 3, box_width + 2, border_attr, dialog_attr); print_buttons(dialog, height, width, 0); @@ -111,8 +109,9 @@ dialog_inputbox(const char *title, const char *prompt, int height, int width, input_x = box_width - 1; for (i = 0; i < box_width - 1; i++) waddch(dialog, instr[scroll + i]); - } else + } else { waddstr(dialog, instr); + } wmove(dialog, box_y, box_x + input_x); @@ -136,26 +135,17 @@ dialog_inputbox(const char *title, const char *prompt, int height, int width, if (input_x || scroll) { wattrset(dialog, inputbox_attr); if (!input_x) { - scroll = - scroll < - box_width - 1 ? 0 : scroll - - (box_width - 1); + scroll = scroll < box_width - 1 ? 0 : scroll - (box_width - 1); wmove(dialog, box_y, box_x); for (i = 0; i < box_width; i++) waddch(dialog, - instr[scroll + - input_x + - i] ? - instr[scroll + - input_x + - i] : ' '); - input_x = - strlen(instr) - scroll; + instr[scroll + input_x + i] ? + instr[scroll + input_x + i] : ' '); + input_x = strlen(instr) - scroll; } else input_x--; instr[scroll + input_x] = '\0'; - mvwaddch(dialog, box_y, input_x + box_x, - ' '); + mvwaddch(dialog, box_y, input_x + box_x, ' '); wmove(dialog, box_y, input_x + box_x); wrefresh(dialog); } @@ -165,23 +155,14 @@ dialog_inputbox(const char *title, const char *prompt, int height, int width, if (scroll + input_x < MAX_LEN) { wattrset(dialog, inputbox_attr); instr[scroll + input_x] = key; - instr[scroll + input_x + 1] = - '\0'; + instr[scroll + input_x + 1] = '\0'; if (input_x == box_width - 1) { scroll++; - wmove(dialog, box_y, - box_x); - for (i = 0; - i < box_width - 1; - i++) - waddch(dialog, - instr - [scroll + - i]); + wmove(dialog, box_y, box_x); + for (i = 0; i < box_width - 1; i++) + waddch(dialog, instr [scroll + i]); } else { - wmove(dialog, box_y, - input_x++ + - box_x); + wmove(dialog, box_y, input_x++ + box_x); waddch(dialog, key); } wrefresh(dialog); |