commit f3ce5c74c08d0e449d2abea27e882fa266edda7b parent dde942fa2ee3cf0411d4d7e4513b07b577b36f67 Author: Suraj N. Kurapati <sunaku@gmail.com> Date: Sun, 24 Sep 2006 02:58:50 -0700 [project @ e0b57d2dabd2a7ec34299afeb4dc8b0770a84edb] [project @ 130] simplify code Diffstat:
wmiirc-config.rb | | | 11 | +++++------ |
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/wmiirc-config.rb b/wmiirc-config.rb @@ -399,12 +399,11 @@ end choices = Wmii.tags.select {|t| t =~ /^#{key}/i} unless choices.empty? - if curIdx = choices.index(Wmii.current_view.name) - maxIdx = choices.length - Wmii.focus_view choices[(curIdx + 1) % maxIdx] - else - Wmii.focus_view choices.first - end + curIdx = choices.index(Wmii.current_view.name) + maxIdx = choices.length + idx = curIdx.next % maxIdx rescue 0 + + Wmii.focus_view choices[idx] end end end