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/textbox.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/textbox.c')
-rw-r--r-- | scripts/lxdialog/textbox.c | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/scripts/lxdialog/textbox.c b/scripts/lxdialog/textbox.c index fa8d92ea02b6..77848bb8e07f 100644 --- a/scripts/lxdialog/textbox.c +++ b/scripts/lxdialog/textbox.c | |||
@@ -103,20 +103,8 @@ int dialog_textbox(const char *title, const char *file, int height, int width) | |||
103 | wbkgdset(dialog, dialog_attr & A_COLOR); | 103 | wbkgdset(dialog, dialog_attr & A_COLOR); |
104 | waddch(dialog, ACS_RTEE); | 104 | waddch(dialog, ACS_RTEE); |
105 | 105 | ||
106 | if (title != NULL && strlen(title) >= width - 2) { | 106 | print_title(dialog, title, width); |
107 | /* truncate long title -- mec */ | ||
108 | char *title2 = malloc(width - 2 + 1); | ||
109 | memcpy(title2, title, width - 2); | ||
110 | title2[width - 2] = '\0'; | ||
111 | title = title2; | ||
112 | } | ||
113 | 107 | ||
114 | if (title != NULL) { | ||
115 | wattrset(dialog, title_attr); | ||
116 | mvwaddch(dialog, 0, (width - strlen(title)) / 2 - 1, ' '); | ||
117 | waddstr(dialog, (char *)title); | ||
118 | waddch(dialog, ' '); | ||
119 | } | ||
120 | print_button(dialog, " Exit ", height - 2, width / 2 - 4, TRUE); | 108 | print_button(dialog, " Exit ", height - 2, width / 2 - 4, TRUE); |
121 | wnoutrefresh(dialog); | 109 | wnoutrefresh(dialog); |
122 | getyx(dialog, cur_y, cur_x); /* Save cursor position */ | 110 | getyx(dialog, cur_y, cur_x); /* Save cursor position */ |