Commit Graph

143 Commits

Author SHA1 Message Date
Nicholas Marriott
76ef8770cd Get rid of the ugly CMD_CHFLAG macro and use a const string (eg "dDU") in the
command entry structs and a couple of functions to check/set the flags.
2009-11-13 19:53:28 +00:00
Tiago Cunha
1b4a76d58f Sync OpenBSD patchset 527:
Only need to chmod +x or -x the socket when a client is created, lost or
attached, rather than every event loop.
2009-11-13 16:51:49 +00:00
Nicholas Marriott
2756437f4b Only need to chmod +x or -x the socket when a client is created, lost or
attached, rather than every event loop.
2009-11-11 08:00:42 +00:00
Tiago Cunha
629afba526 Reduce diff with OpenBSD. 2009-10-12 00:49:06 +00:00
Tiago Cunha
6a1ebb11df Sync OpenBSD patchset 371:
Add "grouped sessions" which have independent name, options, current window and
so on but where the linked windows are synchronized (ie creating, killing
windows and so on are mirrored between the sessions). A grouped session may be
created by passing -t to new-session.

Had this around for a while, tested by a couple of people.
2009-10-11 23:38:16 +00:00
Nicholas Marriott
9dd72b9583 Add "grouped sessions" which have independent name, options, current window and
so on but where the linked windows are synchronized (ie creating, killing
windows and so on are mirrored between the sessions). A grouped session may be
created by passing -t to new-session.

Had this around for a while, tested by a couple of people.
2009-10-10 10:02:48 +00:00
Tiago Cunha
31ccf2f813 Sync OpenBSD patchset 342:
Use KEYC_NONE constant instead of 0 on init.
2009-09-22 14:06:40 +00:00
Nicholas Marriott
6fab9a3e6f Use KEYC_NONE constant instead of 0 on init. 2009-09-21 15:32:06 +00:00
Nicholas Marriott
15b643fc11 Sync from OpenBSD:
==
Rather than constructing an entire termios struct from ttydefaults.h, just let
forkpty do it and then alter the bits that should be changed after fork. A
little neater and more portable.
==

This should fix problems caused by glibc's broken ttydefaults.h file.
2009-09-16 12:36:28 +00:00
Nicholas Marriott
5c60162e3c Rather than constructing an entire termios struct from ttydefaults.h, just let
forkpty do it and then alter the bits that should be changed after fork. A
little neater and more portable.
2009-09-16 12:35:04 +00:00
Tiago Cunha
dbaa28492e Sync OpenBSD patchset 327:
The default terminal size should be 80x24, not 80x25.
2009-09-15 23:52:30 +00:00
Nicholas Marriott
f39865e8e4 The default terminal size should be 80x24, not 80x25. 2009-09-15 07:45:16 +00:00
Tiago Cunha
5fcf7149d4 Always set VERASE to \177. 2009-09-13 20:56:52 +00:00
Tiago Cunha
61990deb36 Sync OpenBSD patchset 323:
tmux always outputs \177 for backspace, so explicitly set VERASE to \177 for
new windows.
2009-09-13 20:30:12 +00:00
Nicholas Marriott
d771614d33 tmux always outputs \177 for backspace, so explicitly set VERASE to \177 for
new windows.
2009-09-12 09:54:34 +00:00
Nicholas Marriott
1a5aba47c7 ttydefchars is a fucking horlicks. Happily we only need it in one file, move it
in there to avoid multiple inclusion issues.

Perhaps it would be better to pass NULL through to forkpty in the default
case...
2009-08-26 09:10:47 +00:00
Tiago Cunha
a3799e0350 Sync OpenBSD patchset 291:
Some code tidying.
2009-08-24 16:31:26 +00:00
Nicholas Marriott
a910b38a35 Some code tidying. 2009-08-23 17:37:48 +00:00
Nicholas Marriott
27c5df22cf Move reading termios settings to before tty_open alters them, and expand the
comment.
2009-08-21 11:38:09 +00:00
Nicholas Marriott
915a1913e1 Move reading termios settings to before tty_open alters them, and expand the
comment.
2009-08-21 11:36:08 +00:00
Nicholas Marriott
f1c982608f VTIME and VMIN are only necessary in noncanonical mode, so Solaris reuses the
VEOF and VEOL indexes for them. ICANON is set by default, so don't bother to
set VTIME and VMIN.
2009-08-20 18:35:53 +00:00
Nicholas Marriott
09cc530299 Solaris and AIX have no ttydefaults.h. 2009-08-20 05:34:58 +00:00
Nicholas Marriott
7c9f827bfe In yet another triumph of stupidity over common sense, the glibc
sys/ttydefaults.h is just a copy of the file from *BSD, taking no account of
the fact that their OWN termios.h uses entirely different indexes into the
array.

I know ttydefaults.h is not meant to be portable, but you'd think it would be
obvious to anyone that no file is better than a broken one...
2009-08-19 15:57:54 +00:00
Nicholas Marriott
2a300c6661 Use cfsetispeed/cfsetospeed to set termios speed members. 2009-08-19 14:32:49 +00:00
Nicholas Marriott
c41aa49059 Use cfsetispeed/cfsetospeed to set termios speed members. 2009-08-19 14:32:15 +00:00
Tiago Cunha
e61ee94e26 Sync OpenBSD patchset 257:
Add a base-index session option to specify the first index checked when looking
for an index for a new window.
2009-08-16 19:16:27 +00:00
Tiago Cunha
64950f4524 Sync OpenBSD patchset 255:
Rather than telling the client to exit in the function when creating a new
session detached, let the caller do it. Allows "tmux new -d \; attach" to work.
2009-08-16 19:07:40 +00:00
Tiago Cunha
8973af82c5 Include unistd.h due to OpenBSD patchset 254. At least on Linux, that's where
_POSIX_VDISABLE is defined.
2009-08-16 19:04:05 +00:00
Tiago Cunha
f415d43c3b Sync OpenBSD patchset 254:
When creating a new session from the command-line where there is an external
terminal, copy the termios(4) special characters and use them for new windows
created in the new session. Suggested by Theo.
2009-08-16 18:59:12 +00:00
Nicholas Marriott
3ad4de6c8c Add a base-index session option to specify the first index checked when looking
for an index for a new window.
2009-08-13 20:11:58 +00:00
Nicholas Marriott
e2ff51f93f Rather than telling the client to exit in the function when creating a new
session detached, let the caller do it. Allows "tmux new -d \; attach" to work.
2009-08-13 19:16:14 +00:00
Nicholas Marriott
52793e7a3f When creating a new session from the command-line where there is an external
terminal, copy the termios(4) special characters and use them for new windows
created in the new session. Suggested by Theo.
2009-08-13 19:03:59 +00:00
Tiago Cunha
29b1b2fb5e Sync OpenBSD patchset 231:
Infrastructure and commands to manage the environment for processes started
within tmux.

There is a global environment, copied from the external environment when the
server is started and each session has an (initially empty) session
environment which overrides it.

New commands set-environment and show-environment manipulate or display the
environments.

A new session option, update-environment, is a space-separated list of
variables which are updated from the external environment into the session
environment every time a new session is created - the default is DISPLAY.
2009-08-09 17:48:55 +00:00
Tiago Cunha
15f6a41a75 Sync OpenBSD patchset 211:
Add a terminal-overrides session option allowing individual terminfo(5) entries
to be overridden. The 88col/256col checks are now moved into the default
setting and out of the code.

Also remove a couple of old workarounds for xterm and rxvt which are no longer
necessary (tmux can emulate them if missing).
2009-08-09 15:26:24 +00:00
Nicholas Marriott
6491274f60 Infrastructure and commands to manage the environment for processes started
within tmux.

There is a global environment, copied from the external environment when the
server is started and each sesssion has an (initially empty) session
environment which overrides it.

New commands set-environment and show-environment manipulate or display the
environments.

A new session option, update-environment, is a space-separated list of
variables which are updated from the external environment into the session
environment every time a new session is created - the default is DISPLAY.
2009-08-08 21:52:43 +00:00
Nicholas Marriott
1673735f02 Add a terminal-overrides session option allowing individual terminfo(5) entries
to be overridden. The 88col/256col checks are now moved into the default
setting and out of the code.

Also remove a couple of old workarounds for xterm and rxvt which are no longer
necessary (tmux can emulate them if missing).
2009-08-03 14:10:54 +00:00
Tiago Cunha
d637cb33da Sync OpenBSD patchset 181:
Make all messages sent between the client and server fixed size.

This is the first of two changes to make the protocol more resilient and less
sensitive to other changes in the code, particularly with commands. The client
now packs argv into a buffer and sends it to the server for parsing, rather
than doing it itself and sending the parsed command data.

As a side-effect this also removes a lot of now-unused command marshalling
code.

Mixing a server without this change and a client with or vice versa will cause
tmux to hang or crash, please ensure that tmux is entirely killed before
upgrading.
2009-07-28 22:12:16 +00:00
Nicholas Marriott
34a82e7629 Make all messages sent between the client and server fixed size.
This is the first of two changes to make the protocol more resilient and less
sensitive to other changes in the code, particularly with commands. The client
now packs argv into a buffer and sends it to the server for parsing, rather
than doing it itself and sending the parsed command data.

As a side-effect this also removes a lot of now-unused command marshalling
code.

Mixing a server without this change and a client with or vice versa will cause
tmux to hang or crash, please ensure that tmux is entirely killed before
upgrading.
2009-07-26 12:58:44 +00:00
Tiago Cunha
1141acfd4c Revert previous per OpenBSD's patchset 170. 2009-07-23 23:35:10 +00:00
Nicholas Marriott
895171478f Revert r1.5, I don't like it, new sessions should start off identically - with
the defaults.
2009-07-23 15:47:56 +00:00
Tiago Cunha
f2451c1e29 Sync OpenBSD patchset 168:
Both of cmdclient and curclient CAN be NULL - if the command is executed from
the configuration file. In this case, attach-session can't do much, and
new-session should just assume -d.
2009-07-23 13:25:27 +00:00
Tiago Cunha
a551ff2b1b Sync OpenBSD patchset 167:
If there is a current session, use its default path and working directory for
the initial window when creating a new session.
2009-07-23 13:19:12 +00:00
Nicholas Marriott
96a7cf1e6a Both of cmdclient and curclient CAN be NULL - if the command is executed from
the configuration file. In this case, attach-session can't do much, and
new-session should just assume -d.
2009-07-23 12:33:48 +00:00
Nicholas Marriott
05b511f96a If there is a current session, use its default path and working directory for
the initial window when creating a new session.
2009-07-22 22:47:43 +00:00
Nicholas Marriott
6bc9ee3420 Tidy up new-session and attach-session and change them to work from inside
tmux, switching the current client to the new or requested session.
2009-07-18 11:06:09 +00:00
Nicholas Marriott
ce53936a2b Tidy up new-session and attach-session and change them to work from inside
tmux, switching the current client to the new or requested session.

Written with Josh Elsasser.
2009-07-17 15:03:11 +00:00
Nicholas Marriott
097b96ea44 Having fixed flags for single-character getopt options is a bit hard to
maintain and is only going to get worse as more are used. So instead, add a new
uint64_t member to cmd_entry which is a bitmask of upper and lowercase options
accepted by the command.

This means new single character options can be used without the need to add it
explicitly to the list.
2009-07-14 06:43:33 +00:00
Nicholas Marriott
5f108d9df6 Having fixed flags for single-character getopt options is a bit hard to
maintain and is only going to get worse as more are used. So instead, add a new
uint64_t member to cmd_entry which is a bitmask of upper and lowercase options
accepted by the command.

This means new single character options can be used without the need to add it
explicitly to the list.
2009-07-13 23:11:35 +00:00
Nicholas Marriott
2ddcb51df3 Fix $Id$. 2009-07-08 18:03:03 +00:00
Nicholas Marriott
86504af149 Rename the global options variables to be shorter and to make session options
clear. No functional change, getting this out of the way to make later options
changes easier.
2009-07-08 18:01:31 +00:00
Nicholas Marriott
923ccfa2e8 Rename the global options variables to be shorter and to make session options
clear. No functional change, getting this out of the way to make later options
changes easier.
2009-07-07 19:49:19 +00:00
Nicholas Marriott
35876eaab9 Import tmux, a terminal multiplexor allowing (among other things) a single
terminal to be switched between several different windows and programs
displayed on one terminal be detached from one terminal and moved to another.

ok deraadt pirofti
2009-06-01 22:58:49 +00:00
Nicholas Marriott
143aa718e5 Space trimmage mega-diff. 2009-05-04 17:58:27 +00:00
Nicholas Marriott
b6450b167b Basic horizontal splitting and layout management. Still some redraw and other
issues - particularly, don't mix with manual pane resizing and be careful when
viewing from multiple clients; 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.
2009-04-01 18:21:42 +00:00
Nicholas Marriott
03d531ebc6 Move sx,sy into tty rather than client. 2009-02-11 17:50:36 +00:00
Nicholas Marriott
4d9af27b0b Better error messages for fork. 2009-01-23 16:59:14 +00:00
Nicholas Marriott
2d15f59859 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).
2009-01-20 19:35:03 +00:00
Nicholas Marriott
93230a64bc Pass return code from _exec; allow command sequences to work from the command line. 2009-01-19 18:23:40 +00:00
Nicholas Marriott
a15f8fc4a6 Support command sequences separated by " ; ". Also clean up command printing. 2009-01-18 14:40:48 +00:00
Nicholas Marriott
e3feb067a5 Server locking. set-password and lock-server commands, plus automatic locking. 2009-01-11 00:48:42 +00:00
Nicholas Marriott
4d71164826 Pick up cwd from environment,. 2009-01-10 19:37:35 +00:00
Nicholas Marriott
5c3d973a4a Import OpenBSD's getopt(3) to workaround broken glibc version. 2008-12-10 20:25:42 +00:00
Nicholas Marriott
df2b3bcf44 Fix stupid GNU getopt behaviour. 2008-09-25 23:28:15 +00:00
Nicholas Marriott
2bd92e5f18 Lose unnecessary flags on context. 2008-06-21 10:19:36 +00:00
Nicholas Marriott
73d1558ed0 status-lines -> status, prefix-key -> prefix 2008-06-19 22:04:02 +00:00
Nicholas Marriott
6c23e89f48 Sort options from Pierre Riteau. 2008-06-18 16:39:15 +00:00
Nicholas Marriott
0b9b873a55 Big reorganisation of command-line syntax. 2008-06-05 21:25:00 +00:00
Nicholas Marriott
ee1a7fded7 Print for the less easy commands. 2008-06-05 17:12:11 +00:00
Nicholas Marriott
642c0b00ab Easy bits of arg printing for list-keys. 2008-06-05 16:35:32 +00:00
Nicholas Marriott
9e6090a7a2 Per-session configuration options. 2008-06-03 21:42:37 +00:00
Nicholas Marriott
f91e7bfd38 If no command is specified, assume new-session. 2008-06-03 05:35:51 +00:00
Nicholas Marriott
95cc21c251 Quick man page update, also fix some usages and get rid of some CMD_KEY checks. 2008-06-02 21:36:51 +00:00
Nicholas Marriott
a26f58c7c3 Last bits of basic configuration file. By default in ~/.tmux.conf or specified with -f. Just a list of tmux commands executed when the server is started and before and any session/window is created. 2008-06-02 21:08:36 +00:00
Nicholas Marriott
c7243b73cb Move -s and -c down a level so handling them is the responsibility of the command (with some helper functions), rather than the top-level. This changes the action command syntax so that -s and -c must be after the command rather than before. 2008-06-02 18:08:17 +00:00
Nicholas Marriott
103748d6ad Major reorganisation of screen handling. 2007-12-06 09:46:23 +00:00
Nicholas Marriott
76c8a590db Big internal reorganisation to move tty control into parent. 2007-11-27 19:23:34 +00:00
Nicholas Marriott
b359f9b594 Add -c option to specify client, and move detach/refresh to client rather than session. 2007-11-16 21:12:31 +00:00
Nicholas Marriott
7e3cc5fd12 Use ctx->client/ctx->session inline instead of temporary variables which were
being reused and causing confusion and problems.
2007-11-13 09:53:47 +00:00
Nicholas Marriott
271023c82f Fill in command list. Fix a couple of usages while doing this. 2007-11-09 16:04:29 +00:00
Nicholas Marriott
4ba3cf60be Reorg window data structures. Add an intermediate data type (struct winlink) to hold index and make sessions hold a RB tree of them rather than a fixed array. 2007-10-26 12:29:07 +00:00
Nicholas Marriott
543e7b0f03 -n is now -s on new-session. 2007-10-19 17:15:29 +00:00
Nicholas Marriott
94f003bbec Refresh session command. 2007-10-19 09:21:26 +00:00
Nicholas Marriott
37f17a7e5b Warn and bork on nested sessions ($TMUX exists). 2007-10-12 14:46:48 +00:00
Nicholas Marriott
26b340964a Lose command index enum in favour of runtime-calculated index. 2007-10-04 22:04:01 +00:00
Nicholas Marriott
75e1e4b91e Lose usage and move it into the struct. 2007-10-04 21:48:11 +00:00
Nicholas Marriott
5c54e0b7fd Don't accept UINT_MAX as size if no clients/sessions. 2007-10-04 20:01:10 +00:00
Nicholas Marriott
1f9a8e70d9 Incomplete resize support. 2007-10-04 19:03:52 +00:00
Maximilian Gass
6a784ba0b0 New sessions can now be given a command for their first window 2007-10-04 13:43:14 +00:00
Nicholas Marriott
7427cbe81e n not s. 2007-10-04 12:27:53 +00:00
Nicholas Marriott
57157a1cde set-option command to set meta. 2007-10-04 10:11:32 +00:00
Nicholas Marriott
815815989a Next/last/previous window, some other tweaks. 2007-10-04 00:02:10 +00:00
Nicholas Marriott
7ba01f6843 New window command. 2007-10-03 23:32:26 +00:00
Nicholas Marriott
df716ecc8f Rewrite command handling to be more generic. Not finished! 2007-10-03 21:31:07 +00:00