hacky fix for adjusting editable lines on undo/redo - seems to work but lots of code duplication