cloned from http://git.code.sf.net/p/tmux/tmux-code