Skip to content

Commit e6d0215

Browse files
authored
Merge pull request #69 from yakloinsteak/fix-window-mode-regression--67
Reverts incorrect args handling in function.
2 parents 8eee8c9 + 5c7d1bd commit e6d0215

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

scripts/sessionx.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,20 @@ additional_input() {
8989
}
9090

9191
handle_output() {
92-
target=$(echo "$@" | tr -d '\n')
92+
if [ -d "$@" ]; then
93+
# No special handling because there isn't a window number or window name present
94+
# except in unlikely and contrived situations (e.g.
95+
# "/home/person/projects:0\ bash" could be a path on your filesystem.)
96+
target=$(echo "$@" | tr -d '\n')
97+
elif echo "$@" | grep ':' > /dev/null 2>&1 ; then
98+
# Colon probably delimits session name and window number
99+
session_name=$(echo "$@" | cut -d: -f1)
100+
num=$(echo "$@" | cut -d: -f2 | cut -d' ' -f1)
101+
target=$(echo "${session_name}:${num}" | tr -d '\n')
102+
else
103+
# All tokens represent a session name
104+
target=$(echo "$@" | tr -d '\n')
105+
fi
93106

94107
if [[ -z "$target" ]]; then
95108
exit 0

0 commit comments

Comments
 (0)