hex dump w/ or w/out utf-8 chars

Chris Angelico rosuav at gmail.com
Sat Jul 13 11:46:40 CEST 2013

On Sat, Jul 13, 2013 at 5:56 PM,  <wxjmfauth at gmail.com> wrote:
> Try to write an editor, a text widget, with with a coding
> scheme like the Flexible String Represenation. You will
> quickly notice, it is impossible (understand correctly).
> (You do not need a computer, just a sheet of paper and a pencil)
> Hint: what is the character at the caret position?

I would use an internal representation that allows insertion and
deletion - in its simplest form, a list of strings. And those strings
would be whatever I can most conveniently work with.

I've never built a text editor widget, because my libraries always
provide them. But there is a rough parallel in the display storage for
Gypsum, which stores a series of lines, each of which is a series of
sections in different colors. (A line might be a single section, ie
one color for its whole length.) I store them in arrays of (color,
string, color, string, color, string...). The strings I use are in the
format wanted by my display subsystem - which in my case is the native
string type of the language, which... oh, what a pity for jmf, is a
flexible object that uses 8, 16, or 32 bits for each character.


More information about the Python-list mailing list