Menu

#999 \t causes trouble with justified text

open
5
2003-11-12
2001-03-28
Anonymous
No

If \t is included in text that is center or right
justified (using tag configure -justify) the tab
characters appear on the screen as small rectangles -
of the style often used for unavailable characters.

This occurs with Tk8.3 on windows (possibly others, I
don't know)

This looks excessively yucky!

I guess there are possible situations in which \t makes
no sense in justified text. In these cases I would
suggest the best course is not to write anything on the
screen for the \t character, and to raise an error
which could be processed or ignored using catch

Discussion

  • Don Porter

    Don Porter - 2001-03-28
    • labels: --> 18. [text]
     
  • Donal K. Fellows

    Logged In: YES
    user_id=79902

    Could someone provide a test script? Tabs should not be
    displayed at all, given that they should instead just move
    you to the next tab stop in a text widget...

    NB: should not show up at all on UNIX/X where unrecognised
    characters are simply not drawn (this difference is not due
    to Tk, but rather X itself IIRC.)

     
  • Nobody/Anonymous

    Logged In: NO

    OK, here is a script illustrating the problem. The boxes are
    certainly visible on windoze, haven't tried this on X.

    Ian

    # illustrating the justified tab problem

    text .t -font {times 12}
    pack .t

    .t tag configure cen -justify center
    .t insert end "This line does not contain tabs\n" cen
    .t insert end "This one \tdoes,\thowever" cen

     
  • Vince Darley

    Vince Darley - 2003-11-12

    Logged In: YES
    user_id=32170

    Reproduced with Tk 8.5a0.

    What we need is a coherent proposal for how tags and tabs
    and justify and lmargin1/2 should interact.

    What is the desired behaviour in this case? Show a single
    space? Show nothing?

     
  • Don Porter

    Don Porter - 2003-11-12
    • assigned_to: nobody --> vincentdarley
     
  • Vince Darley

    Vince Darley - 2003-11-13

    Logged In: YES
    user_id=32170

    The same problem occurs with right justification.

    I believe the following proposal is reasonably coherent:

    (i) when right justifying each tab inserts a gap back to the
    previous tab stop (from which right justification then
    continues)

    (ii) when centering, there is no sensible logical result, so
    I think the only thing which would be useful would be to
    insert a gap so that the next character is at the offset
    from the first character that it would be if we were left
    justifying. This will at least allow tabs to be used to
    arrange a regular tabular layout of information, say, where
    the whole tablular layout is centered, but tabs are used
    within to ensure regularity.

     
MongoDB Logo MongoDB