AEditor project
Simon Strandgaard
$Id: softwrap.rb,v 1.11 2003/09/24 20:43:58 neoneye Exp $

Consequences Of Word Wrap

Wordwrap has big impact on undo/redo. In this document I will try to identify special cases of some typical editing operations. At the same time undo/redo of a operation must restore to a state as close as possible to the original state (user friendly).

Resize

Changing the width of the view is interesting from a undo/redo point of view, because resize doesn't have any undo/redo data at all (its not a operation you can undo/redo).

t0t01t1t12t2
set-width = 3insert space
placeholderplaceholder

Backspace

You may know backspace as that key which deletes the character at the left side of the cursor. But in word-wrap mode there appears many special cases in backspaces behavier. Sometimes propagation is necessary.

t0t01t1
backspace
propagation is not possible.

But if there are enough empty space on the previous line, then backward propagation must occur.

t0t01t1
backspace
backward propagation occur!

placeholder.

t0t01t1
backspace
backward propagation occur!

Also a forward propagate is possible!

t0t01t1
backspace
forward propagation occur!

Deleting a the 'd' letter, then we have to deal with spaces. How does other editors deal with this paticular case?

t0t01t1
backspace
should we treat spaces like this?

Many absurd cases.. Is this the way backspace really should behave? Please tell me if you have other suggestions.

Insert

Insert a letter to the left side of the cursor.

t0t01t1
insert 'x'
typical insertion

In word-wrap mode when a line exceeds the border of the view then its propagated to the next line.

t0t01t1
insert 'x'
propagation occured!

A minor problem related to wrapping spaces. Is this the way to do it? I think so.

t0t01t1
insert space
What should we do with spaces?

Watch out backward propagation is also possible with insertion.

t0t01t1
insert space
backward propagation!

Horizontal Movement

Sideways movement of the cursor gets another behaver in word-wrap mode. Especialy those cases where the cursor were suppose to point to the 'spaces' which is outside the view. In such case it is necessary to make a compromise. Not nice at all.

t0t01t1
move right
typical behavier as we know it.

placeholder.

t0t01t1
move right
the cursor gets transfered to next line.

placeholder.

t0t01t1
move right
skipping spaces, tranfering cursor to next line.

At the end of the line there are virtual spaces. They only become real spaces when you start edit them.

t0t01t1t12t2
move rightinsert 'x'
virtual space.virtual space become real space.