Package: hexer
Version: 0.1.7-1
Followup-For: Bug #655470

This is easily reproduced by inserting a “half-byte” in “insertion” or
“Replacement” mode, then hitting backspace.

I'm not really satisfied with the patch I'm sending, but at least it seems to
fix this issue.



-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: armhf (armv7l)

Kernel: Linux 3.0.0-2+armhf.1-mx5
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages hexer depends on:
ii  libc6        2.13-26
ii  libncurses5  5.9-4+b1
ii  libtinfo5    5.9-4+b1

hexer recommends no packages.

hexer suggests no packages.

-- no debconf information
--- a/edit.c
+++ b/edit.c
@@ -1524,8 +1524,10 @@
             hedit->insert_position = -1;
             b_copy(hedit->buffer, replace,
                    hedit->position, replace->size - 1, 1);
-            b_set_size(replace, replace->size - 1);
-            b_set_size(insert, insert->size - 1);
+            if (replace->size > 0)
+                b_set_size(replace, replace->size - 1);
+            if (insert->size > 0)
+                b_set_size(insert, insert->size - 1);
             he_refresh_part(hedit, hedit->position, hedit->position);
           } else
             if (insert->size) {
@@ -1553,7 +1555,8 @@
             insert_state = 0;
             hedit->insert_position = -1;
             b_delete(hedit->buffer, hedit->position, 1);
-            b_set_size(insert, insert->size - 1);
+            if (insert->size > 0)
+              b_set_size(insert, insert->size - 1);
             he_refresh_part(hedit, hedit->position, hedit->buffer->size - 1);
           } else
             if (insert->size) {

Reply via email to