| 240 | } |
| 241 | |
| 242 | void dialog_clear(void) |
| 243 | { |
| 244 | int lines, columns; |
| 245 | |
| 246 | lines = getmaxy(stdscr); |
| 247 | columns = getmaxx(stdscr); |
| 248 | |
| 249 | attr_clear(stdscr, lines, columns, dlg.screen.atr); |
| 250 | /* Display background title if it exists ... - SLH */ |
| 251 | if (dlg.backtitle != NULL) { |
| 252 | int i, len = 0, skip = 0; |
| 253 | struct subtitle_list *pos; |
| 254 | |
| 255 | wattrset(stdscr, dlg.screen.atr); |
| 256 | mvwaddstr(stdscr, 0, 1, (char *)dlg.backtitle); |
| 257 | |
| 258 | for (pos = dlg.subtitles; pos != NULL; pos = pos->next) { |
| 259 | /* 3 is for the arrow and spaces */ |
| 260 | len += strlen(pos->text) + 3; |
| 261 | } |
| 262 | |
| 263 | wmove(stdscr, 1, 1); |
| 264 | if (len > columns - 2) { |
| 265 | const char *ellipsis = "[...] "; |
| 266 | waddstr(stdscr, ellipsis); |
| 267 | skip = len - (columns - 2 - strlen(ellipsis)); |
| 268 | } |
| 269 | |
| 270 | for (pos = dlg.subtitles; pos != NULL; pos = pos->next) { |
| 271 | if (skip == 0) |
| 272 | waddch(stdscr, ACS_RARROW); |
| 273 | else |
| 274 | skip--; |
| 275 | |
| 276 | if (skip == 0) |
| 277 | waddch(stdscr, ' '); |
| 278 | else |
| 279 | skip--; |
| 280 | |
| 281 | if (skip < strlen(pos->text)) { |
| 282 | waddstr(stdscr, pos->text + skip); |
| 283 | skip = 0; |
| 284 | } else |
| 285 | skip -= strlen(pos->text); |
| 286 | |
| 287 | if (skip == 0) |
| 288 | waddch(stdscr, ' '); |
| 289 | else |
| 290 | skip--; |
| 291 | } |
| 292 | |
| 293 | for (i = len + 1; i < columns - 1; i++) |
| 294 | waddch(stdscr, ACS_HLINE); |
| 295 | } |
| 296 | wnoutrefresh(stdscr); |
| 297 | } |
| 298 | |
| 299 | /* |
no test coverage detected