aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Kiddle <okiddle@yahoo.co.uk>2017-07-01 13:09:31 +0200
committerLeah Neukirchen <leah@vuxu.org>2017-07-02 18:45:22 +0200
commit8e833606c1b9ec9395caaec8678f59d62f1a3119 (patch)
treec1588cc437d176b06a294668af147513b4735e07
parent7d66bb8db70d6e3f5009bde30795477bd5d46372 (diff)
downloadmblaze-8e833606c1b9ec9395caaec8678f59d62f1a3119.tar.gz
seq: parse_relnum: initial + in stop part of a message range selects relative to the start
So, e.g 4:+5 is the same as 4:9 Closes: #44 [via git-merge-pr]
-rw-r--r--seq.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/seq.c b/seq.c
index def14fe..37a8066 100644
--- a/seq.c
+++ b/seq.c
@@ -174,7 +174,7 @@ blaze822_seq_setcur(char *s)
}
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;
char *b;
@@ -194,6 +194,8 @@ parse_relnum(char *a, long cur, long last, long *out)
base = cur;
} else if (*a == '-') {
base = last + 1;
+ } else if (*a == '+') {
+ base = start;
} else {
base = 0;
}
@@ -341,7 +343,7 @@ parse_range(char *map, char *a, long *start, long *stop, long cur, long lines)
*stop = 1;
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)
return 0;
a = b;
@@ -360,7 +362,7 @@ parse_range(char *map, char *a, long *start, long *stop, long cur, long lines)
if (!*a) {
*stop = lines;
} else {
- char *b = parse_relnum(a, cur, lines, stop);
+ char *b = parse_relnum(a, cur, *start, lines, stop);
if (a == b)
return 0;
}