| tdir: rename xdir to xtd - neatvi - [fork] simple vi-type editor with UTF-8 support |
| git clone git://src.adamsgaard.dk/neatvi |
| Log |
| Files |
| Refs |
| README |
| --- |
| commit 53f1da76a6d4918209eecc5251437407e8c7cf41 |
| parent 33fa385f8aaee6daad8010fc875b2861d835d2c3 |
| Author: Ali Gholami Rudi |
| Date: Sat, 18 Mar 2017 19:02:09 +0330
dir: rename xdir to xtd
Diffstat:
M dir.c | 7 ++++---
M ex.c | 4 ++--
M led.c | 16 ++++++++--------
M vi.c | 8 ++++----
M vi.h | 2 +-
5 files changed, 19 insertions(+), 18 deletions(-)
--- |
| diff --git a/dir.c b/dir.c |
| t@@ -65,19 +65,20 @@ static void dir_fix(char **chrs, int *ord, int dir, int beg, int end)
}
}
+/* return the direction context of the given line */
int dir_context(char *s)
{
int found = -1;
int dir;
- if (xdir > +1)
+ if (xtd > +1)
return +1;
- if (xdir < -1)
+ if (xtd < -1)
return -1;
if (dir_rsctx)
found = rset_find(dir_rsctx, s ? s : "", 0, NULL, 0);
if (!conf_dircontext(found, NULL, &dir))
return dir;
- return xdir < 0 ? -1 : +1;
+ return xtd < 0 ? -1 : +1;
}
/* reorder the characters in s */ |
| diff --git a/ex.c b/ex.c |
| t@@ -16,7 +16,7 @@ int xic = 1; /* ignorecase option */
int xaw; /* autowrite option */
int xhl = 1; /* syntax highlight option */
int xled = 1; /* use the line editor */
-int xdir = +1; /* current direction context */
+int xtd = +1; /* current text direction */
int xshape = 1; /* perform letter shaping */
int xorder = 1; /* change the order of characters */
static char xkwd[EXLEN]; /* the last searched keyword */
t@@ -845,7 +845,7 @@ static struct option {
{"ai", "autoindent", &xai},
{"aw", "autowrite", &xaw},
{"ic", "ignorecase", &xic},
- {"td", "textdirection", &xdir},
+ {"td", "textdirection", &xtd},
{"shape", "shape", &xshape},
{"order", "xorder", &xorder},
{"hl", "highlight", &xhl}, |
| diff --git a/led.c b/led.c |
| t@@ -120,20 +120,20 @@ void led_print(char *s, int row)
free(r);
}
-/* set xdir and return its old value */
-static int dir_set(int dir)
+/* set xtd and return its old value */
+static int td_set(int td)
{
- int old = xdir;
- xdir = dir;
+ int old = xtd;
+ xtd = td;
return old;
}
/* print a line on the screen; for ex messages */
void led_printmsg(char *s, int row)
{
- int dir = dir_set(+2);
+ int td = td_set(+2);
char *r = led_render(s, xleft, xleft + xcols, "---");
- dir_set(dir);
+ td_set(td);
term_pos(row, 0);
term_kill();
term_str(r);
t@@ -307,9 +307,9 @@ static char *led_line(char *pref, char *post, char *ai, int ai_max, int *key, ch
char *led_prompt(char *pref, char *post, char **kmap)
{
int key;
- int dir = dir_set(+2);
+ int td = td_set(+2);
char *s = led_line(pref, post, "", 0, &key, kmap);
- dir_set(dir);
+ td_set(td);
if (key == '\n') {
struct sbuf *sb = sbuf_make();
if (pref) |
| diff --git a/vi.c b/vi.c |
| t@@ -1,7 +1,7 @@
/*
* NEATVI Editor
*
- * Copyright (C) 2015-2016 Ali Gholami Rudi
+ * Copyright (C) 2015-2017 Ali Gholami Rudi
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
t@@ -1081,7 +1081,7 @@ static void vi(void)
} else if (mv == 0) {
char *cmd;
int c = vi_read();
- int k;
+ int k = 0;
if (c <= 0)
continue;
lbuf_mark(xb, '*', xrow, xoff);
t@@ -1216,11 +1216,11 @@ static void vi(void)
break;
case 'l':
case 'r':
- xdir = k == 'r' ? -1 : +1;
+ xtd = k == 'r' ? -1 : +1;
break;
case 'L':
case 'R':
- xdir = k == 'R' ? -2 : +2;
+ xtd = k == 'R' ? -2 : +2;
break;
}
mod = 1; |
| diff --git a/vi.h b/vi.h |
| t@@ -198,7 +198,7 @@ extern int xled;
extern int xquit;
extern int xic;
extern int xai;
-extern int xdir;
+extern int xtd;
extern int xshape;
extern int xorder;
extern int xhl; |