treg: upper-case letter to append to yank buffers - neatvi - [fork] simple vi-type editor with UTF-8 support
 (HTM) git clone git://src.adamsgaard.dk/neatvi
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
       ---
 (DIR) commit ec086911d042a074ad149289f4200c3248446096
 (DIR) parent 02c3248a2537cdccb0ccf6f91ad6df16cf902c15
 (HTM) Author: Ali Gholami Rudi <ali@rudi.ir>
       Date:   Sat, 16 May 2015 12:26:48 +0430
       
       reg: upper-case letter to append to yank buffers
       
       Diffstat:
         M reg.c                               |      13 ++++++++-----
       
       1 file changed, 8 insertions(+), 5 deletions(-)
       ---
 (DIR) diff --git a/reg.c b/reg.c
       t@@ -1,3 +1,4 @@
       +#include <ctype.h>
        #include <stdlib.h>
        #include <string.h>
        #include "vi.h"
       t@@ -13,11 +14,13 @@ char *reg_get(int c, int *ln)
        
        void reg_put(int c, char *s, int ln)
        {
       -        char *buf = malloc(strlen(s) + 1);
       -        strcpy(buf, s);
       -        free(bufs[c]);
       -        bufs[c] = buf;
       -        lnmode[c] = ln;
       +        char *pre = isupper(c) ? bufs[tolower(c)] : "";
       +        char *buf = malloc(strlen(pre) + strlen(s) + 1);
       +        strcpy(buf, pre);
       +        strcat(buf, s);
       +        free(bufs[tolower(c)]);
       +        bufs[tolower(c)] = buf;
       +        lnmode[tolower(c)] = ln;
        }
        
        void reg_done(void)