Introduction
Introduction Statistics Contact Development Disclaimer Help
tled: update autoindent only if prefix is empty - neatvi - [fork] simple vi-typ…
git clone git://src.adamsgaard.dk/neatvi
Log
Files
Refs
README
---
commit c7dcceb5c62060da479326a72bc9e1170f18654c
parent f57f8c4f0b99d1c293036dd028859fa16e03f847
Author: Ali Gholami Rudi <[email protected]>
Date: Sat, 23 May 2015 14:43:52 +0430
led: update autoindent only if prefix is empty
Diffstat:
M led.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/led.c b/led.c
t@@ -230,7 +230,7 @@ char *led_input(char *pref, char *post, char *ai, int ai_m…
{
struct sbuf *sb = sbuf_make();
char *first_ai = NULL;
- int key, i, ai_len;
+ int key, i;
while (1) {
char *ln = led_line(pref, post, ai, ai_max, &key, kmap);
if (pref)
t@@ -244,13 +244,15 @@ char *led_input(char *pref, char *post, char *ai, int ai…
key == '\n' ? "" : post, *kmap);
if (key == '\n')
term_chr('\n');
+ if (!pref || !pref[0]) { /* updating autoindent */
+ int ai_len = ai_max ? strlen(ai) : 0;
+ for (i = 0; isspace((unsigned char) ln[i]); i++)
+ if (ai_len < ai_max)
+ ai[ai_len++] = ln[i];
+ ai[ai_len] = '\0';
+ }
pref = NULL;
term_kill();
- ai_len = ai_max ? strlen(ai) : 0;
- for (i = 0; isspace((unsigned char) ln[i]); i++)
- if (ai_len < ai_max)
- ai[ai_len++] = ln[i];
- ai[ai_len] = '\0';
free(ln);
if (key != '\n')
break;
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.