--- Begin Message ---
- To: submit@bugs.debian.org
- Subject: xmessage wrong window size displaying message with tabs [PATCH]
- From: Kevin Ryde <user42@zip.com.au>
- Date: 08 Oct 1999 07:40:29 +1000
- Message-id: <87btaavohe.fsf@bananas.org.au>
Package: xcontrib
Version: 3.3.2-5.3
I'm using this version recompiled for slink on a PC clone.
I noticed that xmessage can get its initial window size wrong when
displaying a message containing tab characters. For example, create a
file containing
<tab><tab><tab>hello world
and run
xmessage -file foo
and it shows scroll bars rather than making its window big enough.
Attached is a patch that converts tabs to spaces in the message, both
for file and command line messages. Tab stops are 8 characters (hard
coded), newlines are understood.
--- xmessage.c.old Fri Oct 8 05:47:42 1999
+++ xmessage.c Fri Oct 8 05:47:16 1999
@@ -29,6 +29,7 @@
*/
+#include <assert.h>
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <X11/Shell.h>
@@ -163,6 +164,60 @@
exit(default_exitstatus);
}
+/* Convert tabs to spaces in *messagep,*lengthp, copying to a new block of
+ memory. */
+void
+detab (char **messagep, int *lengthp)
+{
+ int i, n, col, psize;
+ char *p;
+
+ /* count how many tabs there are */
+ n = 0;
+ for (i = 0; i < *lengthp; i++)
+ if ((*messagep)[i] == '\t')
+ n++;
+
+ /* length increases by at most seven extra spaces for each tab */
+ psize = *lengthp + n*7 + 1;
+ p = XtMalloc (psize);
+
+ /* convert tabs to spaces, copying into p */
+ n = 0;
+ col = 0;
+ for (i = 0; i < *lengthp; i++)
+ {
+ switch ((*messagep)[i]) {
+ case '\n':
+ p[n++] = '\n';
+ col = 0;
+ break;
+ case '\t':
+ do
+ {
+ p[n++] = ' ';
+ col++;
+ }
+ while ((col % 8) != 0);
+ break;
+ default:
+ p[n++] = (*messagep)[i];
+ col++;
+ break;
+ }
+ }
+
+ assert (n < psize);
+
+ /* null-terminator needed by Label widget */
+ p[n] = '\0';
+
+ free (*messagep);
+
+ *messagep = p;
+ *lengthp = n;
+}
+
static XtActionsRec actions_list[] = {
{"exit", exit_action},
{"default-exit", default_exit_action},
@@ -240,6 +295,8 @@
XtAppAddActions(app_con, actions_list, XtNumber(actions_list));
XtOverrideTranslations(top, XtParseTranslationTable(top_trans));
+
+ detab (&message_str, &message_len);
/*
* create the query form; this is where most of the real work is done
--- End Message ---
--- Begin Message ---
Source: x11-utils
Source-Version: 7.3+1
We believe that the bug you reported is fixed in the latest version of
x11-utils, which is due to be installed in the Debian FTP archive:
x11-utils_7.3+1.dsc
to pool/main/x/x11-utils/x11-utils_7.3+1.dsc
x11-utils_7.3+1.tar.gz
to pool/main/x/x11-utils/x11-utils_7.3+1.tar.gz
x11-utils_7.3+1_i386.deb
to pool/main/x/x11-utils/x11-utils_7.3+1_i386.deb
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to 46892@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Brice Goglin <bgoglin@debian.org> (supplier of updated x11-utils package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Format: 1.7
Date: Wed, 22 Aug 2007 08:25:17 +0200
Source: x11-utils
Binary: x11-utils
Architecture: source i386
Version: 7.3+1
Distribution: unstable
Urgency: low
Maintainer: Debian X Strike Force <debian-x@lists.debian.org>
Changed-By: Brice Goglin <bgoglin@debian.org>
Description:
x11-utils - X11 utilities
Closes: 46892
Changes:
x11-utils (7.3+1) unstable; urgency=low
.
[ Julien Cristau ]
* xmessage 1.0.2.
+ Untabify message before inserting it (closes: #46892). Thanks, Kevin
Ryde!
* xprop 1.0.3.
.
[ Brice Goglin ]
* Add upstream URL to debian/copyright.
* Add menu entries for editres, xev, xfontsel and xkill.
* xvinfo 1.0.2.
* xdriinfo 1.0.2.
+ Drop 03_xvinfo_manpage_typo.diff, merged upstream.
* xwininfo 1.0.3.
* Add myself to Uploaders, and remove Branden with his permission.
Files:
3ecae962c122898cbcb0e806989c1c48 1228 x11 optional x11-utils_7.3+1.dsc
e790360cb9f81ed0de16710cc2cdbc9d 2100601 x11 optional x11-utils_7.3+1.tar.gz
53e18feeb6cf551d5460df9d5d788195 197890 x11 optional x11-utils_7.3+1_i386.deb
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFG6wCDRh88F8PcWfoRAjccAKDDQN2B4nFSZlkmO8BZ6yVvy2fkSACgoKXW
qMnrnM5fi2h5G+9HWpSKta4=
=rtb/
-----END PGP SIGNATURE-----
--- End Message ---