tled: messages and ex prompts are always left-to-right - 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 33fa385f8aaee6daad8010fc875b2861d835d2c3
(DIR) parent d9562b264f00d015c0bcd75bd8fa3e4cece9eddb
(HTM) Author: Ali Gholami Rudi <ali@rudi.ir>
Date: Thu, 16 Mar 2017 15:42:08 +0330
led: messages and ex prompts are always left-to-right
Diffstat:
M led.c | 12 ++++++++++++
1 file changed, 12 insertions(+), 0 deletions(-)
---
(DIR) diff --git a/led.c b/led.c
t@@ -120,10 +120,20 @@ void led_print(char *s, int row)
free(r);
}
+/* set xdir and return its old value */
+static int dir_set(int dir)
+{
+ int old = xdir;
+ xdir = dir;
+ return old;
+}
+
/* print a line on the screen; for ex messages */
void led_printmsg(char *s, int row)
{
+ int dir = dir_set(+2);
char *r = led_render(s, xleft, xleft + xcols, "---");
+ dir_set(dir);
term_pos(row, 0);
term_kill();
term_str(r);
t@@ -297,7 +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);
char *s = led_line(pref, post, "", 0, &key, kmap);
+ dir_set(dir);
if (key == '\n') {
struct sbuf *sb = sbuf_make();
if (pref)