Fix broken delta predicates
Fix broken delta predicates

The delta predicates (is_simple_delete and as_simple_insert) didn't
handle all cases correctly, especially mixed inserts and delets. This
patch reimplements them from scratch.

Fixes #507

fuchsia-mirror/third_party-xi-editor,google/xi-editor,fuchsia-mirror/third_party-xi-editor,google/xi-editor,google/xi-editor,fuchsia-mirror/third_party-xi-editor,google/xi-editor,fuchsia-mirror/third_party-xi-editor