diff options
author | Sam Ravnborg <sam@mars.ravnborg.org> | 2005-11-19 17:38:06 -0500 |
---|---|---|
committer | Sam Ravnborg <sam@mars.ravnborg.org> | 2005-11-19 17:38:06 -0500 |
commit | fa7009d5b59b8acd8071f7b3057d36eeeaf08146 (patch) | |
tree | ba88e9f448aed4c047d8ce311ba44c8731ee96c2 /scripts/lxdialog/inputbox.c | |
parent | a06104af7dcf2f5bafaf18f373c8b2554cbfe014 (diff) |
kconfig: Add print_title helper in lxdialog
Simplify check for long title and use a helper function in util.c
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts/lxdialog/inputbox.c')
-rw-r--r-- | scripts/lxdialog/inputbox.c | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/scripts/lxdialog/inputbox.c b/scripts/lxdialog/inputbox.c index bc135c7093d9..779503726b0a 100644 --- a/scripts/lxdialog/inputbox.c +++ b/scripts/lxdialog/inputbox.c | |||
@@ -66,20 +66,7 @@ int dialog_inputbox(const char *title, const char *prompt, int height, int width | |||
66 | wattrset(dialog, dialog_attr); | 66 | wattrset(dialog, dialog_attr); |
67 | waddch(dialog, ACS_RTEE); | 67 | waddch(dialog, ACS_RTEE); |
68 | 68 | ||
69 | if (title != NULL && strlen(title) >= width - 2) { | 69 | print_title(dialog, title, width); |
70 | /* truncate long title -- mec */ | ||
71 | char *title2 = malloc(width - 2 + 1); | ||
72 | memcpy(title2, title, width - 2); | ||
73 | title2[width - 2] = '\0'; | ||
74 | title = title2; | ||
75 | } | ||
76 | |||
77 | if (title != NULL) { | ||
78 | wattrset(dialog, title_attr); | ||
79 | mvwaddch(dialog, 0, (width - strlen(title)) / 2 - 1, ' '); | ||
80 | waddstr(dialog, (char *)title); | ||
81 | waddch(dialog, ' '); | ||
82 | } | ||
83 | 70 | ||
84 | wattrset(dialog, dialog_attr); | 71 | wattrset(dialog, dialog_attr); |
85 | print_autowrap(dialog, prompt, width - 2, 1, 3); | 72 | print_autowrap(dialog, prompt, width - 2, 1, 3); |