NHDaly / tmux-better-mouse-mode

A tmux plugin to better manage and configure the mouse.
MIT License
916 stars 27 forks source link

Fix bash range in get_repeated_scroll_cmd function #34

Closed jameslikeslinux closed 7 years ago

jameslikeslinux commented 7 years ago

In #28, I changed the for loop in the get_repeated_scroll_cmd function to use a bash built-in because seq is not portable (for example, it doesn't exist on Solaris). However, I must have been accidentally testing under ZSH, because the range operator ({1..x}) does not support variable interpolation under bash. This commit changes the for loop to using a math operator, which I have confirmed is compatible with bash (at least back to version 3, which is quite old); and as a built-in, is portable.

jameslikeslinux commented 7 years ago

Example, on the command line:

> uname -a
SunOS <snip>.umd.edu 5.10 Generic_150400-50 sun4v sparc sun4v
> bash --version
GNU bash, version 3.2.57(1)-release (sparc-sun-solaris2.10)
Copyright (C) 2007 Free Software Foundation, Inc.
> bash -c 'end=5; for ((i = 1; i <= end; i++)); do echo $i; done'
1
2
3
4
5
NHDaly commented 7 years ago

Awesome. Thanks @iamjamestl, that makes sense to me. Thanks!