Initial + in stop part of a message range selects relative to the start

So, e.g 4:+5 is the same as 4:9
This commit is contained in:
Oliver Kiddle 2017-07-01 13:09:31 +02:00
parent bb773cb7be
commit ffd56e4a6c

8
seq.c
View File

@ -174,7 +174,7 @@ blaze822_seq_setcur(char *s)
} }
static char * static char *
parse_relnum(char *a, long cur, long last, long *out) parse_relnum(char *a, long cur, long start, long last, long *out)
{ {
long base; long base;
char *b; char *b;
@ -194,6 +194,8 @@ parse_relnum(char *a, long cur, long last, long *out)
base = cur; base = cur;
} else if (*a == '-') { } else if (*a == '-') {
base = last + 1; base = last + 1;
} else if (*a == '+') {
base = start;
} else { } else {
base = 0; base = 0;
} }
@ -341,7 +343,7 @@ parse_range(char *map, char *a, long *start, long *stop, long cur, long lines)
*stop = 1; *stop = 1;
while (*a && *a != ':' && *a != '=' && *a != '_' && *a != '^') { while (*a && *a != ':' && *a != '=' && *a != '_' && *a != '^') {
char *b = parse_relnum(a, cur, lines, start); char *b = parse_relnum(a, cur, 0, lines, start);
if (a == b) if (a == b)
return 0; return 0;
a = b; a = b;
@ -360,7 +362,7 @@ parse_range(char *map, char *a, long *start, long *stop, long cur, long lines)
if (!*a) { if (!*a) {
*stop = lines; *stop = lines;
} else { } else {
char *b = parse_relnum(a, cur, lines, stop); char *b = parse_relnum(a, cur, *start, lines, stop);
if (a == b) if (a == b)
return 0; return 0;
} }