tBegin putting configuration into config.def.h - 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 73ee9195069d7b78a8b224190eec153bb01831b1
 (DIR) parent d3c6a5c61fddd9d07d135ea3b02b0a024c258ce6
 (HTM) Author: Anders Damsgaard <anders@adamsgaard.dk>
       Date:   Wed,  7 Aug 2019 22:54:25 +0200
       
       Begin putting configuration into config.def.h
       
       Diffstat:
         M config.def.h                        |      14 ++++++++++++++
         M ve.c                                |      12 +++++-------
       
       2 files changed, 19 insertions(+), 7 deletions(-)
       ---
 (DIR) diff --git a/config.def.h b/config.def.h
       t@@ -0,0 +1,14 @@
       +/* render tabs with this many characters */
       +static int tab_width = 4;
       +
       +/* timeout for status messages in seconds  */
       +static int status_message_timeout = 3;
       +
       +/* 
       + * modal cursor shape
       + * 2: block
       + * 4: underline
       + * 6: bar
       + */
       +/* static unsigned int cursorshape_normal = 2; */
       +/* static unsigned int cursorshape_insert = 6; */
 (DIR) diff --git a/ve.c b/ve.c
       t@@ -20,8 +20,6 @@
        
        /* macros */
        
       -#define TAB_WIDTH 4
       -#define STATUS_MESSAGE_TIMEOUT 3
        #define ABUF_INIT {NULL, 0}
        #define CTRL_KEY(k) ((k) & 0x1f)
        
       t@@ -178,7 +176,7 @@ editor_row_cursor_x_to_rx(eRow *row, int cursor_x)
                rx = 0;
                for (j=0; j<cursor_x; ++j) {
                        if (row->chars[j] == '\t')
       -                        rx += (TAB_WIDTH - 1) - (rx % TAB_WIDTH);
       +                        rx += (tab_width - 1) - (rx % tab_width);
                        rx++;
                }
                return rx;
       t@@ -192,7 +190,7 @@ editor_row_cursor_rx_to_x(eRow *row, int cursor_rx)
                cur_rx = 0;
                for (cx=0; cx<row->size; ++cx) {
                        if (row->chars[cx] == '\t')
       -                        cur_rx += (TAB_WIDTH - 1) - (cur_rx % TAB_WIDTH);
       +                        cur_rx += (tab_width - 1) - (cur_rx % tab_width);
                        cur_rx++;
        
                        if (cur_rx > cursor_rx)
       t@@ -216,13 +214,13 @@ editor_row_update(eRow* row)
                                tabs++;
        
                free(row->rchars);
       -        row->rchars = malloc(row->size + tabs*(TAB_WIDTH - 1) + 1);
       +        row->rchars = malloc(row->size + tabs*(tab_width - 1) + 1);
        
                idx = 0;
                for (j=0; j<row->size; ++j) {
                        if (row->chars[j] == '\t') {
                                row->rchars[idx++] = '>';
       -                        while (idx % TAB_WIDTH != 0)
       +                        while (idx % tab_width != 0)
                                        row->rchars[idx++] = ' ';
                        } else {
                                row->rchars[idx++] = row->chars[j];
       t@@ -581,7 +579,7 @@ show_status_message()
        {
                if (E.show_status &&
                    strlen(E.status_msg) &&
       -            time(NULL) - E.status_msg_time < STATUS_MESSAGE_TIMEOUT) {
       +            time(NULL) - E.status_msg_time < status_message_timeout) {
                        return 1;
                } else {
                        if (E.show_status) {