Use Editor::moveCursorToEndOfLine to make the code more readable
Use editor.getText()
Reduce the need for escape quotes

If the string contains `’` surround with `”` if the string contains `”`
surround with `’`’.