Make deleting methods self-contained

This makes them true to their names, instead of rely on and need to
be used with built-in deletion.
Fix whitespaces calculation logic for deletion

Fix #176
Fix undo support for programmatic text replacement
Merge branch 'fix_176-delete-tab'
Fix deployment target for Xcode 6