function ensureEmptyLastLine(editor) {
  var session = editor.getSession(),
      lines = session.getLength(),
      lastline = lines ? session.getLine(lines - 1) : '',
      curpos = editor.getCursorPosition(),
      newpos;
  if (lastline.length > 0) {
    session.insert(
        {row: Math.max(0, lines - 1), column: lastline.length},
        session.getDocument().getNewLineCharacter());
    newpos = editor.getCursorPosition();
    if (newpos.row !== curpos.row || newpos.column !== curpos.column) {
      editor.moveCursorToPosition(curpos);
    }
  }
}
// So ensure there is always one empty line at the end of the document.
So ensure there is always one empty line at the end of the document.
So ensure there is always one empty line at the end of the document .
function ensureEmptyLastLine(editor) {
  var session = editor.getSession(),
      lines = session.getLength(),
      lastline = lines ? session.getLine(lines - 1) : '',
      curpos = editor.getCursorPosition(),
      newpos;
  if (lastline.length > 0) {
    session.insert(
        {row: Math.max(0, lines - 1), column: lastline.length},
        session.getDocument().getNewLineCharacter());
    newpos = editor.getCursorPosition();
    if (newpos.row !== curpos.row || newpos.column !== curpos.column) {
      editor.moveCursorToPosition(curpos);
    }
  }
}
function ensureEmptyLastLine ( editor ) { var session = editor . getSession ( ) , lines = session . getLength ( ) , lastline = lines ? session . getLine ( lines - 1 ) : '' , curpos = editor . getCursorPosition ( ) , newpos ; if ( lastline . length > 0 ) { session . insert ( { row : Math . max ( 0 , lines - 1 ) , column : lastline . length } , session . getDocument ( ) . getNewLineCharacter ( ) ) ; newpos = editor . getCursorPosition ( ) ; if ( newpos . row !== curpos . row || newpos . column !== curpos . column ) { editor . moveCursorToPosition ( curpos ) ; } } }
So ensure there is always one empty line at the end of the document.
So ensure there is always one empty line at the end of the document .