Text editor base?

Remark 8

to use LEFT and RIGHT cursor it is a neat trick, to split
the text of a line into two variables textLeft and textRight
(left and right from the cursor position in the line).

Then you have full control.

Just display them as textLeft + textRight.
When you leave the line say text=textLeft + textRight;

Let’s say, you move the cursor 3 letters left and

  • click backspace: textLeft loses one letter
  • click a letter: textLeft wins a letter
  • click delete: textRight loses a letter on the left side
  • click enter: insert a new line with textRight as the new text; delete textRight from the previous line
1 Like