Homework 5

I would like to clarify what is expected in this homework. You are not to write a full editor, supporting mouse or arrow keys. All you need to do is to print the current line of text with some indication of the cursor, let us say the symbol "|", and wait for one of the commands: where c is a single character; perform the requested operation and then print the modified line of text.

Here is a sample:

|
insert A
A|
insert B
AB|
insert C
ABC|
left
AB|C
insert D
ABD|C
left
AB|DC
delete
AB|C
Note that things might be more user-friendly if insert followed by an immediate delete undid the insert. But according to the book, you would have to do: insert X, left, delete. Just goes to show you how important is the correct problem definition.