Issue 1:
Make lots of changes to a file.

Undo a lot of times.

Atom Version: 0.186.0

System: Mac OS X 10.9.5

Thrown From: Atom Core

Stack Trace

Uncaught TypeError: Cannot read property 'slice' of undefined

At /Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/text-buffer.js:559

TypeError: Cannot read property 'slice' of undefined
at TextBuffer.module.exports.TextBuffer.applyPatch (/Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/text-buffer.js:559:41)
at BufferPatch.module.exports.BufferPatch.applyTo (/Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/buffer-patch.js:74:21)
at Transaction.module.exports.Transaction.applyTo (/Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/transaction.js:60:29)
at History.module.exports.History.undo (/Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/history.js:87:24)
at TextBuffer.module.exports.TextBuffer.undo (/Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/text-buffer.js:679:27)
at TextEditor.module.exports.TextEditor.undo (/Applications/Atom.app/Contents/Resources/app/src/text-editor.js:1206:26)
at TextEditor.atom.commands.add.stopEventPropagation.core:undo (/Applications/Atom.app/Contents/Resources/app/src/text-editor-element.js:312:19)
at atom-text-editor.newCommandListeners.(anonymous function) (/Applications/Atom.app/Contents/Resources/app/src/text-editor-element.js:280:32)
at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app/src/command-registry.js:243:29)
at /Applications/Atom.app/Contents/Resources/app/src/command-registry.js:3:61
at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:558:16)
at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:396:22)
at HTMLDocument.module.exports.WindowEventHandler.onKeydown (/Applications/Atom.app/Contents/Resources/app/src/window-event-handler.js:182:20)

Commands

-8:31.5 core:backspace (atom-text-editor.editor.is-focused)
2x -8:30.3 core:save (atom-text-editor.editor.is-focused)
4x -1:15.7 core:move-right (atom-text-editor.editor.mini)
-1:13.9 core:confirm (atom-text-editor.editor.mini)
undefined -1:10.7 core:undo (ol.tree-view.full-menu.list-tree.has-collapsable-children.focusable-panel)
9x -0:23.1 core:redo (atom-text-editor.editor.is-focused)
8x -0:07.7 core:undo (atom-workspace.workspace.scrollbars-visible-when-scrolling.theme-monokai.theme-atom-dark-ui)

Config

{
"core": {
"excludeVcsIgnoredPaths": false,
"themes": [
"atom-dark-ui",
"monokai"
]
},
"editor": {
"showInvisibles": true,
"invisibles": {}
}
}

Installed Packages

# User
atom-beautify, v0.21.3
compare-files, v0.4.1
emmet, v2.3.4
language-ejs, v0.1.0
monokai, v0.12.0

# Dev
No dev packages

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)