AV-98-fork

A fork of https://tildegit.org/solderpunk/AV-98
Log (Feed) | Files | Refs (Tags) | README | LICENSE

commit 4408963c69e3907ea91e6e101feae9f3e1c28e32
parent 94c0de9b1583f7c8e2b5c20add90f8f9af84abfc
Author: Björn Wärmedal <bjorn.warmedal@storytel.com>
Date:   Wed, 25 Aug 2021 08:01:16 +0200

Reverse tour add: 'tour 50-40' will now add all links in that range in that order.

Diffstat:
Mav98.py | 12+++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/av98.py b/av98.py @@ -1309,9 +1309,15 @@ Current tour can be listed with `tour ls` and scrubbed with `tour clear`.""" self.waypoints.append(gi) elif len(pair) == 2: # Two endpoints for a range of indices - for n in range(int(pair[0]), int(pair[1]) + 1): - gi = self.lookup[n-1] - self.waypoints.append(gi) + if int(pair[0]) < int(pair[1]): + for n in range(int(pair[0]), int(pair[1]) + 1): + gi = self.lookup[n-1] + self.waypoints.append(gi) + else: + for n in range(int(pair[0]), int(pair[1]) - 1, -1): + gi = self.lookup[n-1] + self.waypoints.append(gi) + else: # Syntax error print("Invalid use of range syntax %s, skipping" % index)