Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!ukma!mailrus!ulowell!vaxine!bunny!dcr0
From: dcr0@bunny.UUCP (David Robbins)
Newsgroups: comp.windows.x
Subject: Re: xedit tabs problem
Message-ID: <6312@bunny.UUCP>
Date: 1 Dec 88 17:40:17 GMT
Reply-To: dcr0@bunny.UUCP (David Robbins)
Organization: GTE Laboratories, Waltham, MA
Lines: 36

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