aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/lxdialog/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/kconfig/lxdialog/util.c')
-rw-r--r--scripts/kconfig/lxdialog/util.c45
1 files changed, 43 insertions, 2 deletions
diff --git a/scripts/kconfig/lxdialog/util.c b/scripts/kconfig/lxdialog/util.c
index 109d53117d22..a0e97c299410 100644
--- a/scripts/kconfig/lxdialog/util.c
+++ b/scripts/kconfig/lxdialog/util.c
@@ -257,12 +257,48 @@ void dialog_clear(void)
257 attr_clear(stdscr, LINES, COLS, dlg.screen.atr); 257 attr_clear(stdscr, LINES, COLS, dlg.screen.atr);
258 /* Display background title if it exists ... - SLH */ 258 /* Display background title if it exists ... - SLH */
259 if (dlg.backtitle != NULL) { 259 if (dlg.backtitle != NULL) {
260 int i; 260 int i, len = 0, skip = 0;
261 struct subtitle_list *pos;
261 262
262 wattrset(stdscr, dlg.screen.atr); 263 wattrset(stdscr, dlg.screen.atr);
263 mvwaddstr(stdscr, 0, 1, (char *)dlg.backtitle); 264 mvwaddstr(stdscr, 0, 1, (char *)dlg.backtitle);
265
266 for (pos = dlg.subtitles; pos != NULL; pos = pos->next) {
267 /* 3 is for the arrow and spaces */
268 len += strlen(pos->text) + 3;
269 }
270
264 wmove(stdscr, 1, 1); 271 wmove(stdscr, 1, 1);
265 for (i = 1; i < COLS - 1; i++) 272 if (len > COLS - 2) {
273 const char *ellipsis = "[...] ";
274 waddstr(stdscr, ellipsis);
275 skip = len - (COLS - 2 - strlen(ellipsis));
276 }
277
278 for (pos = dlg.subtitles; pos != NULL; pos = pos->next) {
279 if (skip == 0)
280 waddch(stdscr, ACS_RARROW);
281 else
282 skip--;
283
284 if (skip == 0)
285 waddch(stdscr, ' ');
286 else
287 skip--;
288
289 if (skip < strlen(pos->text)) {
290 waddstr(stdscr, pos->text + skip);
291 skip = 0;
292 } else
293 skip -= strlen(pos->text);
294
295 if (skip == 0)
296 waddch(stdscr, ' ');
297 else
298 skip--;
299 }
300
301 for (i = len + 1; i < COLS - 1; i++)
266 waddch(stdscr, ACS_HLINE); 302 waddch(stdscr, ACS_HLINE);
267 } 303 }
268 wnoutrefresh(stdscr); 304 wnoutrefresh(stdscr);
@@ -302,6 +338,11 @@ void set_dialog_backtitle(const char *backtitle)
302 dlg.backtitle = backtitle; 338 dlg.backtitle = backtitle;
303} 339}
304 340
341void set_dialog_subtitles(struct subtitle_list *subtitles)
342{
343 dlg.subtitles = subtitles;
344}
345
305/* 346/*
306 * End using dialog functions. 347 * End using dialog functions.
307 */ 348 */