Friday, 4 February 2011

Thoughts on CRiSP - line/word wrap

Been a while since I spoke about CRiSP ( ).
CRiSP has had a long evolutionary life - a very powerful and productive
editor, which provides many features. Rather than talk about
what it does, lets start a series talking about what it
doesn't do, or maybe what it should do.

Todays topic will be line wrapping and word wrapping.

Line wrapping is a useful feature. When CRiSP was implemented,
the goal was horizontal scrolling. When CRiSP was born, a 20MB hard drive
was considered large; floppies were the media of choice for backup
(or QIC tape). Most files were small, and saving space, using
tabs instead of spaces was important.

When you control the editor and you control the files - everything
is warm and cozy.

But when you start viewing other peoples files or auto generated files,
you dont have so much control. If lines are no more than a few screen
lines in width, line wrap is important.

[We all take it for granted, in word processors, and browsers, that
text will flow automatically as you resize these days].

The computational effort to dynamically resize is moderate.
[Browsers have a huge and horrible task to determine layout - its
a recursive and iterative process to layout the items on a web page,
and web page authors do what it takes to make an effect, with no
concern for the CPU power needed to achieve that effect - hence the
arms race for cpu power across computers, laptops and even mobile

Word wrap - again, a technique we all take for granted - is more
difficult. Conceptually, its easy: just lay out words whilst they
fit onto a line and then start a new line when we run out of room.

The problem becomes that we now need to know how we layed out the
words for those times as the user clicks on words or parts of words.

An additional difficulty is handling very long lines - lines longer
than the screen can display, whilst handling infinitely long files.
Once we start doing this, problems arise, like in the browser, where
we have to be careful that we dont jump around the screen and we
can map mouse clicks to the thing that was clicked on.

If we go one level further, then we hit proportional width fonts.
But we will save that one for another day.

[Have you ever loaded a "large" file or web page into the browser
and wondered why it can be slow, or why the memory consumption can go
through the roof? Thats because browsers dont optimise for "infinite",
but for reality. An editor is different.]

If you want to find out more about CRiSP, visit

Post created by CRiSP v10.0.3a-b5937

No comments:

Post a Comment