Implementing non-uniform tabstops on different lines (so I can go on to implement elastic tabstops)

118 views
Skip to first unread message

Nick Gravgaard

unread,
Apr 14, 2009, 1:47:52 PM4/14/09
to scintilla...@googlegroups.com
Hi everyone,

I'm the guy who came up with elastic tabstops (http://nickgravgaard.com/elastictabstops/), and I would like to see if I could implement it for Scintilla. I've previously implemented it for widgets which already had the ability to set non-uniform tabstops on different lines (a pre-requisite for elastic tabstops), and I would like to suggest extending Scintilla so it has this ability. This could be done by associating each line of text (paragraph) in the textbuffer with a list of widths (in pixels) between tabstops, and then using this information when laying out each line.

Would anyone be interested in this functionality and/or helping me implement it? It's useful for other things besides elastic tabstops, as the designers of Swing and GTK+ can testify. I intend to implement it either way, but it would be nice if I could get it into the official version. Also, can anyone give me any suggestions on the best way to implement it?

Thanks,
Nick

Neil Hodgson

unread,
Apr 14, 2009, 8:35:44 PM4/14/09
to scintilla...@googlegroups.com
Nick Gravgaard:

> but it would be nice if I could get it into the official version.

One of the rules for new features is that there should not be more
than minimal costs to existing users who do not want to use the new
feature. This means that there should not be any per-line memory used
unless there is some use of non-uniform tabstops. Also determining
that a line should be laid out with non-uniform tabstops should be
very fast.

Since this is positioning in terms of pixels, it is view-specific,
as each view of a document may use a different magnification factor
and even different styles.

Neil

Henry Roeland

unread,
Apr 15, 2009, 2:35:56 PM4/15/09
to scintilla...@googlegroups.com
Dear all,

We are busy moving from the MS RichEditor to the Scintilla editor. One
thing I found that Scintilla doesn’t support the EM_SETLIMITTEXT so there
is no (easy) way of limiting text input.

I already tried to limit input with some notification messages but I can’t
find a proper solution. This is because there looks to be no way to cut
off handling of the notification message e.g. for the SC_MOD_BEFOREINSERT
message.

Am I missing something here? Can anybody point me in the right direction.

Thanks in advantage,

Nick Gravgaard

unread,
Apr 15, 2009, 3:11:03 PM4/15/09
to scintilla...@googlegroups.com

Oh well, it was worth a try. If I try to add it for my own use, could you give me any pointers on the best approach?

Neil Hodgson

unread,
Apr 15, 2009, 6:45:53 PM4/15/09
to scintilla...@googlegroups.com
Henry Roeland:

> We are busy moving from the MS RichEditor to the Scintilla editor. One
> thing I found that Scintilla doesn’t support the EM_SETLIMITTEXT so there
> is no (easy) way of limiting text input.

Yes, and there are many different operations from paste to drag and
drop that can increase the number of characters.

> I already tried to limit input with some notification messages but I can’t
> find a proper solution.

About the only way to handle this is to intercept all I/O
(keyboard, mouse, ...) using platform calls and only allow through
those that you know will not overflow.

Neil

Neil Hodgson

unread,
Apr 18, 2009, 3:10:29 AM4/18/09
to scintilla...@googlegroups.com
Nick Gravgaard:

> Oh well, it was worth a try. If I try to add it for my own use, could
> you give me any pointers on the best approach?

Think about how the document deals with per-line state. You should
put something in Editor::NotifyModified to modify your data structure
as lines are added and deleted.

Neil

Reply all
Reply to author
Forward
0 new messages