davidgiven / cpmish

An open source sort-of CP/M 2.2 distribution.
http://cowlark.com/cpmish
Other
344 stars 37 forks source link

QE: Insert mode sets dirty flag even if immediately aborted #29

Closed darkstar closed 4 years ago

darkstar commented 4 years ago

If you enter "insert" mode by typing "i", then immediately exit it again by pressing ESC, the document is still marked as dirty.

It should only be marked if actual changes are done.

Maybe something like this (untested):

--- qe.c        2020-06-03 12:44:51.806623700 +0200
+++ qe-fixed.c  2020-06-03 12:47:23.393445200 +0200
@@ -632,7 +632,10 @@
                uint16_t c = cpm_bios_conin();
                if (c == 27)
                        break;
-               else if (c == 8)
+
+               dirty = true;
+
+               if (c == 8)
                {
                        if (gap_start != current_line)
                                gap_start--;
@@ -654,8 +657,6 @@

                redraw_current_line();
        }
-
-       dirty = true;
 }

 void insert_text(uint16_t count)
davidgiven commented 4 years ago

Yes, absolutely. Fixed. Thanks!