vi: correctly detect when a deletion empties the buffer
authorRon Yorston <rmy@pobox.com>
Mon, 3 Dec 2018 09:07:58 +0000 (10:07 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Mon, 3 Dec 2018 09:07:58 +0000 (10:07 +0100)
commitd08206dce1291f512d7de9037d9ef1ffbf705cac
tree373e132573908561f985206eb143a7cebb689f99
parentb7330460693f12585c7a6246f0dfafd8742af05a
vi: correctly detect when a deletion empties the buffer

Michał Berger has reported two issues:

- Repeatedly deleting and undoing the deletion of the last line
  results in characters being lost from the end of the line.

- Deleting the bottom line twice then attempting to undo each of
  these deletions results in a segfault.

The problem seems to be an incorrect test for whether the text buffer
is empty.

Reported-by: Michał Berger <michallinuxstuff@gmail.com>
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
editors/vi.c