[comp.windows.x] xedit tabs problem

steve@acorn.co.uk (Steve "daffy" Hunt) (11/30/88)

X11r3 running unmodified on a Sun 3/60 /dev/bwtwo0

Xedit does not display tabs!

I knew of a similar bug in r2 when the text widget got the tab
distance wrong when fitted with a scrollbar.  It made the tab
approximately 5 spaces instead of 8.  Since the text widget has been
thoroughly worked over for R3, I hoped this had been fixed... but
it seems to be a bit worse...

Is there a fix for this one, or am I just using it wrong?

--- Steve Hunt.   Acorn, Cambridge, UK.   daffy@acorn.co.uk

dcr0@bunny.UUCP (David Robbins) (12/02/88)

steve@acorn.co.uk (Steve "daffy" Hunt) writes:
> Xedit does not display tabs!

I noticed exactly the same problem just the other day, and yesterday I spent
the time looking at xedit to figure out why it does not display tabs.
The reason is simple: xedit uses the AsciiSink part of the AsciiText
widget to display text, and while AsciiSink does know how to display
tabs, it is not being told what the tab stops are.  The reason for that
is that xedit does not create an AsciiText widget (the only way for the
AsciiSink to display tabs properly is for the application to create one of
the two variants of AsciiText).  What xedit does, however, is to create a
Text widget that uses xedit's own special source and use AsciiSink.  The
problem is, there is absolutely no interface provided to the application for
setting tabs.

This morning, I hacked xedit to display tabs.  What I did was simply provide
a function in AsciiText to pass an array of tab stops to the SetTabs function
of whatever sink AsciiText is using, and added code to xedit to use that
function.  This is a quick hack, and I'm not yet convinced that it is really
the right thing to do.  After further thinking about the hack, and QA on it,
I may convince myself that it is worthy of being passed on to the net.  As
an alternative, perhaps someone else has already solved the problem in a
better way, and is willing to post the solution.

The right thing to do, however, is to augment the AsciiText widget to
provide both an application interface to set tabs and the capability to
pick up tabs from a resource.  Even further, handling tabs correctly with
proportional fonts requires a different concept of tabs than the character-
position concept that AsciiSink now uses.  There is a great opportunity here
for some enhancements to the widget, which I am not prepared to undertake
today (maybe tomorrow :-).
-- 

Dave Robbins                    GTE Laboratories Incorporated
drobbins@gte.com                40 Sylvan Rd.
...!harvard!bunny!drobbins      Waltham, MA 02254