improved the implementation of insertLineBefore insertLine After
    Added helper function inserLine
    also wraped replaceRange in cm.operation