Issue 1:
Uncaught TypeError: Cannot read property 'slice' of undefined

Atom Version: 0.162.0

System: linux 3.13.0-43-generic

Thrown From: Atom Core

Steps To Reproduce

I have undone some things (ctrl + z) and then redone (ctrl + shift + z).

Stack Trace

At /usr/share/atom/resources/app/node_modules/text-buffer/lib/text-buffer.js:557

TypeError: Cannot read property 'slice' of undefined
at TextBuffer.module.exports.TextBuffer.applyPatch (/usr/share/atom/resources/app/node_modules/text-buffer/lib/text-buffer.js:557:39)
at BufferPatch.module.exports.BufferPatch.applyTo (/usr/share/atom/resources/app/node_modules/text-buffer/lib/buffer-patch.js:74:21)
at Transaction.module.exports.Transaction.applyTo (/usr/share/atom/resources/app/node_modules/text-buffer/lib/transaction.js:60:29)
at History.module.exports.History.undo (/usr/share/atom/resources/app/node_modules/text-buffer/lib/history.js:84:24)
at TextBuffer.module.exports.TextBuffer.undo (/usr/share/atom/resources/app/node_modules/text-buffer/lib/text-buffer.js:675:27)
at TextEditor.module.exports.TextEditor.undo (/usr/share/atom/resources/app/src/text-editor.js:1137:26)
at TextEditor.atom.commands.add.stopEventPropagation.core:undo (/usr/share/atom/resources/app/src/text-editor-element.js:304:19)
at atom-text-editor.newCommandListeners.(anonymous function) (/usr/share/atom/resources/app/src/text-editor-element.js:272:32)
at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/usr/share/atom/resources/app/src/command-registry.js:243:29)
at /usr/share/atom/resources/app/src/command-registry.js:3:61
at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/usr/share/atom/resources/app/node_modules/atom-keymap/lib/keymap-manager.js:549:16)
at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/usr/share/atom/resources/app/node_modules/atom-keymap/lib/keymap-manager.js:391:22)
at HTMLDocument.module.exports.WindowEventHandler.onKeydown (/usr/share/atom/resources/app/src/window-event-handler.js:167:20)

Issue 2:
Steps To Reproduce:

Create an __ init __.py in a python package

Try to add a few new lines by typing enter (I can't have more than two lines)

Error

Uncaught TypeError: Cannot read property slice of undefined Atom Version: 0.158.0 System: linux 3.13.0-43-generic Thrown From: Atom Core

Stack Trace

At /usr/share/atom/resources/app/node_modules/text-buffer/lib/text-buffer.js:557

TypeError: Cannot read property 'slice' of undefined
at TextBuffer.module.exports.TextBuffer.applyPatch (/usr/share/atom/resources/app/node_modules/text-buffer/lib/text-buffer.js:557:39)
at BufferPatch.module.exports.BufferPatch.applyTo (/usr/share/atom/resources/app/node_modules/text-buffer/lib/buffer-patch.js:74:21)
at Transaction.module.exports.Transaction.applyTo (/usr/share/atom/resources/app/node_modules/text-buffer/lib/transaction.js:60:29)
at History.module.exports.History.abortTransaction (/usr/share/atom/resources/app/node_modules/text-buffer/lib/history.js:162:24)
at History.module.exports.History.transact (/usr/share/atom/resources/app/node_modules/text-buffer/lib/history.js:119:16)
at TextBuffer.module.exports.TextBuffer.transact (/usr/share/atom/resources/app/node_modules/text-buffer/lib/text-buffer.js:683:27)
at TextEditor.module.exports.TextEditor.transact (/usr/share/atom/resources/app/src/text-editor.js:1146:26)
at atom-text-editor.newCommandListeners.(anonymous function) (/usr/share/atom/resources/app/src/text-editor-element.js:290:22)
at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/usr/share/atom/resources/app/src/command-registry.js:243:29)
at /usr/share/atom/resources/app/src/command-registry.js:3:61
at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/usr/share/atom/resources/app/node_modules/atom-keymap/lib/keymap-manager.js:549:16)
at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/usr/share/atom/resources/app/node_modules/atom-keymap/lib/keymap-manager.js:391:22)
at HTMLDocument.module.exports.WindowEventHandler.onKeydown (/usr/share/atom/resources/app/src/window-event-handler.js:167:20)