Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] elastic tabstops implemented for SWT

On Thu, 07 Jan 2010 07:30 -0700, "Phil Borlin"
<rancidfishbreath@xxxxxxxxx> wrote:
> Nick,
> 
> The summary in your paper states:
> 
> "Each cell ends with a tab character. A column block is a run of
> uninterrupted vertically adjacent cells. A column block is as wide as
> the widest piece of text in the cells it contains or a minimum width
> (plus padding). Text outside column blocks is ignored."
> 
> The issue here is the algorithm that determines when one column block
> ends and the next one begins.  To me (and I think this is what Bogdan
> was getting at) it seems like this algorithm would have to be language
> dependent.

The algorithm I described in the first 2 sentences of that summary
("Each cell ends with a tab character. A column block is a run of
uninterrupted vertically adjacent cells.") works really well across
languages and is simple, generic and consistent. Please study the
diagram and play with the demo. The guys on the Go team at Google could
have done anything they wanted yet they adopted elastic tabstops
unchanged without adding any language dependent stuff to it (Go is
another squiggly bracket language just like C or Java). Also, I have
personally been using elastic tabstops with both C/C++ and Python
(languages with quite different ideas about indentation) as well as in
plain text files for tabulation for a couple of years now and it works
fine. I've been looking at this issue for years and have yet to see
anything which tries to use squiggly brackets {} or other language
features in conjunction with tabs to guess what the user wants aligned
(which is presumably what a language aware solution would try and do)
that brought anything extra except needless complexity. I am firmly of
the opinion that a simple and consistent approach ("run of uninterrupted
vertically adjacent cells") is better - it's always the same,
predictable and easy to use. If users feel they can't predict it's
behaviour they won't use it. I know this for a fact.

> What might belong in SWT (maybe StyledText) is a layout engine that
> when given a column block strategy will perform the elastic tab
> functionality.  In this scenario JDT, CDT, etc would add a strategy
> that defines their block boundaries.

Like I said, I'm determined that this remain language agnostic. Please
trust me when I say that to do otherwise will just make the system seem
less predictable and more confusing, which is not what people want when
editing code.

Anyway, we seem to agree that the text widget would need to change. What
should we do next?

Nick

> On Wed, Jan 6, 2010 at 12:18 PM, Nick Gravgaard <me@xxxxxxxxxxxxxxxxx>
> wrote:
> > Hi Grant + Bogdan,
> >
> > I'm not sure what you mean. I think elastic tabstops are a generic
> > editor feature in the same way that conventional fixed tabstops are.
> > They are useful in Java, C, Python and apparently Go (and probably other
> > languages) as well as in good old text files and are handy when editing
> > and viewing tab separated database dumps or just lining up tabular data.
> > With this in mind I thought the text editing widget would be the place
> > (rather than anything Java specific), hence my posting to this list.
> >
> > Does that make sense?
> > Nick
> >
> >
> > On Wed, 06 Jan 2010 13:52 -0500, "Bogdan Gheorghe" <gheorghe@xxxxxxxxxx>
> > wrote:
> >> Hi Nick -
> >>
> >> Your demo looks interesting and it could a valuable option for Eclipse
> >> users. Just to confirm: the tabbing behavior is controlled by the
> >> context,
> >> right? If so, this would make its implementation language dependent - to
> >> get it working with the Java editor, you would need JDT support. Perhaps
> >> the JDT mailing list (jdt-dev@xxxxxxxxxxx ) would be more appropriate for
> >> this question.
> >>
> >> Thanks,
> >> Grant + Bogdan
> >>
> >>
> >>
> >>
> >>
> >> From:
> >> "Nick Gravgaard" <me@xxxxxxxxxxxxxxxxx>
> >> To:
> >> "Eclipse Platform SWT component developers list."
> >> <platform-swt-dev@xxxxxxxxxxx>
> >> Date:
> >> 01/05/2010 12:42 PM
> >> Subject:
> >> [platform-swt-dev] elastic tabstops implemented for SWT
> >> Sent by:
> >> platform-swt-dev-bounces@xxxxxxxxxxx
> >>
> >>
> >>
> >> Hi everyone,
> >>
> >> I'm the inventor of something called "elastic tabstops" (
> >> http://nickgravgaard.com/elastictabstops/ includes a Java Swing applet
> >> demo). It has generally been favourably received and was recently adopted
> >> by Google in their new Go programming language for formatting code (
> >> http://golang.org/pkg/tabwriter/). I would like the functionality you can
> >> see in my Java Swing applet demo (tabstops move as user modifies text) to
> >> be available to Eclipse users (either as a plugin or built in).
> >>
> >> I'm hoping that I can get a discussion started here on what the best way
> >> to implement this would be (performance is one of my main concerns), and
> >> maybe generate enough interest that some of you might be interested in
> >> helping me implement it. There was a missing feature (
> >> https://bugs.eclipse.org/bugs/show_bug.cgi?id=279356) which was blocking
> >> me, but that's been resolved now.
> >>
> >> Nick
> >> _______________________________________________
> >> platform-swt-dev mailing list
> >> platform-swt-dev@xxxxxxxxxxx
> >> https://dev.eclipse.org/mailman/listinfo/platform-swt-dev
> >>
> >>
> > _______________________________________________
> > platform-swt-dev mailing list
> > platform-swt-dev@xxxxxxxxxxx
> > https://dev.eclipse.org/mailman/listinfo/platform-swt-dev
> >
> _______________________________________________
> platform-swt-dev mailing list
> platform-swt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/platform-swt-dev


Back to the top