patch-2.2.2 linux/scripts/lxdialog/textbox.c

Next file: linux/scripts/lxdialog/yesno.c
Previous file: linux/scripts/lxdialog/msgbox.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.1/linux/scripts/lxdialog/textbox.c linux/scripts/lxdialog/textbox.c
@@ -106,6 +106,14 @@
     wbkgdset (dialog, dialog_attr & A_COLOR);
     waddch (dialog, ACS_RTEE);
 
+    if (title != NULL && strlen(title) >= width-2 ) {
+	/* truncate long title -- mec */
+	char * title2 = malloc(width-2+1);
+	memcpy( title2, title, width-2 );
+	title2[width-2] = '\0';
+	title = title2;
+    }
+
     if (title != NULL) {
 	wattrset (dialog, title_attr);
 	mvwaddch (dialog, 0, (width - strlen(title))/2 - 1, ' ');

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)