MCPcopy Create free account
hub / github.com/Entware/Entware / dialog_clear

Function dialog_clear

scripts/config/lxdialog/util.c:242–297  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

240}
241
242void 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/*

Callers 10

show_textbox_extFunction · 0.85
search_confFunction · 0.85
conf_choiceFunction · 0.85
conf_stringFunction · 0.85
conf_loadFunction · 0.85
conf_saveFunction · 0.85
confFunction · 0.85
handle_exitFunction · 0.85
init_dialogFunction · 0.85
on_key_resizeFunction · 0.85

Calls 1

attr_clearFunction · 0.85

Tested by

no test coverage detected