Web lists-archives.com

Re: G_UTF8String: Boxed Type Proposal




On 03/19/2016 06:57 AM, Randall Sawyer wrote:
> 
> Some object classes - such as GtkEntryBuffer - store this value and
> update it as text is inserted or deleted. That is efficient. The fact
> that developers need to write equivalent code for each such class is
> inefficient.

A string abstraction like the one you describe is not an efficient way
to do text processing, especially for interactive widgets.

It's much better to split things into two data-structures.

1) An append only buffer with all text content.
2) A pointer table with start:end tuples representing ranges in the
append only buffer.

And if you are doing a full text editing widget like GtkTextView:

3) Other necessary indexes are similar to #2, with interval trees. (Line
height, row calculations, format tags, etc)

This simplifies unlimited undo, mmap()'ing large input data, avoiding
large memmove()s and simplifying incremental utf-8 validations.

Before we add new data structures to GLib, we like to have a solid use
case for which the data structure solves. So far, I haven't seen a
concrete problem for which this data structure would be the ideal fix.

-- Christian
_______________________________________________
gtk-devel-list mailing list
gtk-devel-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-devel-list