summaryrefslogtreecommitdiffstats
path: root/contrib/dialog/util.c
diff options
context:
space:
mode:
authordteske <dteske@FreeBSD.org>2013-09-24 14:52:43 +0000
committerdteske <dteske@FreeBSD.org>2013-09-24 14:52:43 +0000
commit6633bf70ed24c304037f64ca2f28e6ea8d2a0b47 (patch)
tree928bd26d2edefc51e3476336efb87361f214c616 /contrib/dialog/util.c
parent8a88ce9ab8eb02eeeb3167855ff0ac0f381dad7e (diff)
downloadFreeBSD-src-6633bf70ed24c304037f64ca2f28e6ea8d2a0b47.zip
FreeBSD-src-6633bf70ed24c304037f64ca2f28e6ea8d2a0b47.tar.gz
Update dialog to 1.2-20130923.
Approved by: re (marius)
Diffstat (limited to 'contrib/dialog/util.c')
-rw-r--r--contrib/dialog/util.c53
1 files changed, 42 insertions, 11 deletions
diff --git a/contrib/dialog/util.c b/contrib/dialog/util.c
index ddd3246..73a05a9 100644
--- a/contrib/dialog/util.c
+++ b/contrib/dialog/util.c
@@ -1,5 +1,5 @@
/*
- * $Id: util.c,v 1.255 2013/05/23 22:58:28 tom Exp $
+ * $Id: util.c,v 1.258 2013/09/22 00:41:40 tom Exp $
*
* util.c -- miscellaneous utilities for dialog
*
@@ -589,18 +589,21 @@ end_dialog(void)
int
dlg_count_real_columns(const char *text)
{
- int result = dlg_count_columns(text);
- if (result && dialog_vars.colors) {
- int hidden = 0;
- while (*text) {
- if (dialog_vars.colors && isOurEscape(text)) {
- hidden += ESCAPE_LEN;
- text += ESCAPE_LEN;
- } else {
- ++text;
+ int result = 0;
+ if (*text) {
+ result = dlg_count_columns(text);
+ if (result && dialog_vars.colors) {
+ int hidden = 0;
+ while (*text) {
+ if (dialog_vars.colors && isOurEscape(text)) {
+ hidden += ESCAPE_LEN;
+ text += ESCAPE_LEN;
+ } else {
+ ++text;
+ }
}
+ result -= hidden;
}
- result -= hidden;
}
return result;
}
@@ -924,6 +927,7 @@ dlg_print_line(WINDOW *win,
test_ptr++;
if (*test_ptr == '\n')
test_ptr++;
+ dlg_finish_string(prompt);
return (test_ptr);
}
@@ -1989,6 +1993,7 @@ dlg_draw_title(WINDOW *win, const char *title)
wmove(win, 0, x);
dlg_print_text(win, title, getmaxx(win) - x, &attr);
(void) wattrset(win, save);
+ dlg_finish_string(title);
}
}
@@ -2552,6 +2557,32 @@ dlg_add_separator(void)
dlg_add_result(separator);
}
+#define HELP_PREFIX "HELP "
+
+void
+dlg_add_help_listitem(int *result, char **tag, DIALOG_LISTITEM * item)
+{
+ dlg_add_result(HELP_PREFIX);
+ if (USE_ITEM_HELP(item->help)) {
+ *tag = dialog_vars.help_tags ? item->name : item->help;
+ *result = DLG_EXIT_ITEM_HELP;
+ } else {
+ *tag = item->name;
+ }
+}
+
+void
+dlg_add_help_formitem(int *result, char **tag, DIALOG_FORMITEM * item)
+{
+ dlg_add_result(HELP_PREFIX);
+ if (USE_ITEM_HELP(item->help)) {
+ *tag = dialog_vars.help_tags ? item->name : item->help;
+ *result = DLG_EXIT_ITEM_HELP;
+ } else {
+ *tag = item->name;
+ }
+}
+
/*
* Some widgets support only one value of a given variable - save/restore the
* global dialog_vars so we can override it consistently.
OpenPOWER on IntegriCloud