lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] wxHTML table header alignment


From: Greg Chicares
Subject: Re: [lmi] wxHTML table header alignment
Date: Wed, 11 Mar 2009 08:48:59 +0000
User-agent: Thunderbird 2.0.0.19 (Windows/20081209)

[I've pruned cc's: now that lists.gnu.org has un-crashed,
the list is again accepting email from me.]

On 2009-03-10 19:59Z, Vaclav Slavik wrote:
> On Mon, 2009-03-09 at 19:40 +0000, Greg Chicares wrote:
>         
>         In the columns that aren't bottom aligned, there's an extra
>         space at the end of each "row" except the last, which I've
>         indicated with '.' above. That extra space isn't a big problem;
>         I mention it in case it helps to explain why those headers
>         aren't bottom aligned. [1]
>         
> That's hard to avoid, because the space after a word is part of the word
> for layout purposes; wxHTML works with "EE ", "Gross " and "Payment"
> fragments ("cells" in wxHTML terminology), not with space-separated
> "EE", "Gross" and "Payment". This can (hopefully) be changed (and this
> defect fixed), but it won't be easy [2].
[...]
> [1] The whitespace at line ends is present in all multi-line columns,
>     not just those incorrectly vertically aligned; this was the case
>     before r56589 (r56590 in 2.8) too.
> 
> [2] I can't offer a meaningful estimate -- I don't even know how to do
>     it yet, let me know if I should spend some time thinking about the
>     necessary changes.

If we can get rid of a hundred tiny defects, each of which is almost
too small to notice on its own, then overall we'll have made the
program noticeably easier to use. But no single tiny defect is worth
much effort.

Please tell me whether this alternative idea seems poor:

Index: ledger_text_formats.cpp
===================================================================
RCS file: /sources/lmi/lmi/ledger_text_formats.cpp,v
retrieving revision 1.61
diff -U 3 -r1.61 ledger_text_formats.cpp
--- ledger_text_formats.cpp     27 Dec 2008 02:56:46 -0000      1.61
+++ ledger_text_formats.cpp     11 Mar 2009 03:31:15 -0000
@@ -321,7 +321,7 @@
     for(vsci i = columns_.begin(); i != columns_.end(); ++i)
         {
         ledger_metadata const& z = map_lookup(ledger_metadata_map(), *i);
-        oss << "<th valign=\"bottom\" width=\"" << width << "%\">" << 
z.legend_ << "</th>\n";
+        oss << "<td valign=\"bottom\" width=\"" << width << "%\">" << 
z.legend_ << " </td>\n";
         }
     oss << "</tr>\n";

Aside from using <td> instead of <th> so that headers aren't bold,
that patch simply inserts one extra space, changing html output thus:
-  "One Two Three"
+  "One Two Three "
                ^
Then we have three tokens {"One ", "Two ", "Three "}, each of which
ends in a space, so they all line up.

This actually creates a new microdefect, in that the headers don't
align exactly with the numbers below them, e.g.:

  Specified | <-- '|' marks the invisible table border
     Amount |
            | <-- we always write a blank line below headers
   1,000,000|

but in my judgment that's better than letting the alignment of
successive header rows differ. And I could trivially mask that
iatrogenic problem completely by writing a space after each
numeric table cell.

This change also solves a different problem that occurs only
with rather wide column headings: instead of...

  Specified
      AmountWithdrawal <-- "Withdrawal" is rather wide
           ^^ there's an invisible zero-width border here

...with the patch above we get...

  Specified
      Amount Withdrawal
            ^ now there's a space

I know I could achieve a somewhat similar effect with cellpadding
or cellspacing, but those insert space on the top, bottom, left,
and right, and I especially want to insert no vertical space.
(Any vertical padding means fewer rows fit on the screen.)

The more I consider this patch, the more I like it. Yet it'd be
good to hear your thoughts before I commit it, because I might be
missing some fragility. I do remember that you made some comment
about avoiding spaces in this html table once, but I think it was
the following, which wouldn't suggest that the spaces I propose
adding here are harmful, because below you suggested (temporarily)
avoiding only the '\n' in "</th>\n<th>":

http://lists.nongnu.org/archive/html/lmi/2008-10/msg00035.html
|
| As a temporary workaround before 2.8.10, it helps to eliminate the
| whitespace between closing </th> and the next <th>, e.g. like this:
|
| <th valign="bottom" width="8%">Net Outlay
| </th><th valign="bottom" width="8%">Specified Amount</th>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]