tdir: default to right-to-left context if xdir is 'r' - 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 7476ff70d0c864ceb797f8d85afe0596e5957e95
 (DIR) parent dff850c67acc8216c6df2a6fe8c4eaf081abb485
 (HTM) Author: Ali Gholami Rudi <ali@rudi.ir>
       Date:   Wed, 13 May 2015 11:10:08 +0430
       
       dir: default to right-to-left context if xdir is 'r'
       
       Diffstat:
         M dir.c                               |       5 +++--
       
       1 file changed, 3 insertions(+), 2 deletions(-)
       ---
 (DIR) diff --git a/dir.c b/dir.c
       t@@ -7,6 +7,7 @@
        #define CR2L                "ءآأؤإئابةتثجحخدذرزسشصضطظعغـفقكلمنهوىييپچژکگی‌‍؛،»«؟"
        #define CNEUT                "-!\"#$%&'()*+,./:;<=>?@^_`{|}~ "
        
       +/* direction context patterns */
        static struct dcontext {
                int dir;
                char *pat;
       t@@ -20,7 +21,7 @@ static struct dmark {
                int ctx;        /* the direction context for this mark; 0 means any */
                int dir;        /* the direction of matched text */
                int grp;        /* the nested subgroup; 0 means no groups */
       -        char *pat;        /* the pattern */
       +        char *pat;
        } dmarks[] = {
                {+0, +1, 0, "$([^$]+)\\$"},
                {+0, +1, 1, "\\\\\\*\\[([^]]+)\\]"},
       t@@ -106,7 +107,7 @@ int dir_context(char *s)
                found = rset_find(dir_rsctx, s ? s : "", 0, NULL, 0);
                if (found >= 0)
                        return dcontexts[found].dir;
       -        return xdir == 'r' ? +1 : -1;
       +        return xdir == 'r' ? -1 : +1;
        }
        
        /* reorder the characters in s */