tex: order option to call ren_reorder() - neatvi - [fork] simple vi-type editor… | |
git clone git://src.adamsgaard.dk/neatvi | |
Log | |
Files | |
Refs | |
README | |
--- | |
commit 26f00e91254bf63cbd7a6e0bc966c158be004aea | |
parent 85f9a4757722e1bc89d9e2ea84cdf98361e6899c | |
Author: Ali Gholami Rudi <[email protected]> | |
Date: Wed, 20 May 2015 19:14:39 +0430 | |
ex: order option to call ren_reorder() | |
Diffstat: | |
M ex.c | 2 ++ | |
M ren.c | 6 ++++-- | |
M vi.h | 1 + | |
3 files changed, 7 insertions(+), 2 deletions(-) | |
--- | |
diff --git a/ex.c b/ex.c | |
t@@ -21,6 +21,7 @@ int xrow_alt; /* alternate row, colum… | |
int xled = 1; /* use the line editor */ | |
int xdir = +1; /* current direction context */ | |
int xshape = 1; /* perform letter shaping */ | |
+int xorder = 1; /* change the order of characters */ | |
/* read ex command location */ | |
static char *ex_loc(char *s, char *loc) | |
t@@ -449,6 +450,7 @@ static struct option { | |
{"ic", "ignorecase", &xic}, | |
{"td", "textdirection", &xdir}, | |
{"shape", "shape", &xshape}, | |
+ {"order", "xorder", &xorder}, | |
}; | |
static char *cutword(char *s, char *d) | |
diff --git a/ren.c b/ren.c | |
t@@ -15,7 +15,8 @@ int *ren_position(char *s) | |
pos = malloc((n + 1) * sizeof(pos[0])); | |
for (i = 0; i < n; i++) | |
pos[i] = i; | |
- dir_reorder(s, pos); | |
+ if (xorder) | |
+ dir_reorder(s, pos); | |
off = malloc(n * sizeof(off[0])); | |
for (i = 0; i < n; i++) | |
off[pos[i]] = i; | |
t@@ -154,7 +155,8 @@ int ren_region(char *s, int c1, int c2, int *l1, int *l2, … | |
ord = malloc(n * sizeof(ord[0])); | |
for (i = 0; i < n; i++) | |
ord[i] = i; | |
- dir_reorder(s, ord); | |
+ if (xorder) | |
+ dir_reorder(s, ord); | |
if (c2 < c1) | |
swap(&c1, &c2); | |
diff --git a/vi.h b/vi.h | |
t@@ -147,3 +147,4 @@ extern int xic; | |
extern int xai; | |
extern int xdir; | |
extern int xshape; | |
+extern int xorder; |