Skip to content

Commit e48843b

Browse files
authored
fix: range selection (#1487)
1 parent 709db81 commit e48843b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

ani-cli

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22

3-
version_number="4.9.7"
3+
version_number="4.9.8"
44

55
# UI
66

@@ -23,7 +23,14 @@ nth() {
2323
multi_flag=""
2424
[ $# -ne 1 ] && shift && multi_flag="$1"
2525
line=$(printf "%s" "$stdin" | cut -f1,3 | tr '\t' ' ' | launcher "$multi_flag" "$prompt" | cut -d " " -f 1)
26-
[ -n "$line" ] && printf "%s" "$stdin" | grep -E '^'"${line}"'($|[[:space:]])' | cut -f2,3 || exit 1
26+
line_start=$(printf "%s" "$line" | head -n1)
27+
line_end=$(printf "%s" "$line" | tail -n1)
28+
[ -n "$line" ] || exit 1
29+
if [ -z "$multi_flag" ]; then
30+
printf "%s" "$stdin" | grep -E '^'"${line}"'($|[[:space:]])' | cut -f2,3 || exit 1
31+
else
32+
printf "%s" "$stdin" | sed -n '/^'"${line_start}"'$/,/^'"${line_end}$"'/p' || exit 1
33+
fi
2734
}
2835

2936
die() {

0 commit comments

Comments
 (0)