head 1.4; access; symbols pkgsrc-2013Q2:1.4.0.38 pkgsrc-2013Q2-base:1.4 pkgsrc-2012Q4:1.4.0.36 pkgsrc-2012Q4-base:1.4 pkgsrc-2011Q4:1.4.0.34 pkgsrc-2011Q4-base:1.4 pkgsrc-2011Q2:1.4.0.32 pkgsrc-2011Q2-base:1.4 pkgsrc-2009Q4:1.4.0.30 pkgsrc-2009Q4-base:1.4 pkgsrc-2008Q4:1.4.0.28 pkgsrc-2008Q4-base:1.4 pkgsrc-2008Q3:1.4.0.26 pkgsrc-2008Q3-base:1.4 cube-native-xorg:1.4.0.24 cube-native-xorg-base:1.4 pkgsrc-2008Q2:1.4.0.22 pkgsrc-2008Q2-base:1.4 pkgsrc-2008Q1:1.4.0.20 pkgsrc-2008Q1-base:1.4 pkgsrc-2007Q4:1.4.0.18 pkgsrc-2007Q4-base:1.4 pkgsrc-2007Q3:1.4.0.16 pkgsrc-2007Q3-base:1.4 pkgsrc-2007Q2:1.4.0.14 pkgsrc-2007Q2-base:1.4 pkgsrc-2007Q1:1.4.0.12 pkgsrc-2007Q1-base:1.4 pkgsrc-2006Q4:1.4.0.10 pkgsrc-2006Q4-base:1.4 pkgsrc-2006Q3:1.4.0.8 pkgsrc-2006Q3-base:1.4 pkgsrc-2006Q2:1.4.0.6 pkgsrc-2006Q2-base:1.4 pkgsrc-2006Q1:1.4.0.4 pkgsrc-2006Q1-base:1.4 pkgsrc-2005Q4:1.4.0.2 pkgsrc-2005Q4-base:1.4 pkgsrc-2005Q3:1.3.0.24 pkgsrc-2005Q3-base:1.3 pkgsrc-2005Q2:1.3.0.22 pkgsrc-2005Q2-base:1.3 pkgsrc-2005Q1:1.3.0.20 pkgsrc-2005Q1-base:1.3 pkgsrc-2004Q4:1.3.0.18 pkgsrc-2004Q4-base:1.3 pkgsrc-2004Q3:1.3.0.16 pkgsrc-2004Q3-base:1.3 pkgsrc-2004Q2:1.3.0.14 pkgsrc-2004Q2-base:1.3 pkgsrc-2004Q1:1.3.0.12 pkgsrc-2004Q1-base:1.3 pkgsrc-2003Q4:1.3.0.10 pkgsrc-2003Q4-base:1.3 netbsd-1-6-1:1.3.0.6 netbsd-1-6-1-base:1.3 netbsd-1-6:1.3.0.8 netbsd-1-6-RELEASE-base:1.3 pkgviews:1.3.0.4 pkgviews-base:1.3 buildlink2:1.3.0.2 buildlink2-base:1.3 netbsd-1-5-PATCH003:1.3 netbsd-1-5-PATCH001:1.3 netbsd-1-5-RELEASE:1.3 netbsd-1-4-PATCH003:1.3 netbsd-1-4-PATCH002:1.2 comdex-fall-1999:1.2 netbsd-1-4-PATCH001:1.2 netbsd-1-4-RELEASE:1.2 netbsd-1-3-PATCH003:1.2; locks; strict; comment @# @; 1.4 date 2005.09.30.22.02.56; author wiz; state dead; branches; next 1.3; 1.3 date 2000.07.28.20.30.11; author jlam; state Exp; branches; next 1.2; 1.2 date 98.08.07.11.10.14; author agc; state Exp; branches; next 1.1; 1.1 date 98.05.26.22.07.20; author tron; state Exp; branches; next ; desc @@ 1.4 log @Update to 1.0.20050911. Changes since 1997 (or 1995?) are too many to mention here, see http://dickey.his.com/dialog/CHANGES for details. Closes PR pkg/30856. @ text @$NetBSD: patch-ae,v 1.3 2000/07/28 20:30:11 jlam Exp $ --- inputbox.c.orig Fri Aug 18 07:39:51 1995 +++ inputbox.c Fri Jul 28 15:30:22 2000 @@@@ -29,11 +29,21 @@@@ dialog_inputbox (const char *title, const char *prompt, int height, int width, const char *init) { - int i, x, y, box_y, box_x, box_width; - int input_x = 0, scroll = 0, key = 0, button = -1; + int i, j, x, y, box_y, box_x, box_width; + int input_x = 0, d_scroll = 0, key = 0, button = -1; unsigned char *instr = dialog_input_result; WINDOW *dialog; + /* Choose useful default height and width if they are negative */ + if (height < 0) + height = strheight(prompt) + 4 + 2; + if (width < 0) { + i = strwidth(prompt); + j = ((title != NULL) ? strwidth(title) : 0); + width = MAX (i, j) + 4; + } + width = MAX (width, MIN_DIALOG_WIDTH); + /* center dialog box on screen */ x = (COLS - width) / 2; y = (LINES - height) / 2; @@@@ -91,10 +101,10 @@@@ strcpy (instr, init); input_x = strlen (instr); if (input_x >= box_width) { - scroll = input_x - box_width + 1; + d_scroll = input_x - box_width + 1; input_x = box_width - 1; for (i = 0; i < box_width - 1; i++) - waddch (dialog, instr[scroll + i]); + waddch (dialog, instr[d_scroll + i]); } else waddstr (dialog, instr); wmove (dialog, box_y, box_x + input_x); @@@@ -118,19 +128,19 @@@@ continue; case KEY_BACKSPACE: case 127: - if (input_x || scroll) { + if (input_x || d_scroll) { wattrset (dialog, inputbox_attr); if (!input_x) { - scroll = scroll < box_width - 1 ? - 0 : scroll - (box_width - 1); + d_scroll = d_scroll < box_width - 1 ? + 0 : d_scroll - (box_width - 1); wmove (dialog, box_y, box_x); for (i = 0; i < box_width; i++) - waddch (dialog, instr[scroll + input_x + i] ? - instr[scroll + input_x + i] : ' '); - input_x = strlen (instr) - scroll; + waddch (dialog, instr[d_scroll + input_x + i] ? + instr[d_scroll + input_x + i] : ' '); + input_x = strlen (instr) - d_scroll; } else input_x--; - instr[scroll + input_x] = '\0'; + instr[d_scroll + input_x] = '\0'; wmove (dialog, box_y, input_x + box_x); waddch (dialog, ' '); wmove (dialog, box_y, input_x + box_x); @@@@ -139,15 +149,15 @@@@ continue; default: if (key < 0x100 && isprint (key)) { - if (scroll + input_x < MAX_LEN) { + if (d_scroll + input_x < MAX_LEN) { wattrset (dialog, inputbox_attr); - instr[scroll + input_x] = key; - instr[scroll + input_x + 1] = '\0'; + instr[d_scroll + input_x] = key; + instr[d_scroll + input_x + 1] = '\0'; if (input_x == box_width - 1) { - scroll++; + d_scroll++; wmove (dialog, box_y, box_x); for (i = 0; i < box_width - 1; i++) - waddch (dialog, instr[scroll + i]); + waddch (dialog, instr[d_scroll + i]); } else { wmove (dialog, box_y, input_x++ + box_x); waddch (dialog, key); @ 1.3 log @Make use of new USE_CURSES functionality. @ text @d1 1 a1 1 $NetBSD$ @ 1.2 log @Add NetBSD RCS Ids. @ text @d3 3 a5 3 --- inputbox.c.orig Fri Jan 23 17:37:12 1998 +++ inputbox.c Fri Jan 23 18:15:24 1998 @@@@ -29,10 +29,20 @@@@ d10 1 d12 1 a12 1 int input_x = 0, scroll = 0, key = 0, button = -1; d15 1 a15 1 + d25 1 a25 1 d28 62 @ 1.1 log @New "dialog" package supplied by Johnny C. Lam in PR pkg/4993. @ text @d1 2 @