Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Imported Upstream version 1.1

  • Loading branch information...
commit 8fade26b3798d6ea6d06cd4a1ebfeb271e8c8893 0 parents
Karl Ferdinand Ebert authored
Showing with 37,708 additions and 0 deletions.
  1. +1,418 −0 CHANGES
  2. +204 −0 FAQ
  3. +86 −0 GNUmakefile
  4. +83 −0 Makefile
  5. +91 −0 NOTES
  6. +97 −0 TODO
  7. +119 −0 array.h
  8. +93 −0 attributes.c
  9. +55 −0 buffer-poll.c
  10. +139 −0 buffer.c
  11. +127 −0 cfg.c
  12. +325 −0 client.c
  13. +159 −0 clock.c
  14. +106 −0 cmd-attach-session.c
  15. +201 −0 cmd-bind-key.c
  16. +84 −0 cmd-break-pane.c
  17. +152 −0 cmd-choose-client.c
  18. +162 −0 cmd-choose-session.c
  19. +179 −0 cmd-choose-window.c
  20. +55 −0 cmd-clear-history.c
  21. +52 −0 cmd-clock-mode.c
  22. +266 −0 cmd-command-prompt.c
  23. +147 −0 cmd-confirm-before.c
  24. +204 −0 cmd-copy-buffer.c
  25. +70 −0 cmd-copy-mode.c
  26. +59 −0 cmd-delete-buffer.c
  27. +52 −0 cmd-detach-client.c
  28. +63 −0 cmd-display-message.c
  29. +52 −0 cmd-display-panes.c
  30. +59 −0 cmd-down-pane.c
  31. +162 −0 cmd-find-window.c
  32. +418 −0 cmd-generic.c
  33. +49 −0 cmd-has-session.c
  34. +117 −0 cmd-if-shell.c
  35. +76 −0 cmd-kill-pane.c
  36. +49 −0 cmd-kill-server.c
  37. +66 −0 cmd-kill-session.c
  38. +53 −0 cmd-kill-window.c
  39. +58 −0 cmd-last-window.c
  40. +66 −0 cmd-link-window.c
  41. +78 −0 cmd-list-buffers.c
  42. +65 −0 cmd-list-clients.c
  43. +49 −0 cmd-list-commands.c
  44. +125 −0 cmd-list-keys.c
  45. +74 −0 cmd-list-panes.c
  46. +74 −0 cmd-list-sessions.c
  47. +58 −0 cmd-list-windows.c
  48. +119 −0 cmd-list.c
  49. +101 −0 cmd-load-buffer.c
  50. +53 −0 cmd-lock-client.c
  51. +51 −0 cmd-lock-server.c
  52. +53 −0 cmd-lock-session.c
  53. +67 −0 cmd-move-window.c
  54. +316 −0 cmd-new-session.c
  55. +206 −0 cmd-new-window.c
  56. +54 −0 cmd-next-layout.c
  57. +76 −0 cmd-next-window.c
  58. +100 −0 cmd-paste-buffer.c
  59. +125 −0 cmd-pipe-pane.c
  60. +54 −0 cmd-previous-layout.c
  61. +76 −0 cmd-previous-window.c
  62. +52 −0 cmd-refresh-client.c
  63. +57 −0 cmd-rename-session.c
  64. +59 −0 cmd-rename-window.c
  65. +113 −0 cmd-resize-pane.c
  66. +94 −0 cmd-respawn-window.c
  67. +124 −0 cmd-rotate-window.c
  68. +137 −0 cmd-run-shell.c
  69. +88 −0 cmd-save-buffer.c
  70. +88 −0 cmd-select-layout.c
  71. +58 −0 cmd-select-pane.c
  72. +91 −0 cmd-select-prompt.c
  73. +69 −0 cmd-select-window.c
  74. +152 −0 cmd-send-keys.c
  75. +55 −0 cmd-send-prefix.c
  76. +189 −0 cmd-server-info.c
  77. +68 −0 cmd-set-buffer.c
  78. +88 −0 cmd-set-environment.c
  79. +223 −0 cmd-set-option.c
  80. +170 −0 cmd-set-window-option.c
  81. +101 −0 cmd-show-buffer.c
  82. +67 −0 cmd-show-environment.c
  83. +69 −0 cmd-show-options.c
  84. +69 −0 cmd-show-window-options.c
  85. +124 −0 cmd-source-file.c
  86. +256 −0 cmd-split-window.c
  87. +44 −0 cmd-start-server.c
  88. +358 −0 cmd-string.c
  89. +62 −0 cmd-suspend-client.c
  90. +143 −0 cmd-swap-pane.c
  91. +85 −0 cmd-swap-window.c
  92. +136 −0 cmd-switch-client.c
  93. +142 −0 cmd-unbind-key.c
  94. +71 −0 cmd-unlink-window.c
  95. +59 −0 cmd-up-pane.c
  96. +972 −0 cmd.c
  97. +162 −0 colour.c
  98. +209 −0 compat.h
  99. +89 −0 compat/asprintf.c
  100. +129 −0 compat/bitstring.h
  101. +124 −0 compat/bsd-poll.c
  102. +59 −0 compat/bsd-poll.h
  103. +69 −0 compat/daemon.c
  104. +88 −0 compat/fgetln.c
  105. +95 −0 compat/forkpty-aix.c
  106. +89 −0 compat/forkpty-sunos.c
  107. +117 −0 compat/getopt.c
  108. +303 −0 compat/imsg-buffer.c
  109. +271 −0 compat/imsg.c
  110. +110 −0 compat/imsg.h
  111. +528 −0 compat/queue.h
  112. +61 −0 compat/strcasestr.c
  113. +58 −0 compat/strlcat.c
  114. +54 −0 compat/strlcpy.c
  115. +72 −0 compat/strsep.c
  116. +68 −0 compat/strtonum.c
  117. +739 −0 compat/tree.h
  118. +281 −0 compat/unvis.c
  119. +220 −0 compat/vis.c
  120. +83 −0 compat/vis.h
  121. +271 −0 configure
  122. +145 −0 environ.c
  123. +42 −0 examples/h-boetes.conf
  124. +101 −0 examples/n-marriott.conf
  125. +104 −0 examples/screen-keys.conf
  126. +104 −0 examples/t-williams.conf
  127. +96 −0 examples/tmux.vim
  128. +234 −0 grid-view.c
  129. +588 −0 grid.c
  130. +231 −0 input-keys.c
  131. +1,497 −0 input.c
  132. +196 −0 job.c
  133. +267 −0 key-bindings.c
  134. +205 −0 key-string.c
  135. +445 −0 layout-set.c
  136. +649 −0 layout.c
  137. +213 −0 log.c
  138. +416 −0 mode-key.c
  139. +127 −0 names.c
  140. +263 −0 options-cmd.c
  141. +201 −0 options.c
  142. +47 −0 osdep-darwin.c
  143. +129 −0 osdep-freebsd.c
  144. +59 −0 osdep-linux.c
  145. +122 −0 osdep-netbsd.c
  146. +140 −0 osdep-openbsd.c
  147. +65 −0 osdep-sunos.c
  148. +27 −0 osdep-unknown.c
  149. +136 −0 paste.c
  150. +153 −0 resize.c
  151. +288 −0 screen-redraw.c
  152. +1,180 −0 screen-write.c
  153. +274 −0 screen.c
  154. +768 −0 server-client.c
  155. +373 −0 server-fn.c
  156. +73 −0 server-job.c
  157. +341 −0 server-window.c
  158. +640 −0 server.c
  159. +594 −0 session.c
  160. +1,068 −0 status.c
  161. +2,219 −0 tmux.1
  162. +681 −0 tmux.c
  163. +1,961 −0 tmux.h
  164. +418 −0 tty-keys.c
  165. +501 −0 tty-term.c
  166. +1,359 −0 tty.c
  167. +340 −0 utf8.c
  168. +375 −0 window-choose.c
  169. +124 −0 window-clock.c
Sorry, we could not display the entire diff because it was too big.
1,418 CHANGES
@@ -0,0 +1,1418 @@
+CHANGES FROM 1.0 TO 1.1, 05 November 2009
+
+* New run-shell (alias run) command to run an external command without a
+ window, capture it's stdout, and send it to output mode.
+* Ability to define multiple prefix keys.
+* Internal locking mechanism removed. Instead, detach each client and run the
+ external command specified in the new session option lock-command (by default
+ lock -np), thus allowing the system password to be used.
+* set-password command, and -U command line flag removed per the above change.
+* Add support for -c command line flag to execute a shell command.
+* New lock-client (alias lockc), and lock-session (alias locks) commands to
+ lock a particular client, or all clients attached to a session.
+* Support C-n/C-p/C-v/M-v with emacs keys in choice mode.
+* Use : for goto line rather than g in vi mode.
+* Try to guess which client to use when no target client was specified. Finds
+ the current session, and if only one client is present, use it. Otherwise,
+ return the most recently used client.
+* Make C-Down/C-Up in copy mode scroll the screen down/up one line without
+ moving the cursor.
+* Scroll mode superseded by copy mode.
+* New synchronize-panes window option to send all input to all other panes in
+ the same window.
+* New lock-server session option to lock, when off (on by default), each
+ session when it has been idle for the lock-after-time setting. When on, the
+ entire server locks when all sessions have been idle for their individual
+ lock-after-time setting.
+* Add support for grouped sessions which have independent name, options,
+ current window, but where the linked windows are synchronized (ie creating,
+ killing windows are mirrored between the sessions). A grouped session may be
+ created by passing -t to new-session.
+* New mouse-select-pane session option to select the current pane with the
+ mouse.
+* Queue, and run commands in the background for if-shell, status-left,
+ status-right, and #() by starting each once every status-interval. Adds the
+ capability to call some programs which would previously cause the server to
+ hang (eg sleep/tmux). It also avoids running commands excessively (ie if used
+ multiple times, it will be run only once).
+* When a window is zombified and automatic-rename is on, append [dead] to the
+ name.
+* Split list-panes (alias lsp) off from list-windows.
+* New pipe-pane (alias pipep) to redirect a pane output to an external command.
+* Support for automatic-renames for Solaris.
+* Permit attributes to be turned off in #[] by prefixing with no (eg nobright).
+* Add H/M/L in vi mode, and M-R/M-r in emacs to move the cursor to the top,
+ middle, and bottom of the screen.
+* -a option added to kill-pane to kill all except current pane.
+* The -d command line flag is now gone (can be replaced by terminal-overrides).
+ Just use op/AX to detect default colours.
+* input/tty/utf8 improvements.
+* xterm-keys rewrite.
+* Additional code reduction, and bug fixes.
+
+CHANGES FROM 0.9 TO 1.0, 20 Sept 2009
+
+* Option to alter the format of the window title set by tmux.
+* Backoff for a while after multiple incorrect password attempts.
+* Quick display of pane numbers (C-b q).
+* Better choose-window, choose-session commands and a new choose-client command.
+* Option to request multiple responses when using command-prompt.
+* Improved environment handling.
+* Combine wrapped lines when pasting.
+* Option to override terminal settings (terminal-overrides).
+* Use the full range of ACS characters for drawing pane separator lines.
+* Customisable mode keys.
+* Status line colour options, with embedded colours in status-left/right, and
+ an option to centre the window list.
+* Much improved layouts, including both horizontal and vertical splitting.
+* Optional visual bell, activity and content indications.
+* Set the utf8 and status-utf8 options when the server is started with -u.
+* display-message command to show a message in the status line, by default some
+ information about the current window.
+* Improved current process detection on NetBSD.
+* unlink-window -k is now the same as kill-window.
+* attach-session now works from inside tmux.
+* A system-wide configuration file, /etc/tmux.conf.
+* A number of new commands in copy mode, including searching.
+* Panes are now specified using the target (-t) notation.
+* -t now accepts fnmatch(3) patterns and looks for prefixes.
+* Translate \r into \n when pasting.
+* Support for binding commands to keys without the prefix key
+* Support for alternate screen (terminfo smcup/rmcup).
+* Maintain data that goes off screen after reducing the window size, so it can
+ be restored when the size is increased again.
+* New if-shell command to test a shell command before running a tmux command.
+* tmux now works as the shell.
+* Man page reorganisation.
+* Many minor additions, much code tidying and several bug fixes.
+
+CHANGES FROM 0.8 TO 0.9, 01 July 2009
+
+* Major changes to build infrastructure: cleanup of makefiles and addition
+ of a configure script.
+* monitor-content window option to monitor a window for a specific fnmatch(3)
+ pattern. The find-window command also now accepts fnmatch(3) patterns.
+* previous-layout and select-layout commands, and a main-horizontal layout.
+* Recreate the server socket on SIGUSR1.
+* clear-history command.
+* Use ACS line drawing characters for pane separator lines.
+* UTF-8 improvements, and code to detect UTF-8 support by looking at
+ environment variables.
+* The resize-pane-up and resize-pane-down commands are now merged together
+ into a new resize-pane command with -U and -D flags.
+* confirm-before command to request a yes/no answer before executing dangerous
+ commands.
+* Status line bug fixes, support for UTF-8 (status-utf8 option), and a key to
+ paste from the paste buffer.
+* Support for some additional escape sequences and terminal features, including
+ better support for insert mode and tab stops.
+* Improved window resizing behaviour, modelled after xterm.
+* Some code reduction and a number of miscellaneous bug fixes.
+
+================================================================================
+
+On 01 June 2009, tmux was imported into the OpenBSD base system. From this date
+onward changes are logged as part of the normal CVS commit message to either
+OpenBSD or SourceForge CVS. This file will be updated to contain a summary of
+major changes with each release, and to mention important configuration or
+command syntax changes during development.
+
+The list of older changes is below.
+
+================================================================================
+
+21 May 2009
+
+* stat(2) files before trying to load them to avoid problems, for example
+ with "source-file /dev/zero".
+
+19 May 2009
+
+* Try to guess if the window is UTF-8 by outputting a three-byte UTF-8 wide
+ character and seeing how much the cursor moves. Currently tries to figure out
+ if this works by some stupid checks on the terminal, these need to be
+ rethought. Also might be better using a width 1 character rather than width 2.
+* If LANG contains "UTF-8", assume the terminal supports UTF-8, on the grounds
+ that anyone who configures it probably wants UTF-8. Not certain if this is
+ a perfect idea but let's see if it causes any problems.
+* New window option: monitor-content. Searches for a string in a window and if
+ it matches, highlight the status line.
+
+18 May 2009
+
+* main-horizontal layout and main-pane-height option to match vertical.
+* New window option main-pane-width to set the width of the large left pane with
+ main-vertical (was left-vertical) layout.
+* Lots of layout cleanup. manual layout is now manual-vertical.
+
+16 May 2009
+
+* select-layout command and a few default key bindings (M-0, M-1, M-2, M-9) to
+ select layouts.
+* Recreate server socket on SIGUSR1, per SF feature request 2792533.
+
+14 May 2009
+
+* Keys in status line (p in vi mode, M-y in emacs) to paste the first line
+ of the upper paste buffer. Suggested by Dan Colish.
+* clear-history command to clear a pane's history.
+* Don't force wrapping with \n when asked, let the cursor code figure it out.
+ Should fix terminals which use this to detect line breaks.
+* Major cleanup and restructuring of build infrastructure. Still separate files
+ for GNU and BSD make, but they are now hugely simplified at the expense of
+ adding a configure script which must be run before make. Now build and
+ install with:
+
+ $ ./configure && make && sudo make install
+
+04 May 2009
+
+* Use ACS line drawing characters for pane separator lines.
+
+30 April 2009
+
+* Support command sequences without a space before the semicolon, for example
+ "neww; neww" now works as well as "neww ; neww". "neww;neww" is still an
+ error.
+* previous-layout command.
+* Display the layout name in window lists.
+* Merge resize-pane-up and resize-pane-down into resize-pane with -U and -D
+ flags.
+
+29 April 2009
+
+* Get rid of compat/vis.* - only one function was used which is easily
+ replaced,and less compat code == good.
+
+27 April 2009
+
+* Avoid using the prompt history when the server is locked, and prevent any
+ input entered from being added to the client's prompt history.
+* New command, confirm-before (alias confirm), which asks for confirmation
+ before executing a command. Bound "&" and "x" by default to confirm-before
+ "kill-window" and confirm-before "kill-pane", respectively.
+
+23 April 2009
+
+* Support NEL, yet another way of making newline. Fixes the output from some
+ Gentoo packaging thing. Reported by someone on SF then logs that allowed a
+ fix sent by tcunha.
+* Use the xenl terminfo flag to detect early-wrap terminals like the FreeBSD
+ console. Many thanks for a very informative email from Christian Weisgerber.
+
+21 April 2009
+
+* tmux 0.8 released.
+
+17 April 2009
+
+* Remove the right number of characters from the buffer when escape then
+ a cursor key (or other key prefixed by \033) is pressed. Reported by
+ Stuart Henderson.
+
+03 April 2009
+
+* rotate-window command. -U flag (default) for up, -D flag for down.
+
+02 April 2009
+
+* Change scroll/pane redraws to only redraw the single pane affected rather
+ than the entire window.
+* If redrawing the region would mean redrawing > half the pane, just schedule
+ to redraw the entire window. Also add a flag to skip updating the window any
+ further if it is scheduled to be redrawn. This has the effect of batching
+ multiple redraws together.
+
+01 April 2009
+
+* Basic horizontal splitting and layout management. Still some redraw and other
+ issues - particularly, don't mix with manual pane resizing, be careful when
+ viewing from multiple clients and don't expect shell windows to redraw very
+ well after the layout is changed; generally cycling the layout a few times
+ will fix most problems. Getting this in for testing while I think about how
+ to deal with manual mode.
+
+ Split window as normal and cycle the layouts with C-b space. Some of the
+ layouts will work better when swap-pane comes along.
+
+31 March 2009
+
+* AIX port, thanks to cmihai for access to a box. Only tested on 6.1 with xlc
+ 10.1 (make sure CC is set). Needs GNU make and probably ncurses (didn't try
+ plain curses). Also won't build with DEBUG, so comment the FDEBUG=1 line in
+ GNUmakefile.
+* Draw a vertical line on the right when the window size is less than the
+ terminal size. This is partly to shake out any horizontal limit bugs on the
+ way to horizontal splitting/pane tiling. Currently a bit slow since it has to
+ do a lot of redrawing but hopefully that will improve as I get some better
+ ideas for how to do it.
+* Fix remaining problems with copy and paste and UTF-8.
+
+28 March 2009
+
+* Better UTF-8 support, including combined characters. Unicode data is now
+ stored as UTF-8 in a separate array, the code does a lookup into this every
+ time it gets to a UTF-8 cell. Zero width characters are just appended onto
+ the UTF-8 data for the previous cell. This also means that almost no bytes
+ extra are wasted non-Unicode data (yay).
+
+ Still some oddities, such as copy mode skips over wide characters in a
+ strange way, and the code could do with some tidying.
+* Key repeating is now a property of the key binding not of the command.
+ Repeat is turned on when the key is bound with the -r flag to bind-key.
+ next/previous-window no longer repeat by default as it turned out to annoy
+ me.
+
+27 March 2009
+
+* Clear using ED when redrawing the screen. I foolishly assumed using spaces
+ would be equivalent and terminals would pick up on this, but apparently not.
+ This fixes copy and paste in xterm/rxvt.
+* Sockets in /tmp are now created in a subdirectory named, tmux-UID, eg
+ tmux-1000. The default socket is thus /tmp/tmux-UID/default. To start a
+ separate server, the new -L command line option should be used: this creates
+ a socket in the same directory with a different name ("-L main" will create
+ socket called "main"). -S should only be used to place the socket outside
+ /tmp. This makes sockets a little more secure and a bit more convenient to
+ use multiple servers.
+
+21 March 2009
+
+* New session flag "set-remain-on-exit" to set remain-on-exit flag for new
+ windows created in that session (like "remain-by-default" used to do). Not
+ perfectly happy about this, but until I can think of a good way to introduce
+ it generically (maybe a set of options in the session) this will do. Fixes
+ SF request 2527847.
+
+07 March 2009
+
+* Support for 88 colour terminals.
+* break-pane command to create a new window using an existing pane.
+
+02 March 2009
+
+* Make escape key timer work properly so escape+key can be used without
+ lightning fast key presses.
+
+13 February 2009
+
+* Redo mode keys slightly more cleanly and apply them to command prompt
+ editing. vi or emacs mode is controlled by the session option status-keys.
+
+12 February 2009
+
+* Looking up argv[0] is expensive, so just use p_comm for the window name which
+ is good enough. Also increase name update time to 500 ms.
+
+11 February 2009
+
+* Only use ri when actually at the top of the screen; just move the cursor up
+ otherwise.
+* FreeBSD's console wraps lines at $COLUMNS - 1 rather than $COLUMNS (the
+ cursor can never be beyond $COLUMNS - 1) and does not appear to support
+ changing this behaviour, or any of the obvious possibilities (turning off
+ right margin wrapping, insert mode). This is irritating, most notably because
+ it impossible to write to the very bottom-right of the screen without
+ scrolling. To work around this, if built on FreeBSD and run with a "cons"
+ $TERM, the bottom-right cell on the screen is omitted.
+* Emulate scroll regions (slowly) to support the few terminals which don't have
+ it (some of which don't really have any excuse).
+
+10 February 2009
+
+* No longer redraw the status line every status-interval unless it has actually
+ changed.
+
+08 February 2009
+
+* Don't treat empty arguments ("") differently when parsing configuration
+ file/command prompt rather than command line.
+* tmux 0.7 released.
+
+03 February 2009
+
+* New command, copy-buffer (alias copyb), to copy a session paste buffer to
+ another session.
+
+01 February 2009
+
+* The character pair #(command) may now contain (escaped) right parenthesis.
+
+30 January 2009
+
+* . now bound to "command-prompt 'move-window %%'" by default, from joshe.
+
+29 January 2009
+
+* Window options to set status line fg, bg and attributes for a single
+ window. Options are: window-status-fg, window-status-bg,
+ window-status-attr. Set to "default" to use the session status colours.
+
+ This allows quite neat things like:
+
+ $ cat ~/bin/xssh
+ #!/bin/sh
+
+ if [ ! -z "$TMUX" ]; then
+ case "$1" in
+ natalya)
+ tmux setw window-status-fg red >/dev/null
+ ;;
+ natasha)
+ tmux setw window-status-fg yellow >/dev/null
+ ;;
+ esac
+ fi
+ ssh "$@"
+ [ ! -z "$TMUX" ] && tmux setw -u window-status-fg >/dev/null
+ $ alias ssh="~/bin/xssh"
+
+* Support #(command) in status-left, and status-right, which is displayed as
+ the first line of command's output (e.g. set -g status-right
+ "#(whoami)@#(hostname -s)"). Commands with )s aren't supported.
+
+28 January 2009
+
+* Support mouse in copy mode to move cursor. Can't do anything else at the
+ moment until other mouse modes are handled.
+* Better support for at least the most common variant of mouse input: parse it
+ and adjust for different panes. Also support mouse in window/session choice
+ mode.
+
+27 January 2009
+
+* Bring back the fancy window titles with session/window names: it is easy to
+ work around problems with elinks (see FAQ).
+* -u flag to scroll-mode and copy-mode to start scrolled one page
+ up. scroll-mode -u is bound to prefix,page-up (ppage) by default.
+* Allow status, mode and message attributes to be changed by three new options:
+ status-attr, mode-attr, message-attr. A comma-separataed list is accepted
+ containing: bright, dim, underscore, blink, reverse, hidden, italics, for
+ example:
+
+ set -g status-attr bright,blink
+
+ From Josh Elsasser, thanks!
+
+26 January 2009
+
+* Be more clever about picking the right process to create the window name.
+* Don't balls up the terminal on UTF-8 combined characters. Don't support them
+ properly either - they are just discarded for the moment.
+
+25 January 2009
+
+* load-buffer command
+
+23 January 2009
+
+* Use reverse colours rather than swapping fg and bg for message, mode and
+ status line. This makes these usable on black and white terminals.
+* Better error messages when creating a session or window fails.
+* Oops. Return non-zero on error. Reported by Will Maier.
+
+21 January 2009
+
+* Handle SIGTERM (and kill-server which uses it), a bit more neatly - tidy
+ up properly and print a nicer message. Same effect though :-).
+* new-window now supports -k to kill target window if it exists.
+* Bring back split-window -p and -l options to specify the height a percentage
+ or as a number of lines.
+* Make window and session choice modes allow you to choose items in vi keys
+ mode (doh!). As a side-effect, this makes enter copy selection (as well
+ as C-w/M-w) when using emacs keys in copy mode. Reported by merdely.
+
+20 January 2009
+
+* Darwin support for automatic-rename from joshe; Darwin doesn't seem to have
+ a sane method of getting argv[0] and searching for the precise insane way
+ is too frustrating, so this just uses the executable name.
+* Try to change the window title to match the command running it in. This is
+ done by reading argv[0] from the process group leader of the group that owns
+ the tty (tcgetpgrp()). This can't be done portably so some OS-dependent code
+ is introduced (ugh); OpenBSD, FreeBSD and Linux are supported at the moment.
+
+ A new window flag, automatic-rename, is available: if this is set to off, the
+ window name is not changed. Specifying a name with the new-window,
+ new-session or rename-window commands will automatically set this flag to off
+ for the window in question. To disable it entirely set the option to off
+ globally (setw -g automatic-rename off).
+
+19 January 2009
+
+* Fix various stupid issues when the status line is turned off. Grr.
+* Use reverse attributes for clock and cursor, otherwise they do not
+ appear on black and white terminals.
+* An error in a command sequence now stops execution of that sequence.
+ Internally, each command code now passes a return code back rather than
+ talking to the calling client (if any) directly.
+* attach-session now tries to start the server if it isn't already started - if
+ no sessions are created in .tmux.conf this will cause an error.
+* Clean up starting server by making initial client get a special socketpair.
+
+18 January 2009
+
+* Unbreak UTF-8.
+* -a flag to next-window and previous-window to select the next or previous
+ window with activity or bell. Bound to M-n and M-p.
+* find-window command to search window names, titles and visible content (but
+ not history) for a string. If only one is found, the window is selected
+ otherwise a choice list is shown. This (as with the other choice commands)
+ only works from a key. Bound to "f" by default.
+* Cleaned up command printing code, also enclose arguments with spaces in "s.
+* Added command sequences. These are entered by separating each argument by a ;
+ argument (spaces on both sides), for example:
+
+ lsk ; lsc
+
+ To use a literal ; as the argument prefix it with \, for example:
+
+ bind x lsk \; lsc
+
+ Commands are executed from left to right. Also note that command sequences do
+ not support repeat-time repetition unless all commands making up the sequence
+ support it.
+* suspend-client command to suspend a client. Don't try to background it
+ though...
+* Mark attached sessions in sessions lists. Suggested by Simon Kuhnle.
+
+17 January 2009
+
+* tmux 0.6 released.
+
+15 January 2009
+
+* Support #H for hostname and #S for session name in status-left/right.
+* Two new commands, choose-window and choose-session which work only when bound
+ to a key and allow the window or session to be selected from a list. These
+ are now bound to "w" and "s" instead of the list commands.
+
+14 January 2009
+
+* Rework the prefix-time stuff. The option is now called repeat-time and
+ defaults to 500 ms. It only applies to a small subset of commands, currently:
+ up-pane, down-pane, next-window, previous-window, resize-pane-up,
+ resize-pane-down. These are the commands for which it is obviously useful,
+ having it for everything else was just bloody annoying.
+* The alt-up and alt-down keys now resize a pane by five lines at a time.
+* switch-pane is now select-pane and requires -p to select a pane. The
+ "o" key binding is changed to down-pane.
+* up-pane and down-pane commands, bound to arrow up and down by default.
+* Multiple vertical window splitting. Minimum pane size is four lines, an
+ (unhelpful) error will be shown if attempting to split a window with less
+ that eight lines. If the window is resized, as many panes are shown as can
+ fit without reducing them below four lines. There is (currently!) not a way
+ to show a hidden pane without making the window larger.
+
+ Note the -p and -l options to split-window are now gone, these may reappear
+ once I think them through again.
+* Server locking on inactivity (lock-after-time) is now disabled by default.
+
+13 January 2009
+
+* kill-pane command.
+
+12 January 2009
+
+* command-prompt now accepts a single argument, a template string. Any
+ occurrences of %% in this string are replaced by whatever is entered at the
+ prompt and the result is executed as a command. This allows things like (now
+ bound by default):
+
+ bind , command-prompt "rename-window %%"
+
+ Or my favourite:
+
+ bind x command-prompt "split-window 'man %%'"
+
+* Option to set prefix time, allowing multiple commands to be entered without
+ pressing the prefix key again, so long as they each typed within this time of
+ each other.
+* Yet more hacks for key handling. Think it is just about working now.
+* Two commands, resize-pane-up and resize-pane-down to resize a pane.
+* Make the window pane code handle panes of different sizes, and add a -l
+ and -p arguments to split-window to specify the new window size in lines
+ or as a percentage.
+
+11 January 2009
+
+* Vertical window splitting. Currently can only split a window into two panes.
+ New split-window command splits (bound to ") and switch-pane command (bound to
+ o) switches between panes.
+
+ close-pane, swap-pane commands are to follow. Also to come are pane resizing,
+ >2 panes, the ability to break a pane out to a full window and vice versa and
+ possibly horizontal splitting.
+
+ Panes are subelements of windows rather than being windows in their own
+ right. I tried to make them windows (so the splitting was at the session or
+ client level) but this rapidly became very complex and invasive. So in the
+ interests of having something working, I just made it so each window can have
+ two child processes instead of one (and it still took me 12 hours straight
+ coding). Now the concept is proven and much of the support code is there,
+ this may change in future if more flexibility is needed.
+* save-buffer command, from Tiago Cunha.
+
+10 January 2009
+
+* New option, lock-after-time. If there is no activity in the period specified
+ by this option (in seconds), tmux will lock the server. Default is 1800 (30
+ minutes), set to 0 to disable.
+* Server locking. Two new commands: set-password to set a password (a
+ preencrypted password may be specified with -c); and lock-server to lock the
+ server until the password is entered. Also an additional command line flag,
+ -U, to unlock from the shell. The default password is blank (any password
+ accepted). If specifying an encrypted password from encrypt(1) in .tmux.conf
+ with -c, don't forget to enclose it in single-quotes (') to prevent shell
+ variable expansion.
+* If a window is created from the command line, tmux will now use the same
+ current working directory for the new process. A new default-path option to
+ sets the working directory for processes created from keys or interactively
+ from the prompt.
+* New mode to display a large clock. Entered with clock-mode command (bound to
+ C-b t by default); two window options: clock-mode-colour and clock-mode-style
+ (12 or 24). This will probably be used as the basis for window locking.
+* New command, server-info, to show some server information and terminal
+ details.
+
+09 January 2009
+
+* Stop using ncurses variables and instead build a table of the codes we want
+ into an array for each terminal type. This makes the code a little more
+ untidy in places but gets rid of the awful global variables and calling
+ setterm all the time, and shoves all the ncurses-dependent mess into a single
+ file, tty-term.c. It also allows overriding single terminal codes, this is
+ used to fix rxvt on some platforms (where it is missing dch) and in future
+ may allow user customisation a la vim.
+* Update key handling code. Simplify, support ctrl properly and add a new
+ window option (xterm-keys) to output xterm key codes including ctrl and,
+ if available, alt and shift.
+
+08 January 2009
+
+* If built without DEBUG (the release versions), don't cause a fatal error if
+ the grid functions notice an input error, just log and ignore the
+ request. This might mean me getting shouted at less often when bugs kill
+ long-running sessions, at least in release versions.
+* Hopefully fix cursor out-of-bounds checking when writing to grid. When I
+ wrote the code I must have forgotten that the cursor can be one cell off the
+ right of the screen (yes, I know), so there were number of out-of-bounds/
+ overflow problems.
+
+07 January 2009
+
+* New flag to set and setw, -u, to unset an option (allowing it to inherit from)
+ the global options again.
+* Added more info messages for options changes.
+* A bit of tidying and reorganisation of options code.
+
+06 January 2009
+
+* Don't crash when backspacing if cursor is off the right of the screen,
+ reported by David Chisnall.
+* Complete words at any point inside command in prompt, also use option name
+ as well as command names.
+* Per-client prompt history of up to 100 items.
+* Use a splay tree for key bindings instead of an array. As a side-effect this
+ sorts them when listed.
+
+22 December 2008
+
+* Use the right keys for home and end.
+
+20 December 2008
+
+* Add vim mode for tmux configuration file to examples/, from Tiago Cunha.
+
+15 December 2008
+
+* New command, source-file (alias source), to load a configuration
+ file. Written by Tiago Cunha, many thanks.
+
+13 December 2008
+
+* Work around lack of dch. On Linux, the rxvt termcap doesn't have it (it is
+ lying, but we can't really start disbelieving termcaps...). This is a bit
+ horrible - I can see no way to do it without pretty much redrawing the whole
+ line, but it works...
+
+10 December 2008
+
+* glibc's getopt(3) is useless: it is not POSIX compliant without jumping
+ through non-portable hoops, and the method of resetting it is unclear (the
+ man page on my system says set optind to 1, but other sources say 0). So,
+ import OpenBSD's getopt_long.c into compat/ for use on Linux and use the
+ clearly documented optreset = optind = 1 method. This fixes some strange
+ issues with command parsing (getting the syntax wrong would prevent any
+ further commands being parsed).
+
+06 December 2008
+
+* Bring set/setw/show/showw into line with other commands. This means that by
+ default they now affect the current window (if any); the new -g flag must be
+ passed to set the global options. This changes the behaviour of set/show and
+ WILL BREAK CURRENT CONFIGURATIONS.
+
+ In summary, whether in the configuration file, the command prompt, or a key
+ binding, use -g to set a global option, use -t to specify a particular window
+ or session, or omit both to try and use the current window or session.
+
+ This makes set/show a bit of a pain but is the correct behaviour for
+ setw/showw and is the same as every other command, so we can put up with a
+ bit of pain for consistency.
+* Redo window options. They now work in the same way to session options with a
+ global options set. showw/setw commands now have similar syntax to show/set
+ (including the ability to use abbreviations).
+
+ PLEASE NOTE this includes the following configuration-breaking changes:
+
+ - remain-by-default is now GONE, use "setw -g remain-on-exit" to apply the
+ global window option instead;
+ - mode-keys is now a window option rather than session - use "setw [-g]
+ mode-keys" instead of set.
+
+ There are also some additions:
+
+ - message-fg and message-bg session options to control status line message
+ colours;
+ - mode-fg and mode-bg window options to set colours in window modes such as
+ copy mode.
+
+ The options code still a mess and now there is twice as much of it :-(.
+
+02 December 2008
+
+* Add support for including the window title in status-left or status-right
+ strings by including the character pair "#T". This may be prefixed with
+ a number to specify a maximum length, for example "#24T" to use at most
+ 24 characters of the title.
+* Introduce two new options, status-left-length and status-right-length,
+ control the maximum length of left and right components of the status bar.
+* elinks (and possibly others) bypass the terminal and talk directly to X to
+ restore the window title when exiting. tmux can't know about this particular
+ bit of stupidity so the title ends up strange - the prefix isn't terribly
+ important and elinks is quite useful so just get rid of it.
+
+27 November 2008
+
+* Tweaks to support Dragonfly.
+
+17 November 2008
+
+* tmux 0.5 released.
+
+16 November 2008
+
+* New window option: "utf8"; this must be on (it is off by default) for UTF-8
+ to be parsed. The global/session option "utf8-default" controls the setting
+ for new windows.
+
+ This means that by default tmux does not handle UTF-8. To use UTF-8 by
+ default it is necessary to a) "set utf8-default on" in .tmux.conf b) start
+ tmux with -u on any terminal which support UTF-8.
+
+ It seems a bit unnecessary for this to be a per-window option but that is
+ the easiest way to do it, and it can't do any harm...
+* Enable default colours if op contains \033[39;49m, based on a report from
+ fulvio ciriaco.
+
+12 November 2008
+
+* Keep stack of last windows rather than just most recent; based on a diff from
+ joshe.
+
+04 November 2008
+
+* Don't try to redraw status line when showing a prompt or message; if it does,
+ the status timer is never reset so it redraws on every loop. Spotted by
+ joshe.
+
+09 October 2008
+
+* Translate 256 colours into 16 if 256 is not available, same as screen does.
+* Better support for OSC command (only to set window title now), and also
+ support using APC for the same purpose (some Linux default shell profiles do
+ this).
+
+25 September 2008
+
+* Large internal rewrite to better support 256 colours and UTF-8. Screen data
+ is now stored as single two-way array of structures rather than as multiple
+ separate arrays. Also simplified a lot of code.
+
+ Only external changes are three new flags, -2, -d and -u, which force tmux to
+ assume the terminal supports 256 colours, default colours (useful for
+ xterm-256color which lacks the AX flag), or UTF-8 respectively.
+
+10 September 2008
+
+* Split off colour conversion code from screen code.
+
+09 September 2008
+
+* Initial UTF-8 support. A bit ugly and with a limit of 4096 UTF-8
+ characters per window.
+
+08 September 2008
+
+* 256 colour support. tmux attempts to autodetect the terminal by looking
+ both at what ncurses reports (usually wrong for xterm) and checking if
+ the TERM contains "256col". For xterm TERM=xterm-256color is needed (as
+ well as a build that support 256 colours); this seems to work for rxvt
+ as well. On non-256 colour terminals, high colours are translated to white
+ foreground and black background.
+
+28 August 2008
+
+* Support OS X/Darwin thanks to bsd-poll.c from OpenSSH. Also convert
+ from clock_gettime(2) to gettimeofday(2) as OS X doesn't support the
+ former; microsecond accuracy will have to be sufficient ;-).
+
+07 August 2008
+
+* Lose some unused/useless wrapper functions.
+
+25 July 2008
+
+* Shell variables may now be defined and used in configuration file. Define
+ variables with:
+
+ VAR=1
+
+ And use with:
+
+ renamew ${VAR}
+ renamew "x${VAR}x"
+
+ Also some other fixes to make, for example, "abc""abc" work similarly to
+ the shell.
+
+24 July 2008
+
+* Finally lose inconsistently-used SCREEN_DEF* defines.
+* If cursor mode is on, switch the arrow keys from \033[A to \033OA.
+* Support the numeric keypad in both application and numbers mode. This is
+ different from screen which always keeps it in application mode.
+
+19 July 2008
+
+* Unbreak "set status" - tmux thought it was ambiguous, reported by rivo nurges.
+
+02 July 2008
+
+* Split vi and emacs mode keys into two tables and add an option (mode-keys)
+ to select between them. Default is emacs, use,
+
+ tmux set mode-keys vi
+
+ to change to vi.
+
+ vi mode uses space to start selection, enter to copy selection and escape
+ to clear selection.
+
+01 July 2008
+
+* Protocol versioning. Clients which identify as a different version from the
+ server will be rejected.
+* tmux 0.4 released.
+
+29 June 2008
+
+* Zombie windows. These are not closed when the child process dies. May be
+ set for a window with the new "remain-on-exit" option; the default setting
+ of this flag for new windows may be set with the "remain-by-default" session
+ option.
+
+ A window may be restarted with the respawn-window command:
+
+ respawn-window [-k] [command]
+
+ If -k is given, any existing process running in the window is killed;
+ if command is omitted, the same command as when the window was first
+ created is used.
+
+27 June 2008
+
+* Handle nonexistent session or client to -t properly.
+
+25 June 2008
+
+* select-prompt command to allow a window to be selected at a prompt. Only
+ windows in the current session may be selected. Bound to ' by default.
+ Suggested by merdely.
+* move-window command. Requested by merdely.
+* Support binding alt keys (prefixed with M-). Change default to use
+ C- for ctrl keys (^ is still accepted as an alternative).
+* Slim down default key bindings: support lowercase only.
+* Handle escaped keys properly (parse eg \033b into a single key code) and
+ use this to change copy mode next/previous work to M-f and M-b to match
+ emacs.
+
+24 June 2008
+
+* Next word (C-n/w) and previous word (C-b/b) in copy mode.
+
+23 June 2008
+
+* list-commands command (alias lscm).
+* Split information about options into a table and use it to parse options
+ on input (allowing abbreviations) and to print them with show-options
+ (meaning that bell-action gets a proper string). This turned out a bit ugly
+ though :-/.
+
+22 June 2008
+
+* Do not translate black and white into default if the terminal supports
+ default colours. This was nice to force programs which didn't use default
+ colours to be properly transparent in rxvt/aterm windows with a background
+ image, but it causes trouble if someone redefines the default foreground and
+ background (to have black on white or something).
+
+21 June 2008
+
+* Naive tab completion in the command prompt. This only completes command
+ names if a) they are at the start of the text b) the cursor is at
+ the end of the text c) the text contains no spaces.
+* Only attempt to set the title where TERM looks like an xterm (contains
+ "xterm", "rxvt" or is "screen"). I hate this but I don't see a better way:
+ setting the title actually kills some other terminals pretty much dead.
+* Strip padding out of terminfo(5) strings. Currently the padding is just
+ ignored, this may need to be altered if there are any software terminals
+ out there that actually need it.
+
+20 June 2008
+
+* buffer-limit option to set maximum size of buffer stack. Default is 9.
+* Initial buffer improvements. Each session has a stack of buffers and each
+ buffer command takes a -b option to manipulate items on the stack. If -b
+ is omitted, the top entry is used. The following commands are currently
+ available:
+
+ set-buffer [-b index] [-t target-session] string
+ paste-buffer [-d] [-b index] [-t target-window]
+ delete-buffer [-b index] [-t target-session]
+ show-buffers [-t target-session]
+ show-buffer [-b index] [-t target-session]
+
+ -d to paste-buffer deletes the buffer after pasting it.
+* New option, display-time, sets the time status line messages stay on screen
+ (unless a key is pressed). Set in milliseconds, default is 750 (0.75 seconds).
+ The timer is only checked every 100 ms or so.
+
+19 June 2008
+
+* Use "status" consistently for status line option, and prefix for "prefix" key
+ option.
+* Allow commands to be entered at a prompt. This is triggered with the
+ command-prompt command, bound to : by default.
+* Show status messages properly, without blocking the server.
+
+18 June 2008
+
+* New option, set-titles. On by default, this attempts to set the window title
+ using the \e]2;...\007 xterm code.
+
+ Note that elinks requires the STY environment variable (used by screen) to be
+ set before it will set the window title. So, if you want window titles set by
+ elinks, set STY before running it (any value will do). I can't do this for all
+ windows since setting it to an invalid value breaks screen.
+* Show arrows at either end of status line when scrolled if more windows
+ exist. Highlight the arrow if a hidden window has activity or bell.
+* Scroll the status line to show the current window if necessary. Also handle
+ windows smaller than needed better (show a blank status line instead of
+ hanging or crashing).
+
+17 June 2008
+
+* tmux 0.3 released.
+
+16 June 2008
+
+* Add some information messages when window options are changed, suggested by
+ Mike Erdely. Also add a -q command-line option to suppress them.
+* show-window-options (showw) command.
+
+15 June 2008
+
+* show-options (show) command to show one or all options.
+
+14 June 2008
+
+* New window options: force-width and force-height. This will force a window
+ to an arbitrary width and height (0 for the default unlimited). This is
+ neat for emacs which doesn't have a sensible way to force hard wrapping at 80
+ columns. Also, don't try to be clever and use clr_eol when redrawing the
+ whole screen, it causes trouble since the redraw functions are used to draw
+ the blank areas too.
+* Clear the blank area below windows properly when they are smaller than client,
+ also add an indicator line to show the vertical limit.
+* Don't die on empty strings in config file, reported by Will Maier.
+
+08 June 2008
+
+* Set socket mode +x if any sessions are attached and -x if not.
+
+07 June 2008
+
+* Make status-interval actually changeable.
+
+06 June 2008
+
+* New window option: aggressive-resize. Normally, windows are resized to the
+ size of the smallest attached session to which they are linked. This means a
+ window only changes size when sessions are detached or attached, or they are
+ linked or unlinked from a session. This flag changes a window to be the size
+ of the smallest attached session for which it is the current window - it is
+ resized every time a session changes to it or away from it. This is nice for
+ things that handle SIGWINCH well (like irssi) and bad for things like shells.
+* The server now exits when no sessions remain.
+* Fix bug with inserting characters with TERM=xterm-color.
+
+05 June 2008
+
+* Completely reorganise command parsing. Much more common code in cmd-generic.c
+ and a new way of specifying windows, clients or sessions. Now, most commands
+ take a -t argument, which specifies a client, a session, or a window target.
+ Clients and sessions are given alone (sessions are fnmatch(3)d and
+ clients currently not), windows are give by (client|session):index. For
+ example, if a user is in session "1" window 0 on /dev/ttypi, these should all
+ be equivalent:
+
+ tmux renamew newname (current session and window)
+ tmux renamew -t: newname (current session and window)
+ tmux renamew -t:0 newname (current session, window 0)
+ tmux renamew -t0 newname (current session, window 0)
+ tmux renamew -t1:0 newname (session 1, window 0)
+ tmux renamew -t1: newname (session 1's current window)
+ tmux renamew -t/dev/ttypi newname (client /dev/ttypi's current
+ session and window)
+ tmux renamew -t/dev/ttypi: newname (client /dev/ttypi's current
+ session and window)
+ tmux renamew -t/dev/ttypi:0 newname (client /dev/ttypi's current
+ session, window 0)
+
+ This does have some downsides, for example, having to use -t on selectw,
+
+ tmux selectw -t7
+
+ is annoying. But then using non-flagged arguments would mean renaming the
+ current window would need to be something like:
+
+ tmux renamew : newname
+
+ It might be better not to try and be so consistent; comments to the usual
+ address ;-).
+* Infrastructure for printing arguments in list-keys output. Easy ones only for
+ now.
+
+04 June 2008
+
+* Add some vi(1) key bindings in copy mode, and support binding ^[, ^\, ^]
+ ^^ and ^_. Both from/prompted by Will Maier.
+* setw monitor-activity and set status without arguments now toggle the current
+ value; suggested by merdely.
+* New command set-window-option (alias setw) to set the single current window
+ option: monitor-activity to determine whether window activity is shown in
+ the status bar for that window (default off).
+* Change so active/bell windows are inverted in status line.
+* Activity monitoring - window with activity are marked in status line. No
+ way to disable this/filter windows yet.
+* Brought select-window command into line with everything else; it now uses
+ -i for the window index.
+* Strings to display on the left and right of the status bar may now be set
+ with the status-left and status-right options. These are passed through
+ strftime(3) before being displayed. The status bar is automatically updated
+ at an interval set by the status-interval option. The default is to display
+ nothing on the left and the date and time on the left; the default update
+ interval is 15 seconds.
+
+03 June 2008
+
+* Per session options. Setting options without specifying a session sets the
+ global options as normal (global options are inherited by all sessions);
+ passing -c or -s will set the option only for that session.
+* Because a client has a session attached, any command needing a session can
+ take a client and use its session. So, anything that used to accept -s now
+ accepts -c as well.
+* -s to specify session name now supports fnmatch(3) wildcards; if multiple
+ sessions are found, or if no -s is specified, the most newly created is used.
+* If no command is specified, assume new-session. As a byproduct, clean up
+ command default values into separate init functions.
+* kill-server command.
+
+02 June 2008
+
+* New command, start-server (alias "start"), to start the tmux server and do
+ nothing else. This is good if you have a configuration file which creates
+ windows or sessions (like me): in that case, starting the server the first
+ time tmux new is run is bad since it creates a new session and window (as
+ it is supposed to - starting the server is a side-effect).
+
+ Instead, I have a little script which does the equivalent of:
+
+ tmux has -s0 2>/dev/null || tmux start
+ tmux attach -d -s0
+
+ And I use it to start the server if necessary and attach to my primary
+ session.
+* Basic configuration file in ~/.tmux.conf or specified with -f. This is file
+ contains a set of tmux commands that are run the first time the server is
+ started. The configuration commands are executed before any others, so
+ if you have a configuration file that contains:
+
+ new -d
+ neww -s0
+
+ And you do the following without an existing server running:
+
+ tmux new
+
+ You will end up with two sessions, session 0 with two windows (created by
+ the configuration file) and your client attached to session 1 with one
+ window (created by the command-line command). I'm not completely happy with
+ this, it seems a little non-obvious, but I haven't yet decided what to do
+ about it.
+
+ There is no environment variable handling or other special stuff yet.
+
+ In the future, it might be nice to be able to have per-session configuration
+ settings, probably by having conditionals in the file (so you could, for
+ example, have commands to define a particular window layout that would only
+ be invoked if you called tmux new -smysession and mysession did not already
+ exist).
+* BIG CHANGE: -s and -c to specify session name and client name are now passed
+ after the command rather than before it. So, for example:
+
+ tmux -s0 neww
+
+ Becomes:
+
+ tmux neww -s0
+
+ This is to allow them to be used in the (forthcoming) configuration file
+ THIS WILL BREAK ANY CURRENT SCRIPTS OR ALIASES USING -s OR -c.
+
+01 June 2008
+
+* Bug fix: don't die if -k passed to link-window and the destination doesn't
+ exist.
+* New command, send-keys, will send a set of keys to a window.
+
+31 May 2008
+
+* Fix so tmux doesn't hang if the initial window fails for some reason. This
+ was highlighted by problems on Darwin, thanks to Elias Pipping for the report
+ and access to a test account. (tmux still won't work on Darwin since its
+ poll(2) is broken.)
+
+02 January 2008
+
+* Don't attempt to reset the tty on exit if it has been closed externally.
+
+06 December 2007
+
+* Restore checks for required termcap entries and add a few more obvious
+ emulations.
+* Another major reorganisation, this time of screen handling. A new set of
+ functions, screen_write_*, are now used to write to a screen and a tty
+ simultaneously. These are used by the input parser to update the base
+ window screen and also by the different modes which now interpose their own
+ screen.
+
+30 November 2007
+
+* Support \ek...\e\ to set window name.
+
+27 November 2007
+
+* Enable/disable mouse when asked, if terminal claims to support it. Mouse
+ sequences are just passed through unaltered for the moment.
+* Big internal reorganisation. Rather than leaving control of the tty solely in
+ the client and piping all data through a socket to it, change so that the
+ server opens the tty again and reads and writes to it directly. This avoids
+ a lot of buffering and copying. Also reorganise the redrawing stuff so that
+ everything goes through screen_draw_* - this makes the code simpler, but
+ still needs broken up more, and all the ways of writing to screens should be
+ more consistent.
+
+26 November 2007
+
+* Rather than shifting up one line at a time once the history is full,
+ shift by 10% of the history each time. This is faster.
+* Add ^A and ^E to copy mode to move to start-of-line/end-of-line.
+
+24 November 2007
+
+* Support for alt charset mode (VT100 graphics characters).
+
+23 November 2007
+
+* Mostly complete copy & paste. Copy mode entered with C-b [ (copy-mode
+ command). In copy mode, arrow keys/page up/page down/hjkl/C-u/C-f navigate,
+ space or C-space starts selection, and enter or C-w copies and (important!)
+ exits copy mode. C-b ] (paste-buffer) pastes into current window. No
+ extra utility keys (bol/eol/clear selection/etc), only one single buffer,
+ and no buffer manipulation commands (clear/view/etc) yet. The code is also
+ fugly :-(.
+* history-limit option to set maximum history. Does not apply retroactively to
+ existing windows! Lines take up a variable amount of space, but a reasonable
+ guess for an 80-column terminal is 250 KB per 1000 lines (of history used,
+ an empty history takes no space).
+
+21 November 2007
+
+* Create every line as zero length and only expand it as data is written,
+ rather than creating at full size immediately.
+* Make command output (eg list-keys) go to a scrollable window similar to
+ scroll mode.
+* Redo screen redrawing so it is a) readable b) split into utility functions
+ that can be used outside screen.c. Use these to make scroll mode only
+ redraw what it has to which gets rid of irritating flickering status box and
+ makes it much faster.
+* Full line width memory and horizontal scrolling in history.
+* Initial support for scroll history. = to enter scrolling mode, and then
+ vi keys or up/down/pgup/pgdown to navigate. Q to exit. No horizontal history
+ yet (need per-line sizes) and a few kinks to be worked out (resizing while in
+ history mode will probably cause trouble).
+
+20 November 2007
+
+* Fix format string error with "must specify a client" message. Also
+ sprinkle some printflike tags.
+* tmux 0.1 released.
+
+17 November 2007
+
+* (nicm) Add -k option to link-window to kill target window if it exists.
+
+16 November 2007
+
+* (nicm) Split in-client display into two columns. This is a hack but not a lot
+ more so than that bit is already and it helps with lots of keys.
+* (nicm) switch-client command to switch client between different sessions. This
+ is pretty cool:
+
+ $ tmux bind q switch 0
+ $ tmux bind w switch 1
+
+ Then you can switch between sessions 0 and 1 with a key :-).
+* (nicm) Accept "-c client-tty" on command line to allow client manipulation
+ commands, and change detach-/refresh-session to detach-/refresh-client (this
+ loses the -a behaviour, but at some point -session versions may return, and
+ -c will allow fnmatch(3)).
+* (nicm) List available commands on ambiguous command.
+
+12 November 2007
+
+* (nicm) If the terminal supports default colours (AX present), force black
+ background and white foreground to default. This is useful on transparent
+ *terms for programs which don't do it themselves (like most(1)).
+* (nicm) Fill in the rest of the man page.
+* (nicm) kill-session command.
+
+09 November 2007
+
+* (nicm) C-space is now "^ " not "^@".
+* (nicm) Support tab (\011).
+* (nicm) Initial man page outline.
+* (nicm) -V to show version.
+* (nicm) rename-session command.
+
+08 November 2007
+
+* (nicm) Check for required terminal capabilities on start.
+
+31 October 2007
+
+* (nicm) Linux port.
+
+30 October 2007
+
+* (nicm) swap-window command. Same as link-window but swaps windows.
+
+26 October 2007
+
+* (nicm) Saving scroll region on \e7 causes problems with ncmpc so I guess
+ it is not required.
+* (nicm) unlink-window command.
+* (nicm) link-window command to link an existing window into another session
+ (or another index in the same session). Syntax:
+
+ tmux -s dstname link-window [-i dstidx] srcname srcidx
+
+* (nicm) Redo window data structures. The global array remains, but each per-
+ session list is now a RB tree of winlink structures. This disassociates the
+ window index from the array size (allowing arbitrary indexes) which still
+ allowing windows to have multiple indexes.
+
+25 October 2007
+
+* (nicm) has-session command: checks if session exists.
+
+24 October 2007
+
+* (nicm) Support for \e6n to request cursor position. resize(1) now works.
+* (nicm) Support for \e7, \e8 save/restore cursor and attribute sequences.
+ Currently don't save mode (probably should). Also change some cases where
+ out-of-bound values are ignored to limit them to within range (there are
+ others than need to be checked too).
+
+23 October 2007
+
+* (nicm) Lift limit on session name passed with -s.
+* (nicm) Show size in session/window lists.
+* (nicm) Pass tty up to server when client identifies and add a list-clients
+ command to list connected clients.
+
+20 October 2007
+
+* (nicm) Add default-command option and change default to be $SHELL rather than
+ $SHELL -l. Also try to read shell from passwd db if $SHELL isn't present.
+
+19 October 2007
+
+* (nicm) -n on new-session is now -s, and -n is now the initial window name.
+ This was documented but not implemented :-/.
+* (nicm) kill-window command, bound to & by default (because it should be hard
+ to hit accidently).
+* (nicm) bell-style option with three choices: "none" completely ignore bell;
+ "any" pass through a bell in any window to current; "current" ignore bells
+ except in current window. This applies only to the bell terminal signal,
+ the status bar always reflects any bells.
+* (nicm) Refresh session command.
+
+12 October 2007
+
+* (nicm) Add a warning if $TMUX exists on new/attach.
+* (nicm) send-prefix command. Bound to C-b by default.
+* (nicm) set status, status-fg, status-bg commands. fg and bg are as a number
+ from 0 to 8 or a string ("red", "blue", etc). status may be 1/0, on/off,
+ yes/no.
+* (nicm) Make status line mark window in yellow on bell.
+
+04 October 2007
+
+* (nicm) -d option to attach to detach all other clients on the same session.
+* (nicm) Partial resizing support. Still buggy. A C-b S and back sometimes fixes
+ it when it goes wonky.
+* (mxey) Added my tmux start script as an example (examples/start-tmux.sh).
+* (mxey) New sessions can now be given a command for their first window.
+* (mxey) Fixed usage statement for new-window.
+* (nicm) attach-session (can't believe I forgot it until now!) and list-windows
+ commands.
+* (nicm) rename-window and select-window commands.
+* (nicm) set-option command (alias set): "tmux set-option prefix ^A".
+* (nicm) Key binding and unbinding is back.
+
+03 October 2007
+
+* (nicm) {new,next,last,previous}-window.
+* (nicm) Rewrite command handling so commands are much more generic and the
+ same commands are used for command line and keys (although most will probably
+ need to check how they are called). Currently incomplete (only new/detach/ls
+ implemented). Change: -s is now passed before command again!
+* (nicm) String number arguments. So you can do: tmux bind ^Q create "blah".
+* (nicm) Key binding. tmux bind key command [argument] and tmux unbind key.
+ Key names are in a table in key-string.c, plus A is A, ^A is ctrl-A.
+ Possible commands are in cmd.c (look at cmd_bind_table).
+* (nicm) Move command parsing into the client. Also rename some messages and
+ tidy up a few bits. Lots more tidying up needed :-/.
+
+02 October 2007
+
+* (nicm) Redraw client status lines on rename.
+* (nicm) Error on ambiguous command.
+
+01 October 2007
+
+* (nicm) Restore window title handling.
+* (nicm) Simple uncustomisable status line with window list.
+
+30 September 2007
+
+* (nicm) Window info command for debugging, C-b I.
+
+29 September 2007
+
+* (nicm) Deleting/inserting lines should follow scrolling region. Fix.
+* (nicm) Allow creation of detached sessions: "tmux new-session -d".
+* (nicm) Permit error messages to be passed back for transient clients like
+ rename. Also make rename -i work.
+* (nicm) Pass through bell in any window to current.
+
+28 September 2007
+
+* (nicm) Major rewrite of input parser:
+ - Lose the old weirdness in favour of a state machine.
+ - Merge in parsing from screen.c.
+ - Split key parsing off into a separate file.
+ This is step one towards hopefully allowing a status line. It requires
+ that we output data as if the terminal had one line less than it really does -
+ a serious problem when it comes to things like scrolling. This change
+ consolidates all the range checking and limiting together which should make
+ it easier.
+* (mxey) Added window renaming, like "tmux rename [-s session] [-i index] name"
+
+27 September 2007
+
+* Split "tmux list" into "tmux list-sessions" (ls) and "list-windows" (lsw).
+* New command session selection:
+ - if name is specified, look for it and use it if it exists, otherwise
+ error
+ - if no name specified, try the current session from $TMUX
+ - if $TMUX doesn't exist, and there is only one session, use it,
+ otherwise error
+
+26 September 2007
+
+* Add command aliases, so "ls" is an alias for "list".
+* Rename some commands and alter syntax to take options after a la CVS. Also
+ change some flags. So:
+
+ tmux -s/socket -nabc new
+
+ Becomes:
+
+ tmux -S/socket new -sabc
+
+* Major tidy and split of client/server code.
+
+22 September 2007
+
+* Window list command (C-b W). Started by Maximilian Gass, finished by me.
+
+20 September 2007
+
+* Specify meta via environment variable (META).
+* Record last window and ^L key to switch to it. Largely from Maximilian Gass.
+* Reset ignored signals in child after forkpty, makes ^C work.
+* Wrap on next/previous. From Maximilian Gass.
+
+19 September 2007
+
+* Don't renumber windows on close.
+
+28 August 2007
+
+* Scrolling region (\e[r) support.
+
+27 August 2007
+
+* Change screen.c to work more logically and hopefully fix heap corruption.
+
+09 July 2007
+
+* Initial import to CVS. Basic functions are working, albeit with a couple of
+ showstopper memory bugs and many missing features. Detaching, reattaching,
+ creating new sessions, listing sessions work acceptably for using with shells.
+ Simple curses programs (top, systat, tetris) and more complicated ones (mutt,
+ emacs) that don't require scrolling regions (ESC[r) mostly work fine
+ (including mutt, emacs). No status bar yet and no key remapping or other
+ customisation.
+
+$Id: CHANGES,v 1.301 2009/11/05 12:35:47 tcunha Exp $
+
+ LocalWords: showw utf UTF fulvio ciriaco joshe OSC APC gettime abc DEF OA clr
+ LocalWords: rivo nurges lscm Erdely eol smysession mysession ek dstname RB ms
+ LocalWords: dstidx srcname srcidx winlink lsw nabc sabc Exp Tiago Cunha dch
+ LocalWords: setw Chisnall renamew merdely eg Maier newname selectw neww Gass
204 FAQ
@@ -0,0 +1,204 @@
+tmux frequently asked questions
+
+* How is tmux different from GNU screen? What else does it offer?
+
+tmux offers several advantages over screen:
+
+- a clearly-defined client-server model: windows are independent entities which
+ may be attached simultaneously to multiple sessions and viewed from multiple
+ clients (terminals), as well as moved freely between sessions within the same
+ tmux server;
+- a consistent, well-documented command interface, with the same syntax
+ whether used interactively, as a key binding, or from the shell;
+- easily scriptable from the shell;
+- multiple paste buffers;
+- choice of vi or emacs key layouts;
+- an option to limit the window size;
+- a more usable status line syntax, with the ability to display the first line
+ of output of a specific command;
+- a cleaner, modern, easily extended, BSD-licensed codebase.
+
+There are still a few features screen includes that tmux omits:
+
+- builtin serial and telnet support; this is bloat and is unlikely to be added
+ to tmux;
+- wider platform support, for example IRIX and HP-UX, and for odd terminals.
+
+* I found a bug! What do I do?
+
+Please send bug reports by email to nicm@users.sourceforge.net. Please
+include as much of the following information as possible:
+
+- the version of tmux you are running;
+- the operating system you are using and its version;
+- the terminal emulator you are using and the TERM setting when tmux was
+ started;
+- a description of the problem;
+- if the problem is repeatable, the steps to repeat the problem;
+- for screen corruption issues, a screenshot and the output of "infocmp $TERM"
+ from outside tmux are often very useful.
+
+* Why doesn't tmux do $x?
+
+Please send feature requests by email to nicm@users.sourceforge.net.
+
+* Why do you use the screen terminal description inside tmux? It sucks.
+
+It is already widely available. It is planned to change to something else such
+as xterm-xfree86 at some point, if possible.
+
+* I don't see any colour in my terminal! Help!
+
+On some platforms, common terminal descriptions such as xterm do not include
+colour. screen ignores this, tmux does not. If the terminal emulator in use
+supports colour, use a value for TERM which correctly lists this, such as
+xterm-color.
+
+* tmux freezes my terminal when I attach to a session. I even have to kill -9
+ the shell it was started from to recover!
+
+Some consoles really really don't like attempts to set the window title. Tell
+tmux not to do this by turning off the "set-titles" option (you can do this
+in .tmux.conf):
+
+ set -g set-titles off
+
+If this doesn't fix it, send a bug report.
+
+* Why is C-b the prefix key? How do I change it?
+
+The default key is C-b because the prototype of tmux was originally developed
+inside screen and C-b was chosen not to clash with the screen meta key. It
+also has the advantage of not interfering with the use of C-a for start-of-line
+in emacs and the shell (although it does interfere with previous-character).
+
+Changing is simple: change the "prefix-key" option, and - if required - move
+the binding of the "send-prefix" command from C-b (C-b C-b sends C-b by
+default) to the new key. For example:
+
+ set -g prefix C-a
+ unbind C-b
+ bind C-a send-prefix
+
+* How do I use UTF-8?
+
+When running tmux in a UTF-8 capable terminal, two things must be done to
+enable support. UTF-8 must be turned on in tmux; this may be done separately
+for each tmux window or globally by setting the "utf8" flag:
+
+ setw -g utf8 on
+
+As of release 0.9, tmux attempts to autodetect a UTF-8-capable terminal by
+checking the LC_ALL, LC_CTYPE and LANG environment variables. list-clients may
+be used to check if this is detected correctly; if not, the -u command-line
+flag may be specified when creating or attaching a client to a tmux session:
+
+ $ tmux -u new
+
+* How do I use a 256 colour terminal?
+
+Provided the underlying terminal supports 256 colours, it is usually sufficient
+to add the following to ~/.tmux.conf:
+
+ set -g default-terminal "screen-256color"
+
+Note that some platforms do not support "screen-256color" ("infocmp
+screen-256color" will return an error) - in this case see the next entry in
+this FAQ.
+
+tmux attempts to detect a 256 colour terminal both by looking at the colors
+terminfo entry and by looking for the string "256col" in the TERM environment
+variable.
+
+If both these methods fail, the -2 flag may be passed to tmux when attaching
+to a session to indicate the terminal supports 256 colours.
+
+* vim or $otherprogram doesn't display 256 colours. What's up?
+
+Some programs attempt to detect the number of colours a terminal is capable of
+by checking the colors terminfo or Co termcap entry. However, this is not
+reliable, and in any case is missing from the "screen" terminal description
+used inside tmux.
+
+There are two options (aside from using "screen-256color") to allow programs to
+recognise they are running on a 256-colour terminal inside tmux:
+
+- Manually force the application to use 256 colours always or if TERM is set to
+ screen. For vim, you can do this by overriding the t_Co option, see
+ http://vim.wikia.com/wiki/256_colors_in_vim.
+- Creating a custom terminfo file that includes colors#256 in ~/.terminfo and
+ using it instead. These may be compiled with tic(1).
+
+* How do I make Ctrl-PgUp and Ctrl-PgDn work in vim?
+
+tmux supports passing through ctrl (and where supported by the client terminal,
+alt and shift) modifiers to function keys using xterm(1)-style key sequences.
+This may be enabled per window, or globally with the tmux command:
+
+ setw -g xterm-keys on
+
+Because the TERM variable inside tmux must be set to "screen", vim will not
+automatically detect these keys are available; however, the appropriate key
+sequences can be overridden in .vimrc using the following:
+
+ if &term == "screen"
+ set t_kN=^[[6;*~
+ set t_kP=^[[5;*~
+ endif
+
+And similarly for any other keys for which modifiers are desired.
+
+Please note that the "xterm-keys" setting may affect other programs, in the
+same way as running them in a standard xterm; for example most shells do not
+expect to receive xterm(1)-style key sequences so this setting may prevent keys
+such as ctrl-left and ctrl-right working correctly. tmux also passes through
+the ctrl (bit 5 set, for example ^[[5~ to ^[[5^) modifier in non-xterm(1) mode;
+it may be possible to configure vim to accept these, an example of how to do so
+would be welcome.
+
+* Why doesn't elinks set the window title inside tmux?
+
+There isn't a way to detect if a terminal supports setting the window title, so
+elinks attempts to guess by looking at the environment. Rather than looking for
+TERM=screen, it uses the STY variable to detect if it is running in screen;
+tmux does not use this so the check fails. A workaround is to set STY before
+running elinks.
+
+The following shell function does this, and also clears the window title on
+exit (elinks, for some strange reason, sets it to the value of TERM):
+
+ elinks() {
+ STY= `which elinks` $*
+ echo -ne \\033]0\;\\007;
+ }
+
+* What is the proper way to escape characters with #(command)?
+
+When using the #(command) construction to include the output from a command in
+the status line, the command will be parsed twice. First, when it's read by the
+configuration file or the command-prompt parser, and second when the status
+line is being drawn and the command is passed to the shell. For example, to
+echo the string "(test)" to the status line, either single or double quotes
+could be used:
+
+ set -g status-right "#(echo \\\\(test\\\\))"
+ set -g status-right '#(echo \\\(test\\\))'
+
+In both cases, the status-right option will be set to the string "#(echo
+\\(test\\))" and the command executed will be "echo \(test\)".
+
+* tmux uses too much CPU. What do I do?
+
+Automatic window renaming may use a lot of CPU, particularly on slow computers:
+if this is a problem, turn it off with "setw -g automatic-rename off". If this
+doesn't fix it, please report the problem.
+
+* I use PuTTY and my tmux window pane separators are all qqqqqqqqq's!
+
+PuTTY is using a character set translation that doesn't support ACS line
+drawing. With a Unicode font, try setting PuTTY to use a different translation
+on the Window -> Translation configuration page. For example, change UTF-8 to
+ISO-8859-1 or CP437. It may also be necessary to adjust the way PuTTY treats
+line drawing characters in the lower part of the same configuration page.
+
+$Id: FAQ,v 1.29 2009/08/08 20:46:26 nicm Exp $
86 GNUmakefile
@@ -0,0 +1,86 @@
+# $Id: GNUmakefile,v 1.120 2009/11/05 12:30:55 tcunha Exp $
+#
+# Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+# IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+# OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+
+.PHONY: clean
+
+VERSION= 1.1
+
+#FDEBUG= 1
+
+CC?= cc
+CFLAGS+= -DBUILD="\"$(VERSION)\""
+LDFLAGS+= -L/usr/local/lib
+LIBS+=
+
+# Sun CC
+ifneq ($(shell ($(CC) -V 2>&1|awk '/Sun C/' || true)), )
+ CFLAGS+=-erroff=E_EMPTY_DECLARATION
+ FDEBUG=
+endif
+
+ifdef FDEBUG
+CFLAGS+= -g -ggdb -DDEBUG
+CFLAGS+= -Wno-long-long -Wall -W -Wnested-externs -Wformat=2
+CFLAGS+= -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations
+CFLAGS+= -Wwrite-strings -Wshadow -Wpointer-arith -Wsign-compare
+CFLAGS+= -Wundef -Wbad-function-cast -Winline -Wcast-align
+endif
+
+# This sort of sucks but gets rid of the stupid warning and should work on
+# most platforms...
+ifeq ($(shell (LC_ALL=C $(CC) -v 2>&1|awk '/gcc version 4|clang/') || true), )
+CPPFLAGS:= -I. -I- $(CPPFLAGS)
+else
+CPPFLAGS:= -iquote. $(CPPFLAGS)
+ifdef FDEBUG
+CFLAGS+= -Wno-pointer-sign
+endif
+endif
+
+PREFIX?= /usr/local
+INSTALLDIR= install -d
+INSTALLBIN= install -g bin -o root -m 555
+INSTALLMAN= install -g bin -o root -m 444
+
+SRCS= $(shell echo *.c|sed 's|osdep-[a-z0-9]*.c||g')
+include config.mk
+OBJS= $(patsubst %.c,%.o,$(SRCS))
+
+all: tmux
+
+tmux: $(OBJS)
+ $(CC) $(LDFLAGS) -o tmux $+ $(LIBS)
+
+depend: $(SRCS)
+ $(CC) $(CPPFLAGS) $(CFLAGS) -MM $(SRCS) > .depend
+
+clean:
+ rm -f tmux *.o *~ *.core *.log compat/*.o compat/*~
+
+clean-depend:
+ rm -f .depend
+
+clean-all: clean clean-depend
+ rm -f config.h config.mk
+
+install: all
+ $(INSTALLDIR) $(DESTDIR)$(PREFIX)/bin
+ $(INSTALLBIN) tmux $(DESTDIR)$(PREFIX)/bin/tmux
+ $(INSTALLDIR) $(DESTDIR)$(PREFIX)/man/man1
+ $(INSTALLMAN) tmux.1 $(DESTDIR)$(PREFIX)/man/man1/tmux.1
+
+-include .depend
83 Makefile
@@ -0,0 +1,83 @@
+# $Id: Makefile,v 1.153 2009/11/05 12:30:55 tcunha Exp $
+#
+# Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+# IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+# OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+
+.SUFFIXES: .c .o
+.PHONY: clean
+
+VERSION= 1.1
+
+#FDEBUG= 1
+
+CC?= cc
+CFLAGS+= -DBUILD="\"$(VERSION)\""
+LDFLAGS+= -L/usr/local/lib
+LIBS+=
+
+.ifdef FDEBUG
+CFLAGS+= -g -ggdb -DDEBUG
+CFLAGS+= -Wno-long-long -Wall -W -Wnested-externs -Wformat=2
+CFLAGS+= -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations
+CFLAGS+= -Wwrite-strings -Wshadow -Wpointer-arith -Wsign-compare
+CFLAGS+= -Wundef -Wbad-function-cast -Winline -Wcast-align
+.endif
+
+# This sort of sucks but gets rid of the stupid warning and should work on
+# most platforms...
+CCV!= (LC_ALL=C ${CC} -v 2>&1|awk '/gcc version 4|clang/') || true
+.if empty(CCV)
+CPPFLAGS:= -I. -I- -I/usr/local/include ${CPPFLAGS}
+.else
+CPPFLAGS:= -iquote. -I/usr/local/include ${CPPFLAGS}
+.ifdef FDEBUG
+CFLAGS+= -Wno-pointer-sign
+.endif
+.endif
+
+PREFIX?= /usr/local
+INSTALLDIR= install -d
+INSTALLBIN= install -g bin -o root -m 555
+INSTALLMAN= install -g bin -o root -m 444
+
+SRCS!= echo *.c|sed 's|osdep-[a-z0-9]*.c||g'
+.include "config.mk"
+OBJS= ${SRCS:S/.c/.o/}
+
+.c.o:
+ ${CC} ${CPPFLAGS} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
+
+all: tmux
+
+tmux: ${OBJS}
+ ${CC} ${LDFLAGS} -o tmux ${OBJS} ${LIBS}
+
+depend:
+ mkdep ${CPPFLAGS} ${CFLAGS} ${SRCS:M*.c}
+
+clean:
+ rm -f tmux *.o *~ *.core *.log compat/*.o compat/*~
+
+clean-depend:
+ rm -f .depend
+
+clean-all: clean clean-depend
+ rm -f config.h config.mk
+
+install: all
+ ${INSTALLDIR} ${DESTDIR}${PREFIX}/bin
+ ${INSTALLBIN} tmux ${DESTDIR}${PREFIX}/bin/
+ ${INSTALLDIR} ${DESTDIR}${PREFIX}/man/man1
+ ${INSTALLMAN} tmux.1 ${DESTDIR}${PREFIX}/man/man1/
91 NOTES
@@ -0,0 +1,91 @@
+Welcome to tmux!
+
+tmux is a "terminal multiplexer", it enables a number of terminals (or windows)
+to be accessed and controlled from a single terminal. tmux is intended to be a
+simple, modern, BSD-licensed alternative to programs such as GNU screen.
+
+This release runs on OpenBSD, FreeBSD, NetBSD, Linux and OS X and may still
+run on Solaris and AIX (although they haven't been tested in a while). It is
+usable, although there remain a number of missing features and some remaining
+bugs are expected.
+
+If upgrading from 1.0, PLEASE NOTE:
+- The internal locking mechanism has gone, so the set-password command and -U
+ command line option have been removed.
+- The -d command line flag was dropped. It will now automatically detect the
+ default colours by using op/AX. Nevertheless, if needed, the
+ terminal-overrides session option can replace it.
+
+tmux consists of a server part and multiple clients. The server is created when
+required and runs continuously unless killed by the user. Clients access the
+server through a socket in /tmp. Multiple sessions may be created on a single
+server and attached to a number of clients. Each session may then have a number
+of windows and windows may be linked to a number of sessions. Commands are
+available to create, rename and destroy windows and sessions; to attach and
+detach sessions from client terminals; to set configuration options; to split
+windows into several simultaneously displayed panes; and to bind and unbind
+command keys (invoked preceded by a prefix key, by default ctrl-b). Please see
+the tmux(1) man page for further information.
+
+The following is a summary of major features implemented in this version:
+
+- Basic multiplexing, window switching, attaching and detaching.
+- Window listing and renaming.
+- Key binding.
+- Handling of client terminal resize.
+- Terminal emulation sufficient to handle most curses applications.
+- A optional status line (enabled by default).
+- Window history and copy and paste.
+- Support for VT100 line drawing characters.
+- A large command set.
+- Vertical window splitting and layout.
+- Automatic server locking on inactivity by running an external command.
+- A configuration file.
+- UTF-8 support.
+
+A more extensive, but rough, todo list is included in the TODO file.
+
+tmux also depends on several features of the client terminal (TERM), if these
+are missing it may refuse to run, or not behave correctly.
+
+tmux supports UTF-8. To use it, the utf8 option must be set on each window;
+this may be turned on for all windows by setting it as a global option, see
+tmux(1) and the FAQ file. As of 0.9, tmux attempts to autodetect a
+UTF-8-capable terminal by checking the LC_ALL, LC_CTYPE and LANG environment
+variables. list-clients may be used to check if this is detected correctly; if
+not, the -u command-line flag may be specified.
+
+A Vim syntax file is available in the examples directory. To install it:
+
+- Drop the file in the syntax directory in your runtimepath (such as
+ ~/.vim/syntax/tmux.vim).
+- Make the filetype recognisable by adding the following to filetype.vim
+ in your runtimepath (~/.vim/filetype.vim):
+
+ augroup filetypedetect
+ au BufNewFile,BufRead .tmux.conf*,tmux.conf* setf tmux
+ augroup END
+
+- Switch on syntax highlighting by adding "syntax enable" to your vimrc file.
+
+For debugging, running tmux with -v or -vv will generate server and client log
+files in the current directory.
+
+tmux mailing lists are available; visit:
+
+ https://sourceforge.net/mail/?group_id=200378
+
+Bug reports, feature suggestions and especially code contributions are most
+welcome. Please send by email to:
+
+ nicm@users.sf.net
+
+This file and the CHANGES, FAQ and TODO files are licensed under the ISC
+license. Files under examples/ remain copyright their authors unless otherwise
+stated in the file but permission has been received to distribute them with
+tmux. All other files have a license and copyright notice at their
+start. Please contact me with any queries.
+
+-- Nicholas Marriott <nicm@users.sf.net>
+
+$Id: NOTES,v 1.51 2009/11/05 12:35:47 tcunha Exp $
97 TODO
@@ -0,0 +1,97 @@
+- window creation/idle time
+- better errors when creating new windows/sessions (how?)
+- implicitly add exec to the commands for new windows (switch to disable it)?
+- it would be nice to have multichar commands eg C-b K K
+- commands:
+ extend list-clients to list clients attached to a session (-a for all?)
+ bring back detach-session to detach all clients on a session?
+- allow fnmatch for -c, so that you can, eg, detach all clients
+- garbage collect window history (100 lines at a time?) if it hasn't been used
+ in $x time (need window creation/use times)
+- lift SHRT_MAX limits for history?
+- flags to centre screen in window
+- better terminal emulation
+- activity/bell should be per-window not per-link? what if it is cur win in
+ session not being watched?
+- next prev word etc in command prompt
+- many more info() displays for various things
+- input.c is too complicated. simplify?
+- use a better termcap internally instead of screen, perhaps xterm
+- fix rxvt cursor fg issue (text under cursor can have non-white fg)
+- should be able to move to a hidden pane and it would be moved into view. pane
+ number in status line/top-right would be cool for this
+- support other mouse modes (highlight etc) and use it in copy mode
+- set-remain-on-exit is a bit of a hack, some way to do it generically?
+- set-option should be set-session-option and should be overall global options
+ also quiet, utf8 and maybe other flags?
+ -g is a bit unexpected in conf file
+- clear window title on exit
+- the output code (tty.c) could do with optimisation depending on term
+ capabilities
+- would be nice to be able to use "--" to mark start of command w/ neww etc
+ to avoid quoting
+- make command sequences more usable: don't require space after ;, handle
+ errors better
+- attach should have a flag to create session if it doesn't exist
+- choice and more mode would be better per client than per window?
+- hooks to which commands may be attached, for example: tmux add-hook
+ "new-session" if-shell "[ -e $HOME/.tmux-session.conf ]" source-file
+ $HOME/.tmux-session.conf
+- get it passing all the vttest tests that don't require resizing the terminal
+- esc seq to set window title should be documented and should set
+ automatic-rename
+- way to set socket path from config file
+- XXX once env stuff is in, default-path and VISUAL/EDITOR should be picked up
+ when session is started
+- what about utmp etc? can tmux update it like screen? setgid?
+- warts on current naming:
+ - display-time but message-fg/bg/attr
+ - list-* vs show-*
+ - server-info
+ - up-pane/down-pane/swap-pane -U/swap-pane -D vs next-*/previous-*
+ - split-window -> split-pane??
+- tidy up and prioritise todo list ;-)
+- neww and attach can create a session if none exists?
+ would work fine with config file since
+- a way for force-width/height to apply to only one pane (how?)
+- command to list what is actually running in each window with command line,
+ pid (need some adaption of the osdep code)
+- string option to change/remove the symbols (*-+ etc) in status line
+ * or to set entire format, eg window-list-format '#N:#W#P' or something,
+ then could use embedded colours
+- support for bce
+- it would be nice if the start/end line keys in copy mode were aware of
+ wrapped lines
+- some way to force a screen to use the entire terminal even if it is forced
+ to be smaller by other clients. pan smaller terminal? (like screen F)
+ -- idea of a "view" onto a window, need base x/y offsets
+ for redraw
+- handle resize better in copy mode
+- way to copy stuff that is off screen due to resize
+- a way to address panes by name ("top-left") and position ("0,0")
+- commands should be able to succeed or fail and have || or && for command
+ lists
+- support the mouse wheel to scroll through history
+- some way to KEEP a command running continually and just use its LAST line of
+ output
+- bind commands to mouse buttons
+- UTF-8 to a non-UTF-8 terminal should not be able to balls up
+ the terminal - www/ruby-addressable; make regress
+- copy mode needs a tidy/cleanup
+- things like display-message will leak job entries if #() is used
+- message log
+- an option to NOT remove message when key pressed
+- would be nice to be able to press 0-9a-zA-Z to select window in choose-window
+ mode, also to start typing and it searches
+- the wrapping stuff should work when redrawn from scroll mode too (screen_write_copy)
+- ability to save history (to buffer?)
+- multiple keys could be done with tables, ie have prefixes go and instead
+ bind -n ^A prefix-table "default"
+ where prefix-table sets command lookup table and sets prefix flag, then next key
+ is looked up in that table
+- check fix UTF-8 and split-window? should be okay
+- UTF-8 should be a pointer into a combined string buffer
+- check irssi (term_charset) works with UTF-8
+- rectangle copy/paste
+- half page/up down are missing from key table
+- support esc-esc to quit in modes
119 array.h
@@ -0,0 +1,119 @@
+/* $Id: array.h,v 1.9 2009/11/02 21:34:32 tcunha Exp $ */
+
+/*
+ * Copyright (c) 2006 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef ARRAY_H
+#define ARRAY_H
+
+#define ARRAY_DECL(n, c) \
+ struct n { \
+ c *list; \
+ u_int num; \
+ size_t space; \
+ }
+
+#define ARRAY_ITEM(a, i) ((a)->list[i])
+#define ARRAY_ITEMSIZE(a) (sizeof *(a)->list)
+#define ARRAY_INITIALSPACE(a) (10 * ARRAY_ITEMSIZE(a))
+
+#define ARRAY_ENSURE(a, n) do { \
+ if (UINT_MAX - (n) < (a)->num) \
+ fatalx("number too big"); \
+ if (SIZE_MAX / ((a)->num + (n)) < ARRAY_ITEMSIZE(a)) \
+ fatalx("size too big"); \
+ if ((a)->space == 0) { \
+ (a)->space = ARRAY_INITIALSPACE(a); \
+ (a)->list = xrealloc((a)->list, 1, (a)->space); \
+ } \
+ while ((a)->space <= ((a)->num + (n)) * ARRAY_ITEMSIZE(a)) { \
+ (a)->list = xrealloc((a)->list, 2, (a)->space); \
+ (a)->space *= 2; \
+ } \
+} while (0)
+
+#define ARRAY_EMPTY(a) ((a) == NULL || (a)->num == 0)
+#define ARRAY_LENGTH(a) ((a)->num)
+#define ARRAY_DATA(a) ((a)->list)
+
+#define ARRAY_FIRST(a) ARRAY_ITEM(a, 0)
+#define ARRAY_LAST(a) ARRAY_ITEM(a, (a)->num - 1)
+
+#define ARRAY_INIT(a) do { \
+ (a)->num = 0; \
+ (a)->list = NULL; \
+ (a)->space = 0; \
+} while (0)
+#define ARRAY_CLEAR(a) do { \
+ (a)->num = 0; \
+} while (0)
+
+#define ARRAY_SET(a, i, s) do { \
+ (a)->list[i] = s; \
+} while (0)
+
+#define ARRAY_ADD(a, s) do { \
+ ARRAY_ENSURE(a, 1); \
+ (a)->list[(a)->num] = s; \
+ (a)->num++; \
+} while (0)
+#define ARRAY_INSERT(a, i, s) do { \
+ ARRAY_ENSURE(a, 1); \
+ if ((i) < (a)->num) { \
+ memmove((a)->list + (i) + 1, (a)->list + (i), \
+ ARRAY_ITEMSIZE(a) * ((a)->num - (i))); \
+ } \
+ (a)->list[i] = s; \
+ (a)->num++; \
+} while (0)
+#define ARRAY_REMOVE(a, i) do { \
+ if ((i) < (a)->num - 1) { \
+ memmove((a)->list + (i), (a)->list + (i) + 1, \
+ ARRAY_ITEMSIZE(a) * ((a)->num - (i) - 1)); \
+ } \
+ (a)->num--; \
+ if ((a)->num == 0) \
+ ARRAY_FREE(a); \
+} while (0)
+
+#define ARRAY_EXPAND(a, n) do { \
+ ARRAY_ENSURE(a, n); \
+ (a)->num += n; \
+} while (0)
+#define ARRAY_TRUNC(a, n) do { \
+ if ((a)->num > n) \
+ (a)->num -= n; \
+ else \
+ ARRAY_FREE(a); \
+} while (0)
+
+#define ARRAY_CONCAT(a, b) do { \
+ ARRAY_ENSURE(a, (b)->num); \
+ memcpy((a)->list + (a)->num, (b)->list, (b)->num * ARRAY_ITEMSIZE(a)); \
+ (a)->num += (b)->num; \
+} while (0)
+
+#define ARRAY_FREE(a) do { \
+ if ((a)->list != NULL) \
+ xfree((a)->list); \
+ ARRAY_INIT(a); \
+} while (0)
+#define ARRAY_FREEALL(a) do { \
+ ARRAY_FREE(a); \
+ xfree(a); \
+} while (0)
+
+#endif
93 attributes.c
@@ -0,0 +1,93 @@
+/* $Id: attributes.c,v 1.2 2009/06/25 15:25:45 nicm Exp $ */
+
+/*
+ * Copyright (c) 2009 Joshua Elsasser <josh@elsasser.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include <string.h>
+
+#include "tmux.h"
+
+const char *
+attributes_tostring(u_char ch)
+{
+ static char buf[128];
+
+ if (ch == 0)
+ return ("default");
+
+ buf[0] = '\0';
+ if (ch & GRID_ATTR_BRIGHT)
+ strlcat(buf, "bright,", sizeof (buf));
+ if (ch & GRID_ATTR_DIM)
+ strlcat(buf, "dim,", sizeof (buf));
+ if (ch & GRID_ATTR_UNDERSCORE)
+ strlcat(buf, "underscore,", sizeof (buf));
+ if (ch & GRID_ATTR_BLINK)
+ strlcat(buf, "blink,", sizeof (buf));
+ if (ch & GRID_ATTR_REVERSE)
+ strlcat(buf, "reverse,", sizeof (buf));
+ if (ch & GRID_ATTR_HIDDEN)
+ strlcat(buf, "hidden,", sizeof (buf));
+ if (ch & GRID_ATTR_ITALICS)
+ strlcat(buf, "italics,", sizeof (buf));
+ if (*buf)
+ *(strrchr(buf, ',')) = '\0';
+
+ return (buf);
+}
+
+int
+attributes_fromstring(const char *str)
+{
+ const char delimiters[] = " ,|";
+ u_char ch;
+ size_t end;
+
+ if (*str == '\0' || strcspn(str, delimiters) == 0)
+ return (-1);
+ if (strchr(delimiters, str[strlen(str) - 1]) != NULL)
+ return (-1);
+
+ if (strcasecmp(str, "default") == 0)
+ return (0);
+
+ ch = 0;
+ do {
+ end = strcspn(str, delimiters);
+ if ((end == 6 && strncasecmp(str, "bright", end) == 0) ||
+ (end == 4 && strncasecmp(str, "bold", end) == 0))
+ ch |= GRID_ATTR_BRIGHT;
+ else if (end == 3 && strncasecmp(str, "dim", end) == 0)
+ ch |= GRID_ATTR_DIM;
+ else if (end == 10 && strncasecmp(str, "underscore", end) == 0)
+ ch |= GRID_ATTR_UNDERSCORE;
+ else if (end == 5 && strncasecmp(str, "blink", end) == 0)
+ ch |= GRID_ATTR_BLINK;
+ else if (end == 7 && strncasecmp(str, "reverse", end) == 0)
+ ch |= GRID_ATTR_REVERSE;
+ else if (end == 6 && strncasecmp(str, "hidden", end) == 0)
+ ch |= GRID_ATTR_HIDDEN;
+ else if (end == 7 && strncasecmp(str, "italics", end) == 0)
+ ch |= GRID_ATTR_ITALICS;
+ else
+ return (-1);
+ str += end + strspn(str + end, delimiters);
+ } while (*str != '\0');
+
+ return (ch);
+}
55 buffer-poll.c
@@ -0,0 +1,55 @@
+/* $Id: buffer-poll.c,v 1.18 2009/10/23 17:49:47 tcunha Exp $ */
+
+/*
+ * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include <errno.h>
+#include <unistd.h>
+
+#include "tmux.h"
+
+/* Fill buffers from socket based on poll results. */
+int
+buffer_poll(int fd, int events, struct buffer *in, struct buffer *out)
+{
+ ssize_t n;
+
+ if (events & (POLLERR|POLLNVAL))
+ return (-1);
+ if (in != NULL && events & POLLIN) {
+ buffer_ensure(in, BUFSIZ);
+ n = read(fd, BUFFER_IN(in), BUFFER_FREE(in));
+ if (n == 0)
+ return (-1);
+ if (n == -1) {
+ if (errno != EINTR && errno != EAGAIN)
+ return (-1);
+ } else
+ buffer_add(in, n);
+ } else if (events & POLLHUP)
+ return (-1);
+ if (out != NULL && BUFFER_USED(out) > 0 && events & POLLOUT) {
+ n = write(fd, BUFFER_OUT(out), BUFFER_USED(out));
+ if (n == -1) {
+ if (errno != EINTR && errno != EAGAIN)
+ return (-1);
+ } else
+ buffer_remove(out, n);
+ }
+ return (0);
+}
139 buffer.c
@@ -0,0 +1,139 @@
+/* $Id: buffer.c,v 1.8 2009/08/21 21:09:13 tcunha Exp $ */
+
+/*
+ * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include <string.h>
+
+#include "tmux.h"
+
+/* Create a buffer. */
+struct buffer *
+buffer_create(size_t size)
+{
+ struct buffer *b;
+
+ if (size == 0)
+ fatalx("zero size");
+
+ b = xcalloc(1, sizeof *b);
+
+ b->base = xmalloc(size);
+ b->space = size;
+
+ return (b);
+}
+
+/* Destroy a buffer. */
+void
+buffer_destroy(struct buffer *b)
+{
+ xfree(b->base);
+ xfree(b);
+}
+
+/* Ensure free space for size in buffer. */
+void
+buffer_ensure(struct buffer *b, size_t size)
+{
+ if (size == 0)
+ fatalx("zero size");
+
+ if (BUFFER_FREE(b) >= size)
+ return;
+
+ if (b->off > 0) {
+ if (b->size > 0)
+ memmove(b->base, b->base + b->off, b->size);
+ b->off = 0;
+ }
+
+ if (SIZE_MAX - b->size < size)
+ fatalx("size too big");
+ while (b->space < b->size + size) {
+ b->base = xrealloc(b->base, 2, b->space);
+ b->space *= 2;
+ }
+}
+
+/* Adjust buffer after data appended. */
+void
+buffer_add(struct buffer *b, size_t size)
+{
+ if (size == 0)
+ fatalx("zero size");
+ if (size > b->space - b->size)
+ fatalx("overflow");
+
+ b->size += size;
+}
+
+/* Adjust buffer after data removed. */
+void
+buffer_remove(struct buffer *b, size_t size)
+{
+ if (size == 0)
+ fatalx("zero size");
+ if (size > b->size)
+ fatalx("underflow");
+
+ b->size -= size;
+ b->off += size;
+}
+
+/* Copy data into a buffer. */
+void
+buffer_write(struct buffer *b, const void *data, size_t size)
+{
+ buffer_ensure(b, size);
+ memcpy(BUFFER_IN(b), data, size);
+ buffer_add(b, size);
+}
+
+/* Copy data out of a buffer. */
+void
+buffer_read(struct buffer *b, void *data, size_t size)
+{
+ if (size == 0)
+ fatalx("zero size");
+ if (size > b->size)
+ fatalx("underflow");
+
+ memcpy(data, BUFFER_OUT(b), size);
+ buffer_remove(b, size);
+}
+
+/* Store an 8-bit value. */
+void
+buffer_write8(struct buffer *b, uint8_t n)
+{
+ buffer_ensure(b, 1);
+ BUFFER_IN(b)[0] = n;
+ b->size++;
+}
+
+/* Extract an 8-bit value. */
+uint8_t
+buffer_read8(struct buffer *b)
+{
+ uint8_t n;
+
+ n = BUFFER_OUT(b)[0];
+ buffer_remove(b, 1);
+ return (n);
+}
127 cfg.c
@@ -0,0 +1,127 @@
+/* $Id: cfg.c,v 1.23 2009/10/28 23:12:38 tcunha Exp $ */
+
+/*
+ * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "tmux.h"
+
+/*
+ * Config file parser. Pretty quick and simple, each line is parsed into a
+ * argv array and executed as a command.
+ */
+
+void printflike2 cfg_print(struct cmd_ctx *, const char *, ...);
+void printflike2 cfg_error(struct cmd_ctx *, const char *, ...);
+
+char *cfg_cause;
+
+void printflike2
+cfg_print(unused struct cmd_ctx *ctx, unused const char *fmt, ...)
+{
+}
+
+void printflike2
+cfg_error(unused struct cmd_ctx *ctx, const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ xvasprintf(&cfg_cause, fmt, ap);
+ va_end(ap);
+}
+
+int
+load_cfg(const char *path, struct cmd_ctx *ctxin, char **cause)
+{
+ FILE *f;
+ u_int n;
+ char *buf, *line, *ptr;
+ size_t len;
+ struct cmd_list *cmdlist;
+ struct cmd_ctx ctx;
+
+ if ((f = fopen(path, "rb")) == NULL) {
+ xasprintf(cause, "%s: %s", path, strerror(errno));
+ return (1);
+ }
+ n = 0;
+
+ line = NULL;
+ while ((buf = fgetln(f, &len))) {
+ if (buf[len - 1] == '\n')
+ buf[len - 1] = '\0';
+ else {
+ line = xrealloc(line, 1, len + 1);
+ memcpy(line, buf, len);
+ line[len] = '\0';
+ buf = line;
+ }
+ n++;
+
+ if (cmd_string_parse(buf, &cmdlist, cause) != 0) {
+ if (*cause == NULL)
+ continue;
+ goto error;
+ }
+ if (cmdlist == NULL)
+ continue;
+ cfg_cause = NULL;
+
+ if (ctxin == NULL) {
+ ctx.msgdata = NULL;
+ ctx.curclient = NULL;
+ ctx.cmdclient = NULL;
+ } else {
+ ctx.msgdata = ctxin->msgdata;
+ ctx.curclient = ctxin->curclient;
+ ctx.cmdclient = ctxin->cmdclient;
+ }
+
+ ctx.error = cfg_error;
+ ctx.print = cfg_print;
+ ctx.info = cfg_print;
+
+ cfg_cause = NULL;
+ cmd_list_exec(cmdlist, &ctx);
+ cmd_list_free(cmdlist);
+ if (cfg_cause != NULL) {
+ *cause = cfg_cause;
+ goto error;
+ }
+ }
+ if (line != NULL)
+ xfree(line);
+ fclose(f);
+
+ return (0);
+
+error:
+ if (line != NULL)
+ xfree(line);
+ fclose(f);
+
+ xasprintf(&ptr, "%s: %s at line %u", path, *cause, n);
+ xfree(*cause);
+ *cause = ptr;
+ return (1);
+}
325 client.c
@@ -0,0 +1,325 @@
+/* $Id: client.c,v 1.84 2009/11/02 21:41:16 tcunha Exp $ */
+
+/*
+ * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES