aboutsummaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
Diffstat (limited to 'regress')
-rw-r--r--regress/Makefile10
-rw-r--r--regress/capture-pane-sgr0.sh24
-rw-r--r--regress/conf/91378fd400b0444eb8cac471e30642b3.conf30
-rw-r--r--regress/conf/a4789a6782859c66aa8c9614ee6fabfa.conf80
-rw-r--r--regress/conf/ad21dbb0893240563ddfdd954b9903a1.conf580
-rw-r--r--regress/conf/d2e576f947e108eb9903679b65c81fbc.conf198
-rw-r--r--regress/conf/e2661d67d0d45a8647fb95de76ec8174.conf78
-rw-r--r--regress/conf/ed08995f38b5a3079262a88d2563abe4.conf283
-rw-r--r--regress/control-client-sanity.sh42
-rw-r--r--regress/control-client-size.sh49
-rw-r--r--regress/cursor-test.txt6
-rw-r--r--regress/cursor-test1.result33
-rw-r--r--regress/cursor-test1.sh29
-rw-r--r--regress/cursor-test2.result33
-rw-r--r--regress/cursor-test2.sh29
-rw-r--r--regress/cursor-test3.result9
-rw-r--r--regress/cursor-test3.sh29
-rw-r--r--regress/cursor-test4.result16
-rw-r--r--regress/cursor-test4.sh31
-rw-r--r--regress/format-strings.sh183
-rw-r--r--regress/has-session-return.sh19
-rw-r--r--regress/if-shell-TERM.sh30
-rw-r--r--regress/if-shell-error.sh26
-rw-r--r--regress/if-shell-nested.sh25
-rw-r--r--regress/kill-session-process-exit.sh21
-rw-r--r--regress/new-session-base-index.sh27
-rw-r--r--regress/new-session-command.sh25
-rw-r--r--regress/new-session-environment.sh66
-rw-r--r--regress/new-session-no-client.sh25
-rw-r--r--regress/new-session-size.sh27
-rw-r--r--regress/new-window-command.sh26
31 files changed, 2089 insertions, 0 deletions
diff --git a/regress/Makefile b/regress/Makefile
new file mode 100644
index 00000000..e6c3619f
--- /dev/null
+++ b/regress/Makefile
@@ -0,0 +1,10 @@
+TESTS!= echo *.sh
+
+.PHONY: all $(TESTS)
+.NOTPARALLEL: all $(TESTS)
+
+all: $(TESTS)
+
+$(TESTS):
+ sh $*.sh
+ sleep 1
diff --git a/regress/capture-pane-sgr0.sh b/regress/capture-pane-sgr0.sh
new file mode 100644
index 00000000..79d96a38
--- /dev/null
+++ b/regress/capture-pane-sgr0.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+# 884
+# capture-pane should send colours after SGR 0
+
+PATH=/bin:/usr/bin
+TERM=screen
+
+[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux)
+TMUX="$TEST_TMUX -Ltest"
+$TMUX kill-server 2>/dev/null
+
+TMP=$(mktemp)
+trap "rm -f $TMP" 0 1 15
+
+$TMUX -f/dev/null new -d \
+ "printf '\033[31;42;1mabc\033[0;31mdef'; $TMUX capturep -peS0 -E0 >$TMP"
+sleep 1
+printf '\033[1m\033[31m\033[42mabc\033[0m\033[31m\033[49mdef\033[39m\n'| \
+ cmp - $TMP || exit 1
+
+$TMUX has 2>/dev/null && exit 1
+
+exit 0
diff --git a/regress/conf/91378fd400b0444eb8cac471e30642b3.conf b/regress/conf/91378fd400b0444eb8cac471e30642b3.conf
new file mode 100644
index 00000000..40810076
--- /dev/null
+++ b/regress/conf/91378fd400b0444eb8cac471e30642b3.conf
@@ -0,0 +1,30 @@
+###
+
+if-shell " \
+ tmux -V \
+ | awk '{print $2}' \
+ | awk -F - '{print $1}' \
+ | awk '{ \
+ if ($1 ~ /^[[:digit:].]+$/) { \
+ exit !($1 >= 2.6) \
+ } else { \
+ exit !($1 == \"master\" || $1 == \"next\") \
+ } \
+ }'" \
+ "source-file ~/.tmux/v2rc" \
+ "source-file ~/.tmux/v1rc" \
+ ;
+
+###
+
+set-option -qg status-left \
+ "[#[fg=yellow]#{session_name}#[default]] #[fg=colour060]#{host_short}#[default]:#[fg=colour151]#{b:pane_current_path} #[fg=colour099]#(git -C #{pane_current_path} symbolic-ref --short HEAD) #[fg=green]#(git -C #{pane_current_path} status --porcelain --untracked-files=no | cut -b 1-1 | sort | uniq | awk '/^[^[:space:]]/ {printf\(\"%%s\", $0\)}')#[fg=red]#(git -C #{pane_current_path} status --porcelain --untracked-files=no | cut -b 2-2 | sort | uniq | awk '/^[^[:space:]]/ {printf\(\"%%s\", $0\)}')#[fg=colour113]#(git -C #{pane_current_path} stash list 2>/dev/null | wc -l | tr -d '\n' | sed s,^0\$,,) #[default]"
+
+set-option -qg status-right \
+ "#[default] ┊ #[fg=colour065]#(grep ^MemFree /proc/meminfo | awk '{print rshift\($2, 10\)}')#[fg=colour071]m #[default]┊ #[fg=colour101]#(echo \"\(`awk '{print \$1}' /proc/loadavg` / `grep ^processor /proc/cpuinfo | wc -l`\) \* 100\" | bc -ql | sed 's,\\..*,,' | awk '{printf\(\"%%2u\", $0\)}')#[fg=colour102]%% "
+
+set-option -qwg window-status-current-format \
+ "#[fg=colour208]»#[fg=colour190]#{window_name}#[fg=colour037]·#{?window_flags,#[fg=colour058]#{window_flags}#[default], #[default]}"
+
+set-option -qwg window-status-format \
+ "#[default]»#[fg=colour066]#{window_name}#[fg=colour037]·#{?window_flags,#[fg=colour058]#{window_flags}#[default], #[default]}"
diff --git a/regress/conf/a4789a6782859c66aa8c9614ee6fabfa.conf b/regress/conf/a4789a6782859c66aa8c9614ee6fabfa.conf
new file mode 100644
index 00000000..7f4a8cd1
--- /dev/null
+++ b/regress/conf/a4789a6782859c66aa8c9614ee6fabfa.conf
@@ -0,0 +1,80 @@
+set -g default-command "if [ \"$(uname)\" = 'Darwin' ]; then exec reattach-to-user-namespace $SHELL; else exec $SHELL; fi"
+set -g history-limit 32000
+set -g update-environment "DISPLAY WINDOWID SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION SSH_CLIENT SSH_TTY KRB5CCNAME Apple_PubSub_Socket_Render Apple_Ubiquity_Message"
+
+# Reset SHLVL (otherwise it is 2 inside tmux)
+setenv -g SHLVL 0
+
+# Send esc faster so that neovim won't get so laggy
+# https://github.com/neovim/neovim/issues/2093
+set -g escape-time 100
+
+# Disable paste detection
+set -g assume-paste-time 0
+
+# Titles and window names
+set -g set-titles on
+set -g set-titles-string "#T"
+
+# Make it not so annoying/sticky to switch windows
+set -g repeat-time 170
+
+# Don't deattach me when a session ends
+set -g detach-on-destroy off
+
+# Make shift+keys work
+setw -g xterm-keys on
+
+# Prefix
+set -g prefix ^A
+unbind ^B
+bind ^A send-prefix
+bind a send-prefix
+
+# Last window
+bind ^a last
+
+# Next & prev
+bind ' ' next
+bind '^ ' next
+bind ^p prev
+
+# Status
+set -g status off
+# Need more (cow)bells!
+set -g bell-action any
+set -g bell-on-alert on
+
+# Detach
+bind ^d detach
+
+# Control the a tmux in a tmux
+bind A send-prefix \; send-prefix
+bind C send-prefix \; send-keys c
+bind n send-prefix \; send-keys ' '
+bind bspace send-prefix \; send-keys p
+bind '#' send-prefix \; send-keys '"'
+
+# Other key bindings.
+bind ^r command-prompt "find-window '%%'"
+bind '"' choose-tree -w
+bind w split-window
+bind W split-window -c "#{pane_current_path}"
+bind ^w split-window
+bind I list-windows
+bind i list-windows
+bind D neww 'if who | grep -q "$USER.* via mosh"; then tmux lsc -F "#{client_activity} #{client_tty}" | sort | head -n -1 | awk "{print \$2}" | xargs -n1 tmux detach -t; else for i in $(tmux lsc | cut -d: -f1 | grep -v "^$SSH_TTY$"); do tmux detach -t $i; done; fi'
+bind S neww -t 999 'window=`tmux display -p "#{pane_title}"`; i=0; tmux list-windows | cut -d: -f1 | while read j; do if [ $j != $i ]; then tmux move-window -s $j -t $i; fi; i=$(($i+1)); done' # ; tmux find-window -T "$window"
+bind ^s command-prompt "rename-session '%%'"
+# Make the default HOME always ~
+bind c neww -c ~
+bind ^c new -c ~
+bind escape copy-mode
+# Copy to the OS clipboard
+bind -T copy-mode-vi y send -X copy-pipe-and-cancel "if [ \"$(uname)\" = 'Darwin' ]; then reattach-to-user-namespace pbcopy; else xclip; fi"
+bind j command-prompt "join-pane -s '%%'"
+bind ! break-pane -d
+bind - command-prompt "move-pane -t '%%'"
+
+# Makes `tmux a` work even when there isn't a session going on
+new-session -A -c ~
diff --git a/regress/conf/ad21dbb0893240563ddfdd954b9903a1.conf b/regress/conf/ad21dbb0893240563ddfdd954b9903a1.conf
new file mode 100644
index 00000000..27d8f310
--- /dev/null
+++ b/regress/conf/ad21dbb0893240563ddfdd954b9903a1.conf
@@ -0,0 +1,580 @@
+# Time-stamp: <2018-05-31 17:10:05 kmodi>
+# https://github.com/tmux/tmux
+# Hi-lock: (("\\(^\\s< \\**\\)\\(\\* *.*\\)" (1 'org-hide prepend) (2 '(:inherit org-level-1 :height 1.3 :weight bold :overline t :underline t) prepend)))
+# Hi-Lock: end
+
+# Running tmux built from master branch on tcsh in uxterm
+# tmux version 2.5-RC+ dev
+
+# Contents:
+#
+# PREFIX
+# Source config
+# Pane Management
+# Window <-join/split-> Pane
+# Select Panes
+# Resize Panes
+# Dynamic Split
+# Window Management
+# Window Navigation
+# Swap Windows
+# Split Window
+# Layout
+# Session Management
+# Mouse
+# Drag pane border to resize
+# Left click on pane
+# Middle click on pane
+# Right click on pane
+# Wheel scroll in pane
+# Wheel scroll in pane WHILE in copy-mode
+# Left click on status
+# Middle click on status
+# Other mouse settings
+# Window Title
+# Status Bar
+# Left Status
+# Right Status
+# Pane Status
+# Colors
+# Status Bar Colors
+# Message Colors
+# Window Status Colors
+# Pane Colors
+# Mode Info Colors
+# Activity
+# Command Prompt
+# Audible and Visual Bells
+# Copy & Paste
+# Synchronize commands to panes/windows/sessions
+# Terminal Setting
+# Other Options
+# Server Options
+# Session Options
+# Window Options
+# Notes
+
+# * PREFIX
+set -g prefix C-z
+unbind C-b # unbind the default binding to send prefix key to the application
+# Often you'll run a tmux inside another tmux and need a command sequence to
+# send things to the inner session. With below binding that can be accomplished
+# using "PREFIX Z <command>"
+bind Z send-prefix
+
+# * Source config
+unbind r # unbind default binding to force redraw of attached client
+bind r source-file ~/.tmux.conf \; display "Finished sourcing ~/.tmux.conf ."
+
+# * Pane Management
+
+set -g pane-base-index 1 # start pane indices at 1
+set -g main-pane-width 100 # used by selectl main-vertical
+bind z resize-pane -Z # zoom/unzoom the current pane
+# If the window has >1 panes kill them without confirming. But confirm before kill
+# the last pane (along with its window) in a window
+bind x if "tmux display -p \"#{window_panes}\" | grep ^1\$" \
+ "confirm-before -p \"Kill the only pane in window? It will kill this window too! (y/n)\" kill-pane" \
+ "kill-pane"
+bind C clear-history \; display "Cleared history of the current pane."
+unbind C-p
+bind C-p run -b "tmux display -p -F '#{pane_current_path}' | xclip -i -sel pri" \; display "Copied current path '#{pane_current_path}' to the primary selection."
+
+# Hooks need tmux 2.3+
+# set-hook -g -u after-kill-pane # Remove after hook for kill-pane
+set-hook -g after-kill-pane "selectl main-vertical"
+# If -g options is used when setting the hook, it has to be used when
+# removing (-u option) the hook too.
+
+# ** Window <-join/split-> Pane
+# Join a pane *from* a different window (of same or different session) into the CURRENT window
+# Binding mnemonic: F for (F)etch/pull (as in git) from a different window
+bind F command-prompt -p "Join pane from [sess:]win#[.pane#] (ex: kmodi:3.1) into current window:" "join-pane -s '%%'"
+# Join CURRENT pane *to* a different window
+# Binding mnemonic: P for (P)ush (as in git) to a different window
+bind P command-prompt -p "Send CURRENT pane to [sess:]win# (ex: kmodi:3):" "join-pane -t '%%'"
+# PREFIX ! : break-pane, convert the current pane to a window
+
+# ** Select Panes
+bind o select-pane -t :.+ # cycle to the next pane number
+bind O select-pane -t :.- # cycle to the previous pane number
+# PREFIX ; : last-pane or select-pane -l, switch to the last active pane
+# PREFIX ← : select-pane -L, switch to the pane on the left
+# PREFIX → : select-pane -R, switch to the pane on the right
+# PREFIX ↑ : select-pane -U, switch to the pane on the top
+# PREFIX ↓ : select-pane -D, switch to the pane on the bottom
+# PREFIX { : swap-pane -U, swap current pane with the pane above (not literally above)
+# PREFIX } : swap-pane -D, swap current pane with the pane below (not literally below)
+
+# ** Resize Panes
+bind -r h resize-pane -L 2
+bind -r C-h resize-pane -L 2
+bind -r j resize-pane -D 2
+bind -r C-j resize-pane -D 2
+bind -r k resize-pane -U 2
+bind -r C-k resize-pane -U 2
+unbind l # unbind default binding for `last-window`
+bind -r l resize-pane -R 2
+bind -r C-l resize-pane -R 2
+
+# ** Dynamic Split
+# Key-chaining example, analogous to prefix maps in emacs
+bind / switch-client -Tlauncher
+# Run below -Tlauncher commands using "PREFIX / <binding>"
+# Open calendar in a split window "PREFIX / c"
+# FIXME: Below does not work; cal pane quits as soon as it launches (before "&& sleep .."
+# was added). To make better of the situation, I now auto-close that pane after 3 seconds.
+# bind -Tlauncher c split-window -h 'cal && sleep 3'
+bind -Tlauncher c run "/home/kmodi/scripts/tcsh/tmux/dynamic_split.csh 'cal && sleep 3'"
+# Start emacsclient in terminal mode in a split window "PREFIX / e"
+# Use the emacs binding "C-x 5 0" to quit from that pane gracefully.
+bind -Tlauncher e run "/home/kmodi/scripts/tcsh/tmux/dynamic_split.csh 'emacsclient -a \"\" -t'"
+# Open man page "PREFIX / m"
+# PREFIX / m will bring up the tmux command prompt. Enter the command for which
+# you want to see the man page, example: ls. That man page will open in a split
+# pane. When you are done reviewing the man page, hit q and the split pane
+# closes by itself. Beautiful!
+bind -Tlauncher m command-prompt -p "man" "run \"/home/kmodi/scripts/tcsh/tmux/dynamic_split.csh 'man %1'\""
+# Open python interpreter in a split window for quick calculations "PREFIX / p"
+# Ctrl-D in python quits python and thus closes the split window too.
+bind -Tlauncher p run "/home/kmodi/scripts/tcsh/tmux/dynamic_split.csh 'ipython --profile=default --no-confirm-exit'"
+# PREFIX Up, Down, Right, Left : Move cursor from one pane to another
+# PREFIX Space : Cycle through different pane layouts
+# PREFIX C-o : rotate-window, rotate panes in the current window
+
+# * Window Management
+set -g base-index 1 # start window indices at 1
+# automatically renumber the windows
+# http://unix.stackexchange.com/questions/21742/renumbering-windows-in-tmux
+set -g renumber-windows on
+
+bind C-f command-prompt -p "New window:" "new-window -c '#{pane_current_path}' -n %1"
+bind C-r command-prompt -p "New name for this window:" "rename-window '%%'"
+unbind L # unbind default binding for `switch-client -l`
+bind L list-windows -F '#{window_index}:#{window_name}: #{?pane_dead, (dead), (not dead)}'
+unbind & # unbind default binding for `kill-window`
+bind C-c confirm-before -p "Kill this window? (y/n)" kill-window
+# Move the current window to another window index in the same or any other session
+bind m command-prompt -p "Move window to sess or sess:win# or win# (ex: kmodi or kmodi:3 or 2(of current session)):" "move-window -t '%%'"
+# Move or bring a window from a different session to the current one
+bind M command-prompt -p "Move the window from sess:win# (ex: kmodi:3):" "move-window -s '%%'"
+
+# ** Window Navigation
+bind C-z last-window # switch to last active window
+# Allow repeats for next/previous-window
+bind -r p previous-window
+bind -r n next-window
+# switch to another window by name
+bind W split-window "tmux lsw | peco --initial-index `tmux lsw | awk '/active.$/ {print NR-1}'` | cut -d':' -f 1 | xargs tmux select-window -t"
+# PREFIX <N> : switches to window with index=N
+
+# ** Swap Windows
+bind N move-window -r # renumber the windows
+unbind , # unbind default binding for `rename-window`
+bind -r , swap-window -t -1 # move window one position to the left
+bind -r < swap-window -t -1 # move window one position to the left
+unbind . # unbind default binding to move window to user provided index
+bind -r . swap-window -t +1 # move window one position to the right
+bind -r > swap-window -t +1 # move window one position to the right
+unbind t # unbind default binding to show time
+bind t swap-window -t 1 # swap the current window's position with window # 1, move it to the top
+
+# ** Split Window
+unbind & # unbind default binding for `split-window -h`
+bind - split-window -v -c '#{pane_current_path}' # vertical split
+bind _ split-window -v -c '#{pane_current_path}' -f # full vertical split (v2.3+)
+bind \ split-window -h -c '#{pane_current_path}' # horizontal split
+bind | split-window -h -c '#{pane_current_path}' -f # full horizontal split (v2.3+)
+# https://www.reddit.com/r/tmux/comments/3paqoi/tmux_21_has_been_released/cw5wy00
+bind w switch-client -Tsplit_wind
+bind -Tsplit_wind v split-window -v -c '#{pane_current_path}'
+bind -Tsplit_wind V split-window -v -c '#{pane_current_path}'\; swap-pane -U
+bind -Tsplit_wind h split-window -h -c '#{pane_current_path}'
+bind -Tsplit_wind H split-window -h -c '#{pane_current_path}'\; swap-pane -U
+
+# ** Layout
+bind Space next-layout
+bind C-Space select-layout -o # undo only the last layout change #v2.1
+
+# * Session Management
+bind C-t command-prompt -p "New name for this session:" "rename-session '%%'"
+bind b switch-client -l # switch to previously selected session
+# switch to another session by name
+bind S split-window "tmux ls | peco --initial-index `tmux ls | awk '/attached.$/ {print NR-1}'` | cut -d':' -f 1 | xargs tmux switch-client -t"
+# switch to ANY window in ANY session by name
+bind s split-window "tmux ls | cut -d: -f1 | xargs -I SESSION tmux lsw -F 'SESSION:#{window_name}' -t SESSION | peco --initial-index `tmux ls | cut -d: -f1 | xargs -I SESSION tmux lsw -F '___#{session_attached}#{window_active}___' -t SESSION | awk '/___11___/ {print NR-1}'` | xargs tmux switch-client -t"
+# tmux kill-session -t NAME/SESSIONNUMBER # Kill session
+
+# * Mouse
+# setw -g mode-mouse on # incompatible in tmux 2.1+
+set -g mouse on
+
+# ** Drag pane border to resize
+# set -g mouse-resize-pane off # incompatible in tmux 2.1+
+bind -T root MouseDrag1Border resize-pane -M # default
+# unbind -T root MouseDrag1Border # disable drag pane border to resize
+
+bind -T root MouseDrag1Pane if -Ft= '#{mouse_any_flag}' 'if -Ft= "#{pane_in_mode}" "copy-mode -M" "send-keys -M"' 'copy-mode -M' # default
+
+# ** Left click on pane
+# set -g mouse-select-pane on # incompatible in tmux 2.1+
+# Left click on a pane selects it
+# bind -T root MouseDown1Pane select-pane -t=\; send-keys -M # default
+bind -T root MouseDown1Pane select-pane -t=
+
+# Sun Feb 19 11:31:34 EST 2017 - kmodi
+# Below break in tmux 2.4
+# # Fri Aug 26 18:35:21 EDT 2016 - kmodi
+# # FIXME Need to remember why I unbound the below 2 bindings
+# unbind -temacs-copy MouseDown1Pane
+# unbind -temacs-copy MouseUp1Pane
+# #
+
+# https://groups.google.com/forum/#!topic/tmux-users/mHhdx7Au0Ds
+# Fri Aug 26 18:30:15 EDT 2016 - kmodi
+# Do not do the below!! That will update the primary selection with the top-most
+# tmux buffer each time you left click on a pane.
+# bind -T root MouseUp1Pane run -b "tmux show-buffer | xclip -i -sel pri"
+#
+
+# Left click in the pane *followed after a region selection* copies that to the
+# secondary selection
+bind -T root MouseUp1Pane run -b "tmux show-buffer | xclip -i -sel sec"
+# Fri Aug 26 19:03:57 EDT 2016 - kmodi
+# FIXME: As of today it needs to be figured out how to best paste the content
+# from secondary selection
+
+# ** Middle click on pane
+# Middle click in a pane to paste from the primary selection
+bind -T root MouseDown2Pane run -b "xclip -o -sel pri | tmux load-buffer - && tmux paste-buffer -s ' '"
+
+# ** Right click on pane
+# Right click on a pane selects and marks it *if not in copy-mode*; else
+# passes on the mode keys
+# bind -T root MouseDown3Pane select-pane -t= -m # default
+bind -T root MouseDown3Pane if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t= -m'
+
+# Sun Feb 19 11:32:00 EST 2017 - kmodi
+# Below breaks in tmux 2.4
+# # Right click *release* on a pane *in copy-mode* quits copy-mode
+# bind -temacs-copy MouseUp3Pane cancel
+
+# ** Wheel scroll in pane
+unbind -T root WheelUpPane
+unbind -T root WheelDownPane
+# Do mouse wheel-up to enter copy mode and do page-up
+# https://groups.google.com/d/msg/tmux-users/XTrSVUR15Zk/3iyJLMyQ7PwJ
+# Below binding did not work
+# bind -T root WheelUpPane if -Ft= '#{mouse_any_flag}' 'if -Ft= "#{pane_in_mode}" "copy-mode -u" "send-keys -M"' 'copy-mode -u'
+# Below works and allows the WheelUpPane binding in emacs-copy table to be effective
+bind -T root WheelUpPane if -Ft= '#{mouse_any_flag}' 'send-keys -M' 'if -Ft= "#{pane_in_mode}" "send-keys -M" "copy-mode -u"'
+# |---------------------+-----------------------------------------+--------------------------------|
+# | using mouse? AND .. | #{pane_in_mode} (already in copy-mode?) | action |
+# |---------------------+-----------------------------------------+--------------------------------|
+# | Yes | Don't care | Send the mode keys |
+# | No | Yes | Send the mode keys |
+# | No | No | Enable copy-mode and do PageUp |
+# |---------------------+-----------------------------------------+--------------------------------|
+
+# *** Wheel scroll in pane WHILE in copy-mode
+# Sun Feb 19 11:32:16 EST 2017 - kmodi
+# Below breaks in tmux 2.4
+# # Once in copy-mode, mouse wheel scrolls scrolls by half pages
+# bind -temacs-copy WheelUpPane halfpage-up
+# bind -temacs-copy WheelDownPane halfpage-down
+
+# ** Left click on status
+# set -g mouse-select-window on # incompatible in tmux 2.1+
+# Left click on a window name in status bar to select it
+bind -T root MouseDown1Status select-window -t= # default
+
+# ** Middle click on status
+# Middle click on a window name in status bar to kill it
+bind -T root MouseDown2Status kill-window
+
+# ** Other mouse settings
+# The special token ‘{mouse}’ or ‘=’ may be used as target-window or target-pane in
+# commands bound to mouse key bindings. Example: -t =
+
+# * Window Title
+set -g set-titles on
+set -g set-titles-string '#h :: #S:W#I(#W).P#P'
+
+# * Status Bar
+set -g status-interval 5 # default = 15 seconds
+set -g status-justify centre
+
+# ** Left Status
+set -g status-left-length 20
+# Change the left status when prefix is pressed.
+# https://www.reddit.com/r/tmux/comments/5cm2ca/post_you_favourite_tmux_tricks_here/d9ziuy9/
+set -g status-left "#{?client_prefix,#[fg=yellow]prefix pressed ..,[#S]}"
+
+# ** Right Status
+set -g status-right-length 20
+set -g status-right "%l:%M %b %d %a "
+
+# ** Pane Status
+setw -g pane-border-status "bottom"
+setw -g pane-border-format " #P #T "
+
+# # tmux-powerline
+# # https://github.com/erikw/tmux-powerline
+# set -g status-left-length 30
+# set -g status-right-length 30
+# set -g status-left "#(~/usr_local/scripts/tmux-powerline/powerline.sh left)"
+# set -g status-right "#(~/usr_local/scripts/tmux-powerline/powerline.sh right)"
+
+# * Colors
+
+# ** Status Bar Colors
+set -g status-style fg=colour246,bg=colour233 # default for whole status line
+set -g status-left-style fg=white,bold,bg=colour233
+set -g status-right-style fg=colour75,none,bg=colour233
+
+# ** Message Colors
+set -g message-style fg=colour2,bold,bg=default
+
+# ** Window Status Colors
+setw -g window-status-style default # default for all window statuses
+setw -g window-status-last-style fg=default,bg=colour235
+setw -g window-status-current-style fg=white,bold,bg=colour63
+setw -g window-status-bell-style default
+setw -g window-status-activity-style fg=white,none,bg=colour196
+# setw -g window-status-content-style fg=black,none,bg=green # incompatible with tmux 2.0+
+
+# ** Pane Colors
+setw -g pane-active-border-style fg=colour63,bg=default
+setw -g pane-border-style fg=colour235,bg=default
+setw -g window-active-style 'bg=#330000' # bg color of active pane
+setw -g window-style 'bg=black' # bg color of inactive pane(s)
+
+# ** Mode Info Colors
+# Color of display shown on top-right in copy-mode, highlighting
+setw -g mode-style fg=black,bg=colour244
+
+# * Activity
+# Notify when a window has activity
+# This quick snippet will have tmux notify you in the status area when a
+# window has activity:
+setw -g monitor-activity on
+set -g visual-activity off # Display message telling that an activity happened (on/off)
+# It lets me know that there is activity in a non-active window
+# To try this, enter `sleep 10 && echo “Hi”` in a window and switch to
+# another window.
+
+# # Notify when a window has a content alert
+# setw -g monitor-content "--[A-Za-z][A-Za-z]sim Done--" # This string appears when a sim finishes, alert then # incompatible with tmux 2.0+
+# # setw -g monitor-content "" # Disable monitor-content
+# set -g visual-content on # Display message telling that a content alert was triggered (on/off) # incompatible with tmux 2.0+
+
+# * Command Prompt
+# Move focus to command prompt. tmux commands can be entered there directly
+# without using the `tmux` prefix and it also supports auto-complete.
+bind C-x command-prompt # default command-prompt binding "PREFIX :" also works
+
+# * Audible and Visual Bells
+set -g bell-action any
+set -g bell-on-alert off
+set -g visual-bell on
+
+# * Copy & Paste
+set -g set-clipboard off # default is on
+
+# Copy tmux buffer to primary and clipboard selections
+# run -b runs a shell command in background
+# http://grota.github.io/blog/2012/05/08/tmux-clipboard-integration/
+bind C-w run -b "tmux show-buffer | xclip -i -sel pri && tmux show-buffer | xclip -i -sel cli"
+# Fri Aug 26 18:41:30 EDT 2016 - kmodi
+# Below binding was suggested by Nicholas Marriott
+# But the my older binding works fine so I am commenting out below for now.
+# bind C-w run "tmux saveb - | xclip -i -sel pri; tmux saveb - | xclip -i -sel cli"
+# Paste into tmux; also replace LF characters with
+# space as separator characters (-s) when pasting.
+# Yank from primary
+bind C-y run -b "xclip -o -sel pri | tmux load-buffer - && tmux paste-buffer -s ' '"
+# Yank from clipboard
+bind M-y run -b "xclip -o -sel cli | tmux load-buffer - && tmux paste-buffer -s ' '"
+# Open the file/dir path that was copied by selection in existing emacs client
+# Usage: Highlight a file name in ls output and press "PREFIX e"
+bind e run -b "tmux show-buffer | xclip -i -sel pri; (emacsclient -a '' `tmux display -p '#{pane_current_path}'`/`xclip -o -sel pri `&)"
+
+# * Synchronize commands to panes/windows/sessions
+# Send the same command to all panes in the same window
+bind C-a command-prompt -p "Command to all panes in this window:" \
+ "run \"tmux list-panes -F '##{pane_index}' | xargs -I PANE \
+ tmux send-keys -t PANE '%1' Enter\""
+# Alternative to using the above "C-a" binding is to enable pane synchronization,
+# type the command you want to execute in all panes in the same window and disable
+# pane synchronization
+# Also turn the pane borders red while pane synchronization is enabled.
+# - https://www.reddit.com/r/tmux/comments/5cm2ca/post_you_favourite_tmux_tricks_here/d9y6jzu/
+bind C-s if -F '#{pane_synchronized}' \
+ 'setw synchronize-panes off; \
+ setw pane-active-border-style fg=colour63,bg=default; \
+ setw pane-border-format " #P #T "' \
+ 'setw synchronize-panes on; \
+ setw pane-active-border-style fg=red; \
+ setw pane-border-format " #P - Pane Synchronization ON "'
+# So it would be: C-s <type the command RET> C-s
+
+# https://scripter.co/command-to-every-pane-window-session-in-tmux/
+# Send the same command to all panes/windows in the current session
+bind C-e command-prompt -p "Command:" \
+ "run \"tmux list-panes -s -F '##{session_name}:##{window_index}.##{pane_index}' \
+ | xargs -I PANE tmux send-keys -t PANE '%1' Enter\""
+
+# Send the same command to all panes/windows/sessions
+bind E command-prompt -p "Command:" \
+ "run \"tmux list-panes -a -F '##{session_name}:##{window_index}.##{pane_index}' \
+ | xargs -I PANE tmux send-keys -t PANE '%1' Enter\""
+
+# * Terminal Setting
+
+# From `man tmux', about `default-terminal'
+# Set the default terminal for new windows created in this session - the default
+# value of the TERM environment variable. For tmux to work correctly, this must
+# be set to ‘screen’, ‘tmux’ or a derivative of them.
+# set -g default-terminal "screen"
+set -g default-terminal "screen-256color"
+# Mon May 22 11:43:56 EDT 2017 - kmodi
+# Blinking text (useful to show broken symlinks in ls) does not work when using tmux-24bits.
+# set -g default-terminal "tmux-24bits"
+# tmux-24bits is a custom terminfo profile created using the steps explained
+# on https://github.com/ThomasAdam/tmux/blob/master/FAQ to support italics and
+# 256 colors.
+
+# Enable 24-bit color
+# https://sunaku.github.io/tmux-24bit-color.html
+set -ga terminal-overrides ",screen-256color:Tc"
+# set -ga terminal-overrides ",tmux-24bits:Tc"
+
+# Thu May 31 17:10:04 EDT 2018 - kmodi
+# TODO: Try the 24-bit emacs+tmux config for ST
+# https://www.reddit.com/r/emacs/comments/8ndm2x/gnu_emacs_261_24bit_colors_suckless_st_terminal/dzwh4vv/
+# set -g default-terminal "tmux-256color"
+# set -ga terminal-overrides ",*256col*:Tc"
+#
+
+setw -g xterm-keys on
+
+# Uncomment below when using st (by suckless.org)
+# set -g default-terminal "st-256color"
+# # https://sunaku.github.io/tmux-24bit-color.html
+# # st supports 24-bit color, so enable support for that in tmux
+# set -ga terminal-overrides ",st-256color:Tc"
+# setw -g xterm-keys off
+
+bind R refresh-client
+# bind R refresh-client \; display "Refreshed the client."
+
+# * Other Options
+
+# ** Server Options
+set -s escape-time 0 # Allows for faster key repetition
+
+# ** Session Options
+# Set the default shell to /bin/sh. If the default is tcsh, doing a split-window takes a long
+# time as my tcsh init is loaded first (which takes really long).
+set -g default-shell /bin/sh
+# If I am doing a new-window or split-window without a specified command, start the tcsh
+# shell by default.
+set -g default-command tcsh
+set -g history-limit 100000
+set -g display-time 1000 # Duration of tmux display messages in milliseconds
+
+# ** Window Options
+# When a smaller terminal connects to a tmux client, it shrinks to fit it. The
+# clients attached with bigger displays see this constrained view.
+# aggressive-resize makes it such that the window is only resized if the smaller
+# client is actively looking at it.
+setw -g aggressive-resize on
+setw -g mode-keys emacs # Use emacs keybindings in copy mode
+setw -g status-keys emacs
+
+# * Notes
+
+# |-------------------+------------|
+# | tmux command | short form |
+# |-------------------+------------|
+# | set-option | set |
+# | set-window-option | setw |
+# | bind-key | bind |
+# | unbind-key | unbind |
+# | display-message | display |
+# | run-shell | run |
+# | if-shell | if |
+# |-------------------+------------|
+
+# Colo'u'r table
+# http://guns.github.io/xterm-color-table.vim/images/xterm-color-table.png
+
+# CHARACTER PAIR REPLACED WITH
+# #(command) First line of command’s output
+# #[attributes] Colour or attribute change
+# #H Hostname of local host
+# #I Current window index
+# #P Current pane index
+# #S Session name
+# #T Current window title
+# #W Current window name
+# ## A literal ‘#’
+
+# Variables used in time format
+# Source: http://docs.splunk.com/Documentation/Splunk/5.0.2/SearchReference/Commontimeformatvariables
+# %y = year in numbers (2-digit)
+# %Y = year in numbers (4-digit)
+# %m = month in number (eg: 12)
+ # %B = full month name (eg: December)sho
+# %b = short month name (eg: Dec)
+# %d = day in numbers, with leading zeros (eg: 08)
+# %e = day in numbers, no leading zeros (eg: 8)
+# %A = full weekday name (eg: Sunday)
+# %a = short weekday name (eg: Sun)
+# %H = hours in 24-clock, with leading zeros
+# %k = hours in 24-clock, no leading zeros
+# %l = hours in 12-clock, with leading zeros
+# %p = am/pm
+# %T = time in 24-hour notation (%H:%M:%S)
+
+# PREFIX ? : list-keys, display key bindings
+
+# In command-prompt: show-options -g shows the global options
+# In command-prompt: show-window-options -g shows the global windows options
+
+# How do I know which tmux version I am running?
+# tmux -V
+
+# How to set bindings that don't need the prefix?
+# bind -n .. or
+# bind -T root ..
+
+# Changelog: https://github.com/tmux/tmux/blob/master/CHANGES
+
+# style colors: default, black, red, green, yellow, blue, magenta, cyan, white,
+# colour0-colour255, hexdecimal RGB string '#ffffff'
+# Use $SCRIPTS/bash/256-colors.sh to figure out the color number you want
+# style attributes: none, bold/bright, dim, underscore, blink, reverse, hidden,
+# or italics
+
+# https://www.reddit.com/r/tmux/comments/3paqoi/tmux_21_has_been_released/cw552qd
+
+# tmux buffers
+# PREFIX # : List all paste buffers
+# PREFIX - : Delete the most recently copied buffer of text
+# PREFIX = : Choose which buffer to paste interactively from a list
+# PREFIX ] : Paste the most recently copied buffer of text
+
+# How to start a temporary tmux server in addition to an existing running one?
+# > tmux -L temp
+
+# In a shell environment in a terminal in tmux, the env var $TMUX will be
+# defined to something like "/tmp/tmux-23273/default,31101,0". Outside tmux,
+# $TMUX will be undefined.
+
+# Notation to address a specific pane
+# SESSION_NAME:WINDOW_INDEX.PANE_NUMBER (Example: foo:2.1 i.e. Pane 1 in Window 2 of Session foo)
+
+# To print a message containing tmux variable values to stdout use '-p' option in display-message
+# tmux display-message -p '#{session_name}:#{window_name}.#{pane_index}', or
+# tmux display -p '#{session_name}:#{window_name}.#{pane_index}'
diff --git a/regress/conf/d2e576f947e108eb9903679b65c81fbc.conf b/regress/conf/d2e576f947e108eb9903679b65c81fbc.conf
new file mode 100644
index 00000000..392a69f0
--- /dev/null
+++ b/regress/conf/d2e576f947e108eb9903679b65c81fbc.conf
@@ -0,0 +1,198 @@
+### GENERAL
+
+set-option -g prefix C-a # Set prefix to <C-a>
+bind a send-prefix # Send <C-a> with <C-a>a
+
+bind R source-file ~/.tmux.conf \; display "~/.tmux.conf reloaded"
+bind -n M-R source-file ~/.tmux.conf \; display "~/.tmux.conf reloaded"
+
+set -g history-limit 10000 # lines to keep in hisoty
+set-option -g display-panes-time 3000 # Timeout for pane-numbering in ms
+bind -n M-q display-panes
+set-option -sg escape-time 0 # speed up commands
+set -g mouse on # enable mouse (tmux 2.1+)
+set -g base-index 1 # start window numbering at 1
+set -g pane-base-index 1 # start pane numbering at 1
+set -g renumber-windows on # renumber windows automatically
+setw -g automatic-rename on # rename window after process
+
+# Clear window name before renaming
+bind , rename-window "" \; command-prompt "rename-window '%%'"
+
+#### APPEARANCE
+
+set -g default-terminal "screen-256color" # use 256 colors
+setw -g aggressive-resize on # resize window to smallest client
+
+set -g pane-border-style fg=colour238 # border color for inactive panes
+set -g pane-active-border-style fg=colour247 # border color for active panes
+
+# Status bar colors and format
+setw -g window-status-format ' #[fg=#999999]#I #[fg=$666666]#W '
+setw -g window-status-current-format '#[fg=#ffffff] #I #W#[fg=#ffffff] '
+setw -g window-status-separator '#[fg=#292929]|#[fg=default]'
+set -g status-bg default # background color for status bar
+set -g status-position bottom # put status bar on top or bottom
+set -g status-interval 2 # interval in s to update status
+set -g status-justify left # horizontal alignment
+set -g message-style fg=white,bg=black # appearance of status messages
+set -g message-command-style fg=white # appearance of status message cmds
+
+# Left section of status bar
+set -g status-left ""
+
+# Status bar visibility
+set -g status off
+bind -r -n M-t set status on
+bind -r -n M-T set status off
+bind t set status on
+bind T set status off
+
+# Right section of status bar
+if-shell 'uname | grep -qi Darwin' "set -g status-right \"#[fg=#81a2be]#(/usr/local/bin/mpc | head -n 1 | sed 's/volume.*$//') #[fg=cyan]#(~/bin/battery-osx) #(~/bin/mailstatus.sh) #[fg=yellow]#(uptime|sed 's/.* //') #[fg=#666666]%F #[fg=#bababa]%R\""
+
+if-shell 'uname | grep -qi Linux' "set -g status-right \"#[fg=cyan]#(~/bin/battery-linux) #(~/bin/mailstatus.sh) #[fg=yellow]#(cat /proc/loadavg|awk '{print $1;}') #[fg=#666666]%F #[fg=#bababa]%R\""
+
+# Scaling of status-bar sections
+set -g status-right-length 40
+
+
+#### NAVIGATION
+
+# With C-a prefix
+bind h select-pane -L # navigate left with <C-a>h
+bind j select-pane -D # navigate down with <C-a>j
+bind k select-pane -U # navigate up with <C-a>k
+bind l select-pane -R # navigate right with <C-a>l
+bind -r H resize-pane -L 5 # resize pane left with <C-a>H
+bind -r J resize-pane -D 5 # resize pane down with <C-a>J
+bind -r K resize-pane -U 5 # resize pane up with <C-a>K
+bind -r L resize-pane -R 5 # resize pane right with <C-a>L
+
+# Navigate panes with Meta (alt) modifier + hjkl
+bind -r -n M-h select-pane -L # navigate left with M-h
+bind -r -n M-j select-pane -D # navigate down with M-j
+bind -r -n M-k select-pane -U # navigate up with M-k
+bind -r -n M-l select-pane -R # navigate right with M-l
+bind -r -n M-H resize-pane -L 5 # resize pane left with M-H
+bind -r -n M-J resize-pane -D 5 # resize pane down with M-J
+bind -r -n M-K resize-pane -U 5 # resize pane up with M-K
+bind -r -n M-L resize-pane -R 5 # resize pane right with M-L
+
+# Navigate windows with Meta (alt) modifier + number keys
+bind -n M-1 select-window -t :=1
+bind -n M-2 select-window -t :=2
+bind -n M-3 select-window -t :=3
+bind -n M-4 select-window -t :=4
+bind -n M-5 select-window -t :=5
+bind -n M-6 select-window -t :=6
+bind -n M-7 select-window -t :=7
+bind -n M-8 select-window -t :=8
+bind -n M-9 select-window -t :=9
+bind -n M-0 select-window -t :=10
+
+bind C-s last-window # go to last window with <C-a><C-s>
+bind C-a last-pane # go to last pane with <C-a><C-a>
+bind -n M-s last-window # go to last pane with M-s
+bind -n M-a last-pane # go to last pane with M-a
+bind -r n next-window # next window with <C-a>n
+bind -r b previous-window # next window with <C-a>p
+
+bind -n -r M-n next-window # next window with <M-n>
+bind -n -r M-b previous-window # previous window with <M-n>
+#bind -n M-, run-shell "tmux list-panes -as -F \"##I.##P ##{pane_current_command} . #{pane_current_path} (#W)#F\" | fzf-tmux | cut -d \" \" -f 1 | xargs tmux select-pane -t"
+bind -n M-, run-shell "tmux list-windows -F \"##I:##W\" | fzf-tmux | cut -d \":\" -f 1 | xargs tmux select-window -t"
+bind -n M-. run-shell "tmux list-sessions -F \"##S\" | fzf-tmux | xargs tmux switch -t"
+
+
+#### LAYOUT CHANGING BINDINGS
+
+# create panes in same directory
+bind '"' split-window -c "#{pane_current_path}"
+bind '%' split-window -h -c "#{pane_current_path}"
+
+bind -r z resize-pane -Z # toggle pane zoom with <C-a>z
+bind -r y next-layout # cycle to next pane layout with <C-a>y
+bind -r Y previous-layout # cycle to previous pane layout with <C-a>Y
+bind -r r rotate-window # rotate panes with <C-a>r
+
+bind -n M-z resize-pane -Z # toggle pane zoom with <M-z>
+bind -n -r M-y next-layout # cycle to next pane layout with <M-y>
+bind -n -r M-Y previous-layout # cycle to previous pane layout with <M-Y>
+bind -n -r M-r rotate-window # rotate panes with <M-r>
+
+bind -r Left swap-window -t -1 # Swap window left
+bind -r Right swap-window -t +1 # Swap window right
+
+bind -r B swap-window -t -1 # Swap window left
+bind -r N swap-window -t +1 # Swap window right
+bind -n -r M-B swap-window -t -1 # Swap window left
+bind -n -r M-N swap-window -t +1 # Swap window right
+
+#### CLIPBOARD
+
+# enable reattach-to-user-namespace which fixes pasteboard access and launchctl
+bind Space copy-mode # enter copy mode with <C-a><Space>
+bind -n M-u copy-mode # enter copy mode with M-u
+bind -T copy-mode-vi M-u send -X halfpage-up # scroll up with M-u
+bind -T copy-mode-vi M-d send -X halfpage-down # scroll down with M-d
+bind -T copy-mode-vi v send -X begin-selection # start "visual" with v
+
+# Copy (yank) with y
+if-shell 'uname | grep -qi Linux && which xclip > /dev/null' 'bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "DISPLAY=:0 xclip -i -sel clipboard"'
+if-shell 'uname | grep -qi Darwin' 'bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "pbcopy"'
+if-shell 'uname | grep -qi Cygwin' 'bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "cat > /dev/clipboard"'
+
+# Paste with C-a p or M-p
+if-shell 'uname | grep -qi Linux && which xclip > /dev/null' 'bind p run "DISPLAY=:0 xclip -o | tmux load-buffer - ; tmux paste-buffer"'
+if-shell 'uname | grep -qi Darwin && which reattach-to-user-namespace > /dev/null' 'bind p run "pbpaste | tmux load-buffer - ; tmux paste-buffer"'
+if-shell 'uname | grep -qi Darwin' 'bind -n M-p run "pbpaste | tmux load-buffer - ; tmux paste-buffer"'
+if-shell 'uname | grep -qi Cygwin' 'bind p run "cat /dev/clipboard | tmux load-buffer - ; tmux paste-buffer"'
+if-shell 'uname | grep -qi Cygwin' 'bind -n M-p run "cat /dev/clipboard | tmux load-buffer - ; tmux paste-buffer"'
+
+
+#### LAUNCH PROCESSES
+
+# use urlview to follow URLs in current pane
+bind u capture-pane -J \; \
+ save-buffer "/tmp/active_tmux_buffer" \; \
+ delete-buffer \; \
+ split-window -l 10 "urlview '/tmp/active_tmux_buffer' && rm /tmp/active_tmux_buffer"
+
+# Launch offlineimap in inactive splits
+bind o split-window -p 25 '$SHELL -c "offlineimap -qf INBOX"' \; select-pane -l
+bind O split-window -p 25 '$SHELL -c "offlineimap"' \; select-pane -l
+
+# Use nested bindings (<C-a>l) for grouping process launch bindings
+bind -n C-M-v new-window -n vim "/usr/local/bin/vim"
+bind -n C-M-w new-window -n weather \
+ "curl 'wttr.in/?m'; echo -e '\nPress <enter> to quit'; read -n 1 -s"
+
+# Open new window and resize status accordingly (should be a hook instead)
+bind Enter new-window -c "#{pane_current_path}" "$SHELL"
+bind -n M-Enter new-window \
+ "tmux set status-right-length `echo $(tput cols)/2|bc|tr -d '\n'`; zsh"
+
+# Use nested bindings (<C-a>m) for grouping music-control bindings
+bind m switchc -Tmpd
+bind -n M-m switchc -Tmpd
+bind -Tmpd v new-window -n vimpc "vimpc"
+bind -Tmpd p display "#(mpc toggle | tr '\n' ' ')"
+bind -Tmpd s display "#(mpc stop | tr '\n' ' ')"
+bind -Tmpd n display "#(mpc next | tr '\n' ' ')"
+bind -Tmpd b display "#(mpc prev | tr '\n' ' ')"
+bind -Tmpd r display "#(mpc clear && mpc ls | mpc add && mpc random on && mpc play | tr '\n' ' ')"
+#bind -Tmpd r new-window -n mpc "mpc clear && mpc ls | mpc add && mpc shuffle && mpc play"
+
+bind -n C-M-p display "#(mpc toggle | tr '\n' ' ')"
+bind -n C-M-s display "#(mpc stop | tr '\n' ' ')"
+bind -n C-M-n display "#(mpc next | tr '\n' ' ')"
+bind -n C-M-b display "#(mpc prev | tr '\n' ' ')"
+#bind -n C-M-r display "#(mpc clear && mpc ls | mpc add && mpc random on && mpc play | tr '\n' ' ')"
+bind -n C-M-a split-window -p 50 "source ~/code/fzf-mpd/fzf-mpd.zsh && fm"
+
+# fzf-locate from entire file system and insert result in current pane (Alt-`)
+bind -n 'M-`' run "tmux split-window -p 40 'tmux send-keys -t #{pane_id} \"$(locate / | fzf -m | paste -sd\\ -)\"'"
+
+# Change to the previous pane, repeat the last command, change back
+bind -n M-! last-pane \; send-keys C-p C-m \; last-pane
diff --git a/regress/conf/e2661d67d0d45a8647fb95de76ec8174.conf b/regress/conf/e2661d67d0d45a8647fb95de76ec8174.conf
new file mode 100644
index 00000000..79f46df1
--- /dev/null
+++ b/regress/conf/e2661d67d0d45a8647fb95de76ec8174.conf
@@ -0,0 +1,78 @@
+# Scott Rochford's tmux configuration
+#
+# change the prefix to the GNU screen default (avoids clash with page up in vi)
+set -g prefix C-a
+unbind-key C-b
+bind-key C-a send-prefix
+# toggle sending input to all panes
+bind-key b set-window-option synchronize-panes
+# alternative to ',' which doesn't pre-fill the prompt with the existing name
+bind-key < command-prompt "rename-window '%%'"
+
+# Disabled all of these in favour of changing 'default-command' below.
+#bind-key C-p pipe-pane -o 'cat >>~/tmux_logs/output.$(echo #I-#P-#W-#T | sed "s/[^[:alnum:].-]/_/g")' \; display-message 'Toggled logging'
+# From http://unix.stackexchange.com/questions/5832/is-there-an-equivalent-of-gnu-screens-log-command-in-tmux
+# bind-key H pipe-pane -o "exec cat >>$HOME/'#W-tmux.log'" \; display-message 'Toggled logging to $HOME/#W-tmux.log'
+#bind-key H pipe-pane "exec cat >>$HOME/'#W-tmux.log'" \; display-message 'Started logging to $HOME/#W-tmux.log'
+#bind-key h pipe-pane \; display-message 'Ended logging to $HOME/#W-tmux.log'
+
+#set -g utf8 on
+
+set-option -g history-limit 32768
+
+# no longer available in 2.2
+#set-option -g mouse-select-pane on
+#set-option -g mouse-select-window on
+set-option -g mouse on
+
+# increase the amount of time status bar messages are displayed for (default 1000 I think)
+set-option -g display-time 1500
+# unfortunately this seems to have no effect in putty :-(
+set-option -g set-clipboard on
+set-option -g default-command 'tmux pipe-pane -o "cat >>~/tmux_logs/output-`date +%Y%m%d-%H%M%S-$$`" ; /bin/ksh -l'
+#
+# allow yank into system clipboard
+# from http://stackoverflow.com/questions/17255031/how-to-copy-from-tmux-running-in-putty-to-windows-clipbard
+#
+# for some reason this is wrapping at 80 cols, using save- instead of show- helps
+# -b for background is needed because xclip continues to run to service the clipboard paste reqeusts until the
+# clipboard buffer is replaced with some new contents
+#bind C-y run-shell -b "tmux save-buffer - | DISPLAY=$(<~/.xdisplay) xclip -selection clipboard -in && tmux display-message 'xclipped successfully'"
+bind C-y save-buffer ~/etc/clipboard.pipe
+#
+# this was just for testing, but interestingly for some reason tmux-show-buffer >/tmp/t never terminates, writing to a pipe works fine??
+#bind C-z run-shell "tmux show-buffer | cat >/tmp/t"
+# move x clipboard into tmux paste buffer
+#bind C-p run-shell -b "xclip -o -selection clipboard | tmux load-buffer - ; tmux paste-buffer"
+bind C-p run-shell "DISPLAY=$(<~/.xdisplay) xclip -o -selection clipboard | tmux load-buffer - ; tmux paste-buffer"
+
+# switch to last-but-one window (like prefix-l but last, last)
+# only works on tmux-2.4 + with Nicholas Marriott's patch from my feature request, unless it reached mainline....
+#bind k run-shell "tmux select-window -t $(tmux list-windows -F '#{session_stack}' | awk -F, '{print $3;exit}END{print $1}')"
+bind k run-shell "tmux select-window -t $(echo #{session_stack} | awk -F, '{w=$1}NF>=3{w=$3;exit}END{print w}')"
+
+# switch to oldest window (for clean-up), not sure why brackets are required around (NF) here...
+bind K run-shell "tmux select-window -t $(echo #{session_stack} | awk -F, '{print $(NF)}')"
+
+# prompt for hosts to connect to, open a new synchronized window with horizontally split panes for each host, supports brace expansion
+bind N command-prompt -p hosts: 'run-shell -b "bash -c \"~/lbin/nw %% >/dev/null\""'
+
+# seems to cause unexpected resizes when focussing on putty :-(
+#set-option mouse-resize-pane on
+
+#05:59 < Celti> annihilannic: I believe the #{pane_in_mode} format does what you want
+#05:59 < Celti> put it in your statusline
+#05:59 < Celti> annihilannic: No, my mistake, I should have read farther down, you want #{pane_synchronized}
+# only works in tmux 2.0?, higher than 1.6.3 anyawy
+set-option -g window-status-format ' #I:#W#F#{?pane_synchronized,S,}'
+#set-option -g window-status-current-format ' #I:#W#{?pane_synchronized,[sync],}#F'
+# to highlight in red when sync is on... not sure why I did this with set-window-option instead of set-option, perhaps
+# both work?
+set-window-option -g window-status-current-format "#{?pane_synchronized,#[bg=red],}#{?window_zoomed_flag,#[bg=yellow],} #I:#W#F#{?pane_synchronized,S,}"
+#
+# also only in 2.0? if I use this, don't need #F in window-status-*-format? - actually, nah,
+# still useful for showing [Z]oomed, or - last active, etc.
+set-option -g window-status-current-style bg=blue
+
+# Toggle input on a pane (from Thomas Sattler)
+bind-key R if -F '#{pane_input_off}' "select-pane -e; select-pane -P fg=default" "select-pane -d; select-pane -P fg=yellow" \ No newline at end of file
diff --git a/regress/conf/ed08995f38b5a3079262a88d2563abe4.conf b/regress/conf/ed08995f38b5a3079262a88d2563abe4.conf
new file mode 100644
index 00000000..a0fd1500
--- /dev/null
+++ b/regress/conf/ed08995f38b5a3079262a88d2563abe4.conf
@@ -0,0 +1,283 @@
+#---------------------------------------------------------------------------#
+# .tmux.conf
+# Helmut K. C. Tessarek, Last update 2018-10-16
+#---------------------------------------------------------------------------#
+
+#---------------------------------------------------------------------------#
+# set prefix key to ctrl+a / ctrl-b is used in vi for going back one page
+#---------------------------------------------------------------------------#
+unbind C-b
+set -g prefix C-a
+
+#---------------------------------------------------------------------------#
+# send the prefix to client inside window (nested sessions)
+#---------------------------------------------------------------------------#
+bind-key a send-prefix
+
+#---------------------------------------------------------------------------#
+# toggle last window like screen
+#---------------------------------------------------------------------------#
+bind-key C-a last-window
+
+#---------------------------------------------------------------------------#
+# start window indexing at one instead of zero
+#---------------------------------------------------------------------------#
+#set -g base-index 1
+
+#---------------------------------------------------------------------------#
+# default terminal - we want 256 colors !!!
+#---------------------------------------------------------------------------#
+set -g default-terminal "screen-256color"
+
+#---------------------------------------------------------------------------#
+# on-screen time for status messages in ms
+#---------------------------------------------------------------------------#
+set -g display-time 2000
+
+#---------------------------------------------------------------------------#
+# on-screen time for display-panes in ms
+#---------------------------------------------------------------------------#
+set -g display-panes-time 2000
+
+#---------------------------------------------------------------------------#
+# color for display pane indicator
+#---------------------------------------------------------------------------#
+set -g display-panes-colour "cyan"
+#set -g display-panes-active-colour "#0087ff"
+#set -g display-panes-active-colour "red"
+
+#---------------------------------------------------------------------------#
+# open a man page in new window
+#---------------------------------------------------------------------------#
+unbind m
+bind m command-prompt "split-window 'exec man %%'"
+
+#---------------------------------------------------------------------------#
+# quick view of processes
+#---------------------------------------------------------------------------#
+#bind '~' split-window "exec htop"
+
+#---------------------------------------------------------------------------#
+# scrollback buffer n lines
+#---------------------------------------------------------------------------#
+set -g history-limit 5000
+
+#---------------------------------------------------------------------------#
+# toggle status bar
+#---------------------------------------------------------------------------#
+unbind b
+bind-key b set-option status
+
+#---------------------------------------------------------------------------#
+# resize panes like vim
+# feel free to change the "1" to however many lines you want to resize by,
+# only one at a time can be slow
+#---------------------------------------------------------------------------#
+unbind <
+unbind >
+unbind -
+unbind +
+bind -r < resize-pane -L 1
+bind -r > resize-pane -R 1
+bind -r - resize-pane -D 1
+bind -r + resize-pane -U 1
+
+#---------------------------------------------------------------------------#
+# toggle mouse helpers
+#---------------------------------------------------------------------------#
+unbind Enter
+unbind C-m
+bind C-m set-option mouse \; display-message 'mouse -> #{?mouse,on,off}'
+
+#---------------------------------------------------------------------------#
+# Reload config file
+#---------------------------------------------------------------------------#
+unbind R
+bind-key R source-file ~/.tmux.conf \; display-message "Reloading configuration done"
+
+#---------------------------------------------------------------------------#
+# start ssh session in new window
+#---------------------------------------------------------------------------#
+unbind S
+bind-key S command-prompt "new-window -n %1 'ssh %1'"
+
+#---------------------------------------------------------------------------#
+# start new session
+#---------------------------------------------------------------------------#
+unbind C
+bind-key C command-prompt "new-session -s %1"
+
+#---------------------------------------------------------------------------#
+# Keys to switch session
+#---------------------------------------------------------------------------#
+bind Q switchc -t0
+bind W switchc -t compile
+bind E switchc -t config
+
+#---------------------------------------------------------------------------#
+# break pane in background
+#---------------------------------------------------------------------------#
+unbind '@'
+bind '@' break-pane -d
+
+#---------------------------------------------------------------------------#
+# join pane with target window
+#---------------------------------------------------------------------------#
+unbind ^
+bind ^ command-prompt "join-pane -t %1"
+
+#---------------------------------------------------------------------------#
+# move around panes with hjkl, as one would in vim after pressing ctrl-w
+#---------------------------------------------------------------------------#
+#bind h select-pane -L
+#bind j select-pane -D
+#bind k select-pane -U
+#bind l select-pane -R
+
+#---------------------------------------------------------------------------#
+# bind : to command-prompt like vim
+# this is the default in tmux already
+#---------------------------------------------------------------------------#
+bind : command-prompt
+
+#---------------------------------------------------------------------------#
+# Remain on exit
+#---------------------------------------------------------------------------#
+#setw -g remain-on-exit on
+
+#---------------------------------------------------------------------------#
+# vi-style controls for copy mode
+#---------------------------------------------------------------------------#
+setw -g mode-keys vi
+
+#---------------------------------------------------------------------------#
+# Make mouse useful in copy mode
+#---------------------------------------------------------------------------#
+#setw -g mode-mouse on
+
+#---------------------------------------------------------------------------#
+# More straight forward key bindings for splitting
+#---------------------------------------------------------------------------#
+unbind %
+unbind v
+#bind | split-window -h
+bind v split-window -h
+unbind '"'
+unbind h
+#bind - split-window -v
+bind h split-window -v
+
+#---------------------------------------------------------------------------#
+# Synchronize panes
+#---------------------------------------------------------------------------#
+unbind y
+bind y set-window-option synchronize-panes \; display-message 'synchronize-panes -> #{?synchronize-panes,on,off}'
+
+#---------------------------------------------------------------------------#
+# Other key codes: Tab, BTab, Escape
+#---------------------------------------------------------------------------#
+
+#---------------------------------------------------------------------------#
+# Clock
+#---------------------------------------------------------------------------#
+setw -g clock-mode-colour green
+setw -g clock-mode-style 24
+
+#---------------------------------------------------------------------------#
+# Terminal emulator window title
+#---------------------------------------------------------------------------#
+set -g set-titles on
+set -g set-titles-string '#S:#I.#P #W'
+
+#---------------------------------------------------------------------------#
+# Status Bar
+#---------------------------------------------------------------------------#
+set -g status-bg black
+set -g status-fg white
+set -g status-interval 1
+set -g status-left-length 30
+set -g status-left '#[fg=green]#h#[default] '
+#set -g status-right '#[fg=yellow]#(cut -d " " -f 1-4 /proc/loadavg)#[default] #[fg=cyan,bold]%Y-%m-%d %H:%M:%S#[default]'
+#set -g status-right '#[fg=yellow,bold]%Y-%m-%d %H:%M#[default]'
+set -g status-right '#[fg=yellow]%Y-%m-%d %H:%M %Z#[default]'
+#set -g status-justify center
+#set -g status-keys vi
+
+set -g allow-rename off
+setw -g automatic-rename on
+
+#---------------------------------------------------------------------------#
+# Highlighting the active window in status bar
+#---------------------------------------------------------------------------#
+#setw -g window-status-current-bg red
+set-option -g window-status-format "#I:#W#F#{?pane_synchronized,S,}"
+set-window-option -g window-status-current-format "#{?pane_synchronized,#[bg=red],}#{?window_zoomed_flag,#[bg=colour130],}#I:#W#F#{?pane_synchronized,S,}"
+set-option -g window-status-current-style bg=blue
+
+#---------------------------------------------------------------------------#
+# global update environment
+#---------------------------------------------------------------------------#
+set -g update-environment "DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY TZ"
+
+#---------------------------------------------------------------------------#
+# settings for AIX
+# terminal overrides to enable colors
+# set default terminal to vt100 or xterm (screen does not exist on AIX)
+#---------------------------------------------------------------------------#
+if-shell "uname|grep AIX" 'set -g terminal-overrides "xterm*:XT,xterm*:setab=\\E[4%p1%dm,xterm*:setaf=\\E[3%p1%dm"'
+#if-shell "uname|grep AIX" "set -g default-terminal vt100"
+if-shell "uname|grep AIX" "set -g default-terminal xterm"
+
+#---------------------------------------------------------------------------#
+# settings for macOS
+#---------------------------------------------------------------------------#
+if-shell "uname|grep Darwin" 'set -g default-command "/bin/bash -l"'
+
+#---------------------------------------------------------------------------#
+# Pane coloring
+# set inactive/active window styles
+#---------------------------------------------------------------------------#
+set -g window-style "fg=colour247,bg=colour234"
+set -g window-active-style "fg=colour250,bg=black"
+set -g @TPCS "1"
+
+#---------------------------------------------------------------------------#
+# pane border - different style / use cyan
+#---------------------------------------------------------------------------#
+#set -g pane-border-bg colour235
+#set -g pane-border-fg colour238
+#set -g pane-active-border-bg colour234
+#set -g pane-active-border-fg colour51
+
+#---------------------------------------------------------------------------#
+# toggle pane coloring on/off
+#---------------------------------------------------------------------------#
+unbind C-b
+bind C-b if -F '#{@TPCS}' \
+ 'set -g window-style "fg=default,bg=default" ; set -g window-active-style "fg=default,bg=default" ; set -g @TPCS "0"; display-message "Pane coloring -> off"' \
+ 'set -g window-style "fg=colour247,bg=colour234" ; set -g window-active-style "fg=colour250,bg=black" ; set -g @TPCS "1"; display-message "Pane coloring -> on"'
+
+#---------------------------------------------------------------------------#
+# List of plugins
+#---------------------------------------------------------------------------#
+set -g @plugin 'tmux-plugins/tpm'
+#set -g @plugin 'tmux-plugins/tmux-sensible'
+set -g @plugin 'tmux-plugins/tmux-resurrect'
+set -g @plugin 'tmux-plugins/tmux-logging'
+
+set -g @resurrect-capture-pane-contents 'on'
+set -g @resurrect-save-bash-history 'on'
+
+set -g @logging-path $HOME
+set -g @screen-capture-path $HOME
+set -g @save-complete-history-path $HOME
+
+# Other examples:
+# set -g @plugin 'github_username/plugin_name'
+# set -g @plugin 'git@github.com/user/plugin'
+# set -g @plugin 'git@bitbucket.com/user/plugin'
+
+#---------------------------------------------------------------------------#
+# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
+#---------------------------------------------------------------------------#
+run '~/.tmux/plugins/tpm/tpm'
diff --git a/regress/control-client-sanity.sh b/regress/control-client-sanity.sh
new file mode 100644
index 00000000..bf76b4d5
--- /dev/null
+++ b/regress/control-client-sanity.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+PATH=/bin:/usr/bin
+TERM=screen
+
+[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux)
+TMUX="$TEST_TMUX -Ltest"
+$TMUX kill-server 2>/dev/null
+
+TMP=$(mktemp)
+OUT=$(mktemp)
+trap "rm -f $TMP $OUT" 0 1 15
+
+$TMUX -f/dev/null new -d -x200 -y200 || exit 1
+$TMUX -f/dev/null splitw || exit 1
+sleep 1
+cat <<EOF|$TMUX -C a >$TMP
+selectp -t%0
+splitw
+neww
+splitw
+selectp -t%0
+killp -t%1
+swapp -t%2 -s%3
+neww
+splitw
+splitw
+selectl tiled
+killw
+EOF
+sleep 1
+$TMUX has || exit 1
+$TMUX lsp -aF '#{pane_id} #{window_layout}' >$TMP || exit 1
+cat <<EOF|cmp -s $TMP - || exit 1
+%0 f5ab,200x200,0,0[200x50,0,0,0,200x149,0,51,3]
+%3 f5ab,200x200,0,0[200x50,0,0,0,200x149,0,51,3]
+%2 dcbd,200x200,0,0[200x100,0,0,2,200x99,0,101,4]
+%4 dcbd,200x200,0,0[200x100,0,0,2,200x99,0,101,4]
+EOF
+$TMUX kill-server 2>/dev/null
+
+exit 0
diff --git a/regress/control-client-size.sh b/regress/control-client-size.sh
new file mode 100644
index 00000000..dd1850c5
--- /dev/null
+++ b/regress/control-client-size.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+# 947
+# size in control mode should change after refresh-client -C, and -x and -y
+# should work without -d for control clients
+
+PATH=/bin:/usr/bin
+TERM=screen
+
+[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux)
+TMUX="$TEST_TMUX -Ltest"
+$TMUX kill-server 2>/dev/null
+
+TMP=$(mktemp)
+OUT=$(mktemp)
+trap "rm -f $TMP $OUT" 0 1 15
+
+$TMUX -f/dev/null new -d || exit 1
+sleep 1
+cat <<EOF|$TMUX -C a >$TMP
+ls -F':#{window_width} #{window_height}'
+refresh -C 100,50
+ls -F':#{window_width} #{window_height}'
+EOF
+grep ^: $TMP >$OUT
+printf ":80 24\n:100 49\n"|cmp -s $OUT - || exit 1
+$TMUX kill-server 2>/dev/null
+
+$TMUX -f/dev/null new -d || exit 1
+sleep 1
+cat <<EOF|$TMUX -f/dev/null -C a >$TMP
+ls -F':#{window_width} #{window_height}'
+refresh -C 80,24
+ls -F':#{window_width} #{window_height}'
+EOF
+grep ^: $TMP >$OUT
+printf ":80 24\n:80 23\n"|cmp -s $OUT - || exit 1
+$TMUX kill-server 2>/dev/null
+
+cat <<EOF|$TMUX -f/dev/null -C new -x 100 -y 50 >$TMP
+ls -F':#{window_width} #{window_height}'
+refresh -C 80,24
+ls -F':#{window_width} #{window_height}'
+EOF
+grep ^: $TMP >$OUT
+printf ":100 50\n:80 23\n"|cmp -s $OUT - || exit 1
+$TMUX kill-server 2>/dev/null
+
+exit 0
diff --git a/regress/cursor-test.txt b/regress/cursor-test.txt
new file mode 100644
index 00000000..67ed52c8
--- /dev/null
+++ b/regress/cursor-test.txt
@@ -0,0 +1,6 @@
+Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
+incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
+commodo consequat. Duis aute
+irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat
+nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
+deserunt mollit anim id est laborum.
diff --git a/regress/cursor-test1.result b/regress/cursor-test1.result
new file mode 100644
index 00000000..71b9a4b6
--- /dev/null
+++ b/regress/cursor-test1.result
@@ -0,0 +1,33 @@
+14 8 t
+0 ud exercitation ullamco laboris nisi ut
+1 aliquip ex ea
+2 commodo consequat. Duis aute
+3 irure dolor in reprehenderit in voluptat
+4 e velit esse cillum dolore eu fugiat
+5 nulla pariatur. Excepteur sint occaecat
+6 cupidatat non proident, sunt in culpa qu
+7 i officia
+8 deserunt mollit anim id est laborum.
+9
+4 6 t
+0 cupidatat
+1 non proide
+2 nt, sunt i
+3 n culpa qu
+4 i officia
+5 deserunt m
+6 ollit anim
+7 id est la
+8 borum.
+9
+14 8 t
+0 incididunt ut labore et dolore magna aliqua. Ut en
+1 im ad minim veniam, quis nostrud exercitation ulla
+2 mco laboris nisi ut aliquip ex ea
+3 commodo consequat. Duis aute
+4 irure dolor in reprehenderit in voluptate velit es
+5 se cillum dolore eu fugiat
+6 nulla pariatur. Excepteur sint occaecat cupidatat
+7 non proident, sunt in culpa qui officia
+8 deserunt mollit anim id est laborum.
+9
diff --git a/regress/cursor-test1.sh b/regress/cursor-test1.sh
new file mode 100644
index 00000000..2dc20539
--- /dev/null
+++ b/regress/cursor-test1.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+PATH=/bin:/usr/bin
+TERM=screen
+
+[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux)
+TMUX="$TEST_TMUX -f/dev/null -Ltest"
+$TMUX kill-server 2>/dev/null
+
+TMP=$(mktemp)
+trap "rm -f $TMP" 0 1 15
+
+$TMUX -f/dev/null new -d -x40 -y10 \
+ "cat cursor-test.txt; printf '\e[9;15H'; cat" || exit 1
+$TMUX set -g window-size manual || exit 1
+
+$TMUX display -pF '#{cursor_x} #{cursor_y} #{cursor_character}' >>$TMP
+$TMUX capturep -p|awk '{print NR-1,$0}' >>$TMP
+$TMUX resizew -x10 || exit 1
+$TMUX display -pF '#{cursor_x} #{cursor_y} #{cursor_character}' >>$TMP
+$TMUX capturep -p|awk '{print NR-1,$0}' >>$TMP
+$TMUX resizew -x50 || exit 1
+$TMUX display -pF '#{cursor_x} #{cursor_y} #{cursor_character}' >>$TMP
+$TMUX capturep -p|awk '{print NR-1,$0}' >>$TMP
+
+cmp -s $TMP cursor-test1.result || exit 1
+
+$TMUX kill-server 2>/dev/null
+exit 0
diff --git a/regress/cursor-test2.result b/regress/cursor-test2.result
new file mode 100644
index 00000000..dc005d2b
--- /dev/null
+++ b/regress/cursor-test2.result
@@ -0,0 +1,33 @@
+9 7 a
+0 cupidatat
+1 non proide
+2 nt, sunt i
+3 n culpa qu
+4 i officia
+5 deserunt m
+6 ollit anim
+7 id est la
+8 borum.
+9
+4 6 a
+0 icia
+1 deser
+2 unt m
+3 ollit
+4 anim
+5 id e
+6 st la
+7 borum
+8 .
+9
+29 8 a
+0 incididunt ut labore et dolore magna aliqua. Ut en
+1 im ad minim veniam, quis nostrud exercitation ulla
+2 mco laboris nisi ut aliquip ex ea
+3 commodo consequat. Duis aute
+4 irure dolor in reprehenderit in voluptate velit es
+5 se cillum dolore eu fugiat
+6 nulla pariatur. Excepteur sint occaecat cupidatat
+7 non proident, sunt in culpa qui officia
+8 deserunt mollit anim id est laborum.
+9
diff --git a/regress/cursor-test2.sh b/regress/cursor-test2.sh
new file mode 100644
index 00000000..9791f567
--- /dev/null
+++ b/regress/cursor-test2.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+PATH=/bin:/usr/bin
+TERM=screen
+
+[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux)
+TMUX="$TEST_TMUX -Ltest"
+$TMUX kill-server 2>/dev/null
+
+TMP=$(mktemp)
+trap "rm -f $TMP" 0 1 15
+
+$TMUX -f/dev/null new -d -x10 -y10 \
+ "cat cursor-test.txt; printf '\e[8;10H'; cat" || exit 1
+$TMUX set -g window-size manual || exit 1
+
+$TMUX display -pF '#{cursor_x} #{cursor_y} #{cursor_character}' >>$TMP
+$TMUX capturep -p|awk '{print NR-1,$0}' >>$TMP
+$TMUX resizew -x5 || exit 1
+$TMUX display -pF '#{cursor_x} #{cursor_y} #{cursor_character}' >>$TMP
+$TMUX capturep -p|awk '{print NR-1,$0}' >>$TMP
+$TMUX resizew -x50 || exit 1
+$TMUX display -pF '#{cursor_x} #{cursor_y} #{cursor_character}' >>$TMP
+$TMUX capturep -p|awk '{print NR-1,$0}' >>$TMP
+
+cmp -s $TMP cursor-test2.result || exit 1
+
+$TMUX kill-server 2>/dev/null
+exit 0
diff --git a/regress/cursor-test3.result b/regress/cursor-test3.result
new file mode 100644
index 00000000..e72b1a9b
--- /dev/null
+++ b/regress/cursor-test3.result
@@ -0,0 +1,9 @@
+6 1 b
+0 abcdefa
+1 bcdefab
+3 1 b
+0 fabcd
+1 efab
+6 1 b
+0 abcdefa
+1 bcdefab
diff --git a/regress/cursor-test3.sh b/regress/cursor-test3.sh
new file mode 100644
index 00000000..8bb4bd6f
--- /dev/null
+++ b/regress/cursor-test3.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+PATH=/bin:/usr/bin
+TERM=screen
+
+[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux)
+TMUX="$TEST_TMUX -Ltest"
+$TMUX kill-server 2>/dev/null
+
+TMP=$(mktemp)
+trap "rm -f $TMP" 0 1 15
+
+$TMUX -f/dev/null new -d -x7 -y2 \
+ "printf 'abcdefabcdefab'; printf '\e[2;7H'; cat" || exit 1
+$TMUX set -g window-size manual || exit 1
+
+$TMUX display -pF '#{cursor_x} #{cursor_y} #{cursor_character}' >>$TMP
+$TMUX capturep -p|awk '{print NR-1,$0}' >>$TMP
+$TMUX resizew -x5 || exit 1
+$TMUX display -pF '#{cursor_x} #{cursor_y} #{cursor_character}' >>$TMP
+$TMUX capturep -p|awk '{print NR-1,$0}' >>$TMP
+$TMUX resizew -x7 || exit 1
+$TMUX display -pF '#{cursor_x} #{cursor_y} #{cursor_character}' >>$TMP
+$TMUX capturep -p|awk '{print NR-1,$0}' >>$TMP
+
+cmp -s $TMP cursor-test3.result || exit 1
+
+$TMUX kill-server 2>/dev/null
+exit 0
diff --git a/regress/cursor-test4.result b/regress/cursor-test4.result
new file mode 100644
index 00000000..db26e4fa
--- /dev/null
+++ b/regress/cursor-test4.result
@@ -0,0 +1,16 @@
+0 1
+0 abcdef
+1
+2
+0 1
+0 abcdef
+1
+2
+0 1
+0 def
+1
+2
+0 1
+0 abcdef
+1
+2
diff --git a/regress/cursor-test4.sh b/regress/cursor-test4.sh
new file mode 100644
index 00000000..2bf1bb0e
--- /dev/null
+++ b/regress/cursor-test4.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+PATH=/bin:/usr/bin
+TERM=screen
+
+[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux)
+TMUX="$TEST_TMUX -Ltest"
+$TMUX kill-server 2>/dev/null
+
+TMP=$(mktemp)
+trap "rm -f $TMP" 0 1 15
+
+$TMUX -f/dev/null new -d -x10 -y3 "printf 'abcdef\n'; cat" || exit 1
+$TMUX set -g window-size manual || exit 1
+
+$TMUX display -pF '#{cursor_x} #{cursor_y} #{cursor_character}' >>$TMP
+$TMUX capturep -p|awk '{print NR-1,$0}' >>$TMP
+$TMUX resizew -x20 || exit 1
+$TMUX display -pF '#{cursor_x} #{cursor_y} #{cursor_character}' >>$TMP
+$TMUX capturep -p|awk '{print NR-1,$0}' >>$TMP
+$TMUX resizew -x3 || exit 1
+$TMUX display -pF '#{cursor_x} #{cursor_y} #{cursor_character}' >>$TMP
+$TMUX capturep -p|awk '{print NR-1,$0}' >>$TMP
+$TMUX resizew -x10 || exit 1
+$TMUX display -pF '#{cursor_x} #{cursor_y} #{cursor_character}' >>$TMP
+$TMUX capturep -p|awk '{print NR-1,$0}' >>$TMP
+
+cmp -s $TMP cursor-test4.result || exit 1
+
+$TMUX kill-server 2>/dev/null
+exit 0
diff --git a/regress/format-strings.sh b/regress/format-strings.sh
new file mode 100644
index 00000000..726b46bc
--- /dev/null
+++ b/regress/format-strings.sh
@@ -0,0 +1,183 @@
+#!/bin/sh
+
+# Tests of formats as described in tmux(1) FORMATS
+
+PATH=/bin:/usr/bin
+TERM=screen
+
+[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux)
+TMUX="$TEST_TMUX -Ltest"
+
+# test_format $format $expected_result
+test_format()
+{
+ fmt="$1"
+ exp="$2"
+
+ out=$($TMUX display-message -p "$fmt")
+
+ if [ "$out" != "$exp" ]; then
+ echo "Format test failed for '$fmt'."
+ echo "Expected: '$exp'"
+ echo "But got '$out'"
+ exit 1
+ fi
+}
+
+# test_conditional_with_pane_in_mode $format $exp1 $exp2
+#
+# Tests the format string $format to yield $exp1 if #{pane_in_mode} is true and
+# $exp2 when #{pane_in_mode} is false.
+test_conditional_with_pane_in_mode()
+{
+ fmt="$1"
+ exp_true="$2"
+ exp_false="$3"
+
+ $TMUX copy-mode # enter copy mode
+ test_format "$fmt" "$exp_true"
+ $TMUX send-keys -X cancel # leave copy mode
+ test_format "$fmt" "$exp_false"
+}
+
+# test_conditional_with_session_name #format $exp_summer $exp_winter
+#
+# Tests the format string $format to yield $exp_summer if the session name is
+# 'Summer' and $exp_winter if the session name is 'Winter'.
+test_conditional_with_session_name()
+{
+ fmt="$1"
+ exp_summer="$2"
+ exp_winter="$3"
+
+ $TMUX rename-session "Summer"
+ test_format "$fmt" "$exp_summer"
+ $TMUX rename-session "Winter"
+ test_format "$fmt" "$exp_winter"
+ $TMUX rename-session "Summer" # restore default
+}
+
+
+$TMUX kill-server 2>/dev/null
+$TMUX -f/dev/null new-session -d || exit 1
+$TMUX rename-session "Summer" || exit 1 # used later in conditionals
+
+# Plain string without substitutions et al
+test_format "abc xyz" "abc xyz"
+
+# Test basic escapes for "#", "{", "#{" "}", "#}", ","
+test_format "##" "#"
+test_format "#," ","
+test_format "{" "{"
+test_format "##{" "#{"
+test_format "#}" "}"
+test_format "###}" "#}" # not a "basic" one but interesting nevertheless
+
+# Simple expansion
+test_format "#{pane_in_mode}" "0"
+
+# Simple conditionals
+test_conditional_with_pane_in_mode "#{?pane_in_mode,abc,xyz}" "abc" "xyz"
+
+# Expansion in conditionals
+test_conditional_with_pane_in_mode "#{?pane_in_mode,#{session_name},xyz}" "Summer" "xyz"
+
+# Basic escapes in conditionals
+# First argument
+test_conditional_with_pane_in_mode "#{?pane_in_mode,##,xyz}" "#" "xyz"
+test_conditional_with_pane_in_mode "#{?pane_in_mode,#,,xyz}" "," "xyz"
+test_conditional_with_pane_in_mode "#{?pane_in_mode,{,xyz}" "{" "xyz"
+test_conditional_with_pane_in_mode "#{?pane_in_mode,##{,xyz}" "#{" "xyz"
+test_conditional_with_pane_in_mode "#{?pane_in_mode,#},xyz}" "}" "xyz"
+# not a "basic" one but interesting nevertheless
+test_conditional_with_pane_in_mode "#{?pane_in_mode,###},xyz}" "#}" "xyz"
+# Second argument
+test_conditional_with_pane_in_mode "#{?pane_in_mode,abc,##}" "abc" "#"
+test_conditional_with_pane_in_mode "#{?pane_in_mode,abc,#,}" "abc" ","
+test_conditional_with_pane_in_mode "#{?pane_in_mode,abc,{}" "abc" "{"
+test_conditional_with_pane_in_mode "#{?pane_in_mode,abc,##{}" "abc" "#{"
+test_conditional_with_pane_in_mode "#{?pane_in_mode,abc,#}}" "abc" "}"
+# not a "basic" one but interesting nevertheless
+test_conditional_with_pane_in_mode "#{?pane_in_mode,abc,###}}" "abc" "#}"
+# mixed
+test_conditional_with_pane_in_mode "#{?pane_in_mode,{,#}}" "{" "}"
+test_conditional_with_pane_in_mode "#{?pane_in_mode,#},{}" "}" "{"
+test_conditional_with_pane_in_mode "#{?pane_in_mode,##{,###}}" "#{" "#}"
+test_conditional_with_pane_in_mode "#{?pane_in_mode,###},##{}" "#}" "#{"
+
+# Conditionals split on the second comma (this is not documented)
+test_conditional_with_pane_in_mode "#{?pane_in_mode,abc,xyz,bonus}" "abc" "xyz,bonus"
+
+# Curly brackets {...} do not capture a comma inside of conditionals as the
+# conditional ends on the first '}'
+test_conditional_with_pane_in_mode "#{?pane_in_mode,{abc,xyz},bonus}" "{abc,bonus}" "xyz,bonus}"
+
+# Substitutions '#{...}' capture the comma
+# invalid format: #{abc,xyz} is not a known variable name.
+#test_conditional_with_pane_in_mode "#{?pane_in_mode,#{abc,xyz},bonus}" "" "bonus"
+
+# Parenthesis (...) do not captura a comma
+test_conditional_with_pane_in_mode "#{?pane_in_mode,(abc,xyz),bonus}" "(abc" "xyz),bonus"
+test_conditional_with_pane_in_mode "#{?pane_in_mode,(abc#,xyz),bonus}" "(abc,xyz)" "bonus"
+
+# Brackets [...] do not captura a comma
+test_conditional_with_pane_in_mode "#{?pane_in_mode,[abc,xyz],bonus}" "[abc" "xyz],bonus"
+test_conditional_with_pane_in_mode "#{?pane_in_mode,[abc#,xyz],bonus}" "[abc,xyz]" "bonus"
+
+
+# Escape comma inside of #(...)
+# Note: #() commands are run asynchronous and are substituted with result of the
+# *previous* run or a placeholder (like "<'echo ,' not ready") if the command
+# has not been run before. The format is updated as soon as the command
+# finishes. As we are printing the message only once it never gets updated
+# and the displayed message is "<'echo ,' not ready>"
+test_format "#{?pane_in_mode,#(echo #,),xyz}" "xyz"
+test_conditional_with_pane_in_mode "#{?pane_in_mode,#(echo #,),xyz}" "<'echo ,' not ready>" "xyz"
+# This caching does not work :-(
+#$TMUX display-message -p "#(echo #,)" > /dev/null
+#test_conditional_with_pane_in_mode "#{?pane_in_mode,#(echo #,),xyz}" "," "xyz"
+#test_conditional_with_pane_in_mode "#{?pane_in_mode,#(echo #,),xyz}" "," "xyz"
+
+# invalid format: '#(' is not closed in the first argument of #{?,,}.
+#test_conditional_with_pane_in_mode "#{?pane_in_mode,#(echo ,),xyz}" "" "),xyz"
+
+# Escape comma inside of #[...]
+test_conditional_with_pane_in_mode "#{?pane_in_mode,#[fg=default#,bg=default]abc,xyz}" "#[fg=default,bg=default]abc" "xyz"
+# invalid format: '#[' is not closed in the first argument of #{?,,}
+#test_conditional_with_pane_in_mode "#{?pane_in_mode,#[fg=default,bg=default]abc,xyz}" "" "bg=default]abc,xyz"
+
+# Conditionals with comparison
+test_conditional_with_session_name "#{?#{==:#{session_name},Summer},abc,xyz}" "abc" "xyz"
+# Conditionals with comparison and escaped commas
+$TMUX rename-session ","
+test_format "#{?#{==:#,,#{session_name}},abc,xyz}" "abc"
+$TMUX rename-session "Summer" # reset to default
+
+# Conditional in conditional
+test_conditional_with_pane_in_mode "#{?pane_in_mode,#{?#{==:#{session_name},Summer},ABC,XYZ},xyz}" "ABC" "xyz"
+test_conditional_with_session_name "#{?pane_in_mode,#{?#{==:#{session_name},Summer},ABC,XYZ},xyz}" "xyz" "xyz"
+
+test_conditional_with_pane_in_mode "#{?pane_in_mode,abc,#{?#{==:#{session_name},Summer},ABC,XYZ}}" "abc" "ABC"
+test_conditional_with_session_name "#{?pane_in_mode,abc,#{?#{==:#{session_name},Summer},ABC,XYZ}}" "ABC" "XYZ"
+
+# Some fancy stackings
+test_conditional_with_pane_in_mode "#{?#{==:#{?pane_in_mode,#{session_name},#(echo Spring)},Summer},abc,xyz}" "abc" "xyz"
+
+
+
+# Format test for the literal option
+# Note: The behavior for #{l:...} with escapes is sometimes weird as #{l:...}
+# respects the escapes.
+test_format "#{l:#{}}" "#{}"
+test_format "#{l:#{pane_in_mode}}" "#{pane_in_mode}"
+test_format "#{l:#{?pane_in_mode,#{?#{==:#{session_name},Summer},ABC,XYZ},xyz}}" "#{?pane_in_mode,#{?#{==:#{session_name},Summer},ABC,XYZ},xyz}"
+
+# With escapes (which escape but are returned literally)
+test_format "#{l:##{}" "##{"
+test_format "#{l:#{#}}}" "#{#}}"
+
+# Invalid formats:
+#test_format "#{l:#{}" ""
+#test_format "#{l:#{#}}" ""
+
+exit 0
diff --git a/regress/has-session-return.sh b/regress/has-session-return.sh
new file mode 100644
index 00000000..5cc30f05
--- /dev/null
+++ b/regress/has-session-return.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+# 971
+# has-session should return 1 on error
+
+PATH=/bin:/usr/bin
+TERM=screen
+
+[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux)
+TMUX="$TEST_TMUX -Ltest"
+$TMUX kill-server 2>/dev/null
+
+$TMUX -f/dev/null has -tfoo </dev/null 2>/dev/null && exit 1
+$TMUX -f/dev/null start\; has -tfoo </dev/null 2>/dev/null && exit 1
+$TMUX -f/dev/null new -d\; has -tfoo </dev/null 2>/dev/null && exit 1
+$TMUX -f/dev/null new -dsfoo\; has -tfoo </dev/null 2>/dev/null || exit 1
+$TMUX kill-server 2>/dev/null
+
+exit 0
diff --git a/regress/if-shell-TERM.sh b/regress/if-shell-TERM.sh
new file mode 100644
index 00000000..5967a58f
--- /dev/null
+++ b/regress/if-shell-TERM.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+# 882
+# TERM should come from outside tmux for if-shell from the config file
+
+PATH=/bin:/usr/bin
+TERM=screen
+
+[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux)
+TMUX="$TEST_TMUX -Ltest"
+$TMUX kill-server 2>/dev/null
+
+TMP=$(mktemp)
+trap "rm -f $TMP" 0 1 15
+
+cat <<EOF >$TMP
+if '[ "\$TERM" = "xterm" ]' \
+ 'set -g default-terminal "vt220"' \
+ 'set -g default-terminal "ansi"'
+EOF
+
+TERM=xterm $TMUX -f$TMP new -d "echo \"#\$TERM\" >>$TMP" || exit 1
+sleep 1 && [ "$(tail -1 $TMP)" = "#vt220" ] || exit 1
+
+TERM=screen $TMUX -f$TMP new -d "echo \"#\$TERM\" >>$TMP" || exit 1
+sleep 1 && [ "$(tail -1 $TMP)" = "#ansi" ] || exit 1
+
+$TMUX has 2>/dev/null && exit 1
+
+exit 0
diff --git a/regress/if-shell-error.sh b/regress/if-shell-error.sh
new file mode 100644
index 00000000..24dc578e
--- /dev/null
+++ b/regress/if-shell-error.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+# 883
+# if-shell with an error should not core :-)
+
+PATH=/bin:/usr/bin
+TERM=screen
+
+[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux)
+TMUX="$TEST_TMUX -Ltest"
+$TMUX kill-server 2>/dev/null
+
+TMP=$(mktemp)
+trap "rm -f $TMP" 0 1 15
+
+cat <<EOF >$TMP
+if 'true' 'wibble wobble'
+EOF
+
+$TMUX -f$TMP new -d || exit 1
+sleep 1
+E=$($TMUX display -p '#{pane_in_mode}')
+$TMUX kill-server 2>/dev/null
+[ "$E" = "1" ] || exit 1
+
+exit 0
diff --git a/regress/if-shell-nested.sh b/regress/if-shell-nested.sh
new file mode 100644
index 00000000..976c6738
--- /dev/null
+++ b/regress/if-shell-nested.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+# 882
+# tmux inside if-shell itself should work
+
+PATH=/bin:/usr/bin
+TERM=screen
+
+[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux)
+TMUX="$TEST_TMUX -Ltest"
+$TMUX kill-server 2>/dev/null
+
+TMP=$(mktemp)
+trap "rm -f $TMP" 0 1 15
+
+cat <<EOF >$TMP
+if '$TMUX run "true"' 'set -s @done yes'
+EOF
+
+TERM=xterm $TMUX -f$TMP new -d "$TMUX show -vs @done >>$TMP" || exit 1
+sleep 1 && [ "$(tail -1 $TMP)" = "yes" ] || exit 1
+
+$TMUX has 2>/dev/null && exit 1
+
+exit 0
diff --git a/regress/kill-session-process-exit.sh b/regress/kill-session-process-exit.sh
new file mode 100644
index 00000000..69ee27a2
--- /dev/null
+++ b/regress/kill-session-process-exit.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+# when we kill a session, processes running in it should be killed
+
+PATH=/bin:/usr/bin
+TERM=screen
+
+[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux)
+TMUX="$TEST_TMUX -Ltest"
+$TMUX kill-server 2>/dev/null
+
+$TMUX -f/dev/null new -d 'sleep 1000' || exit 1
+P=$($TMUX display -pt0:0.0 '#{pane_pid}')
+$TMUX -f/dev/null new -d || exit 1
+sleep 1
+$TMUX kill-session -t0:
+sleep 1
+kill -0 $P 2>/dev/null && exit 1
+$TMUX kill-server 2>/dev/null
+
+exit 0
diff --git a/regress/new-session-base-index.sh b/regress/new-session-base-index.sh
new file mode 100644
index 00000000..337037c3
--- /dev/null
+++ b/regress/new-session-base-index.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+# new session base-index
+
+PATH=/bin:/usr/bin
+TERM=screen
+
+[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux)
+TMUX="$TEST_TMUX -Ltest"
+$TMUX kill-server 2>/dev/null
+
+TMP=$(mktemp)
+trap "rm -f $TMP" 0 1 15
+
+cat <<EOF >$TMP
+set -g base-index 100
+new
+set base-index 200
+neww
+EOF
+
+$TMUX -f$TMP start
+echo $($TMUX lsw -F'#{window_index}') >$TMP
+(echo "100 200"|cmp -s - $TMP) || exit 1
+$TMUX kill-server 2>/dev/null
+
+exit 0
diff --git a/regress/new-session-command.sh b/regress/new-session-command.sh
new file mode 100644
index 00000000..02ba55d9
--- /dev/null
+++ b/regress/new-session-command.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+# new session command
+
+PATH=/bin:/usr/bin
+TERM=screen
+
+[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux)
+TMUX="$TEST_TMUX -Ltest"
+$TMUX kill-server 2>/dev/null
+
+TMP=$(mktemp)
+trap "rm -f $TMP" 0 1 15
+
+cat <<EOF >$TMP
+new sleep 101
+new -- sleep 102
+new "sleep 103"
+EOF
+
+$TMUX -f$TMP start
+[ $($TMUX ls|wc -l) -eq 3 ] || exit 1
+$TMUX kill-server 2>/dev/null
+
+exit 0
diff --git a/regress/new-session-environment.sh b/regress/new-session-environment.sh
new file mode 100644
index 00000000..d53f204e
--- /dev/null
+++ b/regress/new-session-environment.sh
@@ -0,0 +1,66 @@
+#!/bin/sh
+
+# new session environment
+
+PATH=/bin:/usr/bin
+TERM=screen
+
+[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux)
+TMUX="$TEST_TMUX -Ltest"
+$TMUX kill-server 2>/dev/null
+
+TMP=$(mktemp)
+OUT=$(mktemp)
+SCRIPT=$(mktemp)
+trap "rm -f $TMP $OUT $SCRIPT" 0 1 15
+
+cat <<EOF >$SCRIPT
+(
+echo TERM=\$TERM
+echo PWD=\$(pwd)
+echo PATH=\$PATH
+echo SHELL=\$SHELL
+echo TEST=\$TEST
+) >$OUT
+EOF
+
+cat <<EOF >$TMP
+new -- /bin/sh $SCRIPT
+EOF
+
+(cd /; env -i TERM=ansi TEST=test1 PATH=1 SHELL=/bin/sh \
+ $TMUX -f$TMP start) || exit 1
+sleep 1
+(cat <<EOF|cmp -s - $OUT) || exit 1
+TERM=screen
+PWD=/
+PATH=1
+SHELL=/bin/sh
+TEST=test1
+EOF
+
+(cd /; env -i TERM=ansi TEST=test2 PATH=2 SHELL=/bin/sh \
+ $TMUX -f$TMP new -d -- /bin/sh $SCRIPT) || exit 1
+sleep 1
+(cat <<EOF|cmp -s - $OUT) || exit 1
+TERM=screen
+PWD=/
+PATH=2
+SHELL=/bin/sh
+TEST=test2
+EOF
+
+(cd /; env -i TERM=ansi TEST=test3 PATH=3 SHELL=/bin/sh \
+ $TMUX -f/dev/null new -d source $TMP) || exit 1
+sleep 1
+(cat <<EOF|cmp -s - $OUT) || exit 1
+TERM=screen
+PWD=/
+PATH=2
+SHELL=/bin/sh
+TEST=test2
+EOF
+
+$TMUX kill-server 2>/dev/null
+
+exit 0
diff --git a/regress/new-session-no-client.sh b/regress/new-session-no-client.sh
new file mode 100644
index 00000000..88c064cd
--- /dev/null
+++ b/regress/new-session-no-client.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+# 869
+# new with no client (that is, from the config file) should imply -d and
+# not attach
+
+PATH=/bin:/usr/bin
+TERM=screen
+
+[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux)
+TMUX="$TEST_TMUX -Ltest"
+$TMUX kill-server 2>/dev/null
+
+TMP=$(mktemp)
+trap "rm -f $TMP" 0 1 15
+
+cat <<EOF >$TMP
+new -stest
+EOF
+
+$TMUX -f$TMP start || exit 1
+sleep 1 && $TMUX has -t=test: || exit 1
+$TMUX kill-server 2>/dev/null
+
+exit 0
diff --git a/regress/new-session-size.sh b/regress/new-session-size.sh
new file mode 100644
index 00000000..89fc580d
--- /dev/null
+++ b/regress/new-session-size.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+# new-session without clients should be the right size
+
+PATH=/bin:/usr/bin
+TERM=screen
+
+[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux)
+TMUX="$TEST_TMUX -Ltest"
+$TMUX kill-server 2>/dev/null
+
+TMP=$(mktemp)
+trap "rm -f $TMP" 0 1 15
+
+$TMUX -f/dev/null new -d </dev/null || exit 1
+sleep 1
+$TMUX ls -F "#{window_width} #{window_height}" >$TMP
+printf "80 24\n"|cmp -s $TMP - || exit 1
+$TMUX kill-server 2>/dev/null
+
+$TMUX -f/dev/null new -d -x 100 -y 50 </dev/null || exit 1
+sleep 1
+$TMUX ls -F "#{window_width} #{window_height}" >$TMP
+printf "100 50\n"|cmp -s $TMP - || exit 1
+$TMUX kill-server 2>/dev/null
+
+exit 0
diff --git a/regress/new-window-command.sh b/regress/new-window-command.sh
new file mode 100644
index 00000000..176bffb5
--- /dev/null
+++ b/regress/new-window-command.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+# new session command
+
+PATH=/bin:/usr/bin
+TERM=screen
+
+[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux)
+TMUX="$TEST_TMUX -Ltest"
+$TMUX kill-server 2>/dev/null
+
+TMP=$(mktemp)
+trap "rm -f $TMP" 0 1 15
+
+cat <<EOF >$TMP
+new
+neww sleep 101
+neww -- sleep 102
+neww "sleep 103"
+EOF
+
+$TMUX -f$TMP start
+[ $($TMUX lsw|wc -l) -eq 4 ] || exit 1
+$TMUX kill-server 2>/dev/null
+
+exit 0