tImplement simple sequential key binding - ve - a minimal text editor (work in progress)
 (HTM) git clone git://src.adamsgaard.dk/ve
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 46d33db19cc6321705a9c52f7929a2a689d88ebc
 (DIR) parent 73ee9195069d7b78a8b224190eec153bb01831b1
 (HTM) Author: Anders Damsgaard <anders@adamsgaard.dk>
       Date:   Wed,  7 Aug 2019 23:06:49 +0200
       
       Implement simple sequential key binding
       
       Diffstat:
         M ve.c                                |      52 +++++++++++++++++--------------
       
       1 file changed, 29 insertions(+), 23 deletions(-)
       ---
 (DIR) diff --git a/ve.c b/ve.c
       t@@ -864,23 +864,6 @@ editor_process_keypress()
                                        E.mode = 1;
                                        break;
        
       -                        case CTRL_KEY('q'):
       -                                if (E.file_changed) {
       -                                        editor_set_status_message("error: "
       -                                                                      "file has unsaved changes. "
       -                                                                      "Press C-x to confirm quit");
       -                                        break;
       -                                } else {
       -                                        write(STDOUT_FILENO, "\x1b[2J", 4); /* clear screen */
       -                                        write(STDOUT_FILENO, "\x1b[H", 3);
       -                                        exit(0);
       -                                        break;
       -                                }
       -                        case CTRL_KEY('x'):
       -                                write(STDOUT_FILENO, "\x1b[2J", 4); /* clear screen */
       -                                write(STDOUT_FILENO, "\x1b[H", 3);
       -                                exit(0);
       -                                break;
                                case 'h':
                                case 'j':
                                case 'k':
       t@@ -888,8 +871,25 @@ editor_process_keypress()
                                        editor_move_cursor(c);
                                        break;
        
       -                        case CTRL_KEY('w'):
       -                                file_save(E.filename);
       +                        case ' ':
       +                                c = editor_read_key();
       +                                switch (c) {
       +                                        case 'w':
       +                                                file_save(E.filename);
       +                                                break;
       +                                        case 'q':
       +                                                if (E.file_changed) {
       +                                                        editor_set_status_message("error: "
       +                                                                                      "file has unsaved changes! "
       +                                                                                      "Press ;q! to confirm quit");
       +                                                        break;
       +                                                } else {
       +                                                        write(STDOUT_FILENO, "\x1b[2J", 4); /* clear screen */
       +                                                        write(STDOUT_FILENO, "\x1b[H", 3);
       +                                                        exit(0);
       +                                                        break;
       +                                                }
       +                                }
                                        break;
        
                                case CTRL_KEY('f'):
       t@@ -923,8 +923,11 @@ editor_process_keypress()
                                        break;
        
                                case 'g':
       -                                E.cursor_x = 0;
       -                                E.cursor_y = 0;
       +                                c = editor_read_key();
       +                                if (c == 'g') {
       +                                        E.cursor_x = 0;
       +                                        E.cursor_y = 0;
       +                                }
                                        break;
                                case 'G':
                                        E.cursor_x = 0;
       t@@ -935,8 +938,11 @@ editor_process_keypress()
                                        editor_delete_char_right();
                                        break;
                                case 'd':
       -                                editor_row_delete(E.cursor_y);
       -                                editor_move_cursor('h');
       +                                c = editor_read_key();
       +                                if (c == 'd') {
       +                                        editor_row_delete(E.cursor_y);
       +                                        editor_move_cursor('h');
       +                                }
                                        break;
        
                                case 'o':