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).
| t0 | t01 | t1 | t12 | t2 |
|---|
 | set-width = 3 |  | insert space |  |
| placeholder | placeholder |
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.
| t0 | t01 | t1 |
|---|
 | backspace |  |
| propagation is not possible. |
But if there are enough empty space on the previous line,
then backward propagation must occur.
| t0 | t01 | t1 |
|---|
 | backspace |  |
| backward propagation occur! |
placeholder.
| t0 | t01 | t1 |
|---|
 | backspace |  |
| backward propagation occur! |
Also a forward propagate is possible!
| t0 | t01 | t1 |
|---|
 | 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?
| t0 | t01 | t1 |
|---|
 | 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.
| t0 | t01 | t1 |
|---|
 | insert 'x' |  |
| typical insertion |
In word-wrap mode when a line exceeds the border of the
view then its propagated to the next line.
| t0 | t01 | t1 |
|---|
 | insert 'x' |  |
| propagation occured! |
A minor problem related to wrapping spaces. Is this
the way to do it? I think so.
| t0 | t01 | t1 |
|---|
 | insert space |  |
| What should we do with spaces? |
Watch out backward propagation is also possible with insertion.
| t0 | t01 | t1 |
|---|
 | 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.
| t0 | t01 | t1 |
|---|
 | move right |  |
| typical behavier as we know it. |
placeholder.
| t0 | t01 | t1 |
|---|
 | move right |  |
| the cursor gets transfered to next line. |
placeholder.
| t0 | t01 | t1 |
|---|
 | 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.
| t0 | t01 | t1 | t12 | t2 |
|---|
 | move right |  | insert 'x' |  |
| virtual space. | virtual space become real space. |