2009-08-20 11:51:20 +00:00
|
|
|
/* $Id: tmux.h,v 1.425 2009-08-20 11:51:20 tcunha Exp $ */
|
2007-07-09 19:04:12 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2007-09-20 09:43:33 +00:00
|
|
|
#ifndef TMUX_H
|
|
|
|
#define TMUX_H
|
2007-07-09 19:04:12 +00:00
|
|
|
|
2009-05-13 23:27:00 +00:00
|
|
|
#include "config.h"
|
|
|
|
|
2009-08-14 21:04:04 +00:00
|
|
|
#define PROTOCOL_VERSION 1
|
2008-07-01 19:47:02 +00:00
|
|
|
|
2007-07-09 19:04:12 +00:00
|
|
|
#include <sys/param.h>
|
2008-08-28 17:45:30 +00:00
|
|
|
#include <sys/time.h>
|
2009-08-14 21:04:04 +00:00
|
|
|
#include <sys/uio.h>
|
2007-10-31 14:26:26 +00:00
|
|
|
|
2008-05-31 18:04:57 +00:00
|
|
|
#include <limits.h>
|
2007-10-31 14:26:26 +00:00
|
|
|
#include <signal.h>
|
2007-07-09 19:04:12 +00:00
|
|
|
#include <stdarg.h>
|
2007-10-31 14:26:26 +00:00
|
|
|
#include <stdint.h>
|
2008-06-18 20:11:25 +00:00
|
|
|
#include <stdio.h>
|
2009-01-09 23:57:42 +00:00
|
|
|
#include <termios.h>
|
2007-07-09 19:04:12 +00:00
|
|
|
|
|
|
|
#include "array.h"
|
|
|
|
|
2009-06-25 17:02:59 +00:00
|
|
|
#include "compat.h"
|
|
|
|
|
2009-07-22 16:53:30 +00:00
|
|
|
extern char *__progname;
|
2009-08-09 17:48:55 +00:00
|
|
|
extern char **environ;
|
2007-07-09 19:04:12 +00:00
|
|
|
|
2009-07-14 06:38:14 +00:00
|
|
|
/* Default configuration files. */
|
2008-06-02 18:08:17 +00:00
|
|
|
#define DEFAULT_CFG ".tmux.conf"
|
2009-07-14 06:38:14 +00:00
|
|
|
#define SYSTEM_CFG "/etc/tmux.conf"
|
2008-06-02 18:08:17 +00:00
|
|
|
|
2009-01-06 15:37:15 +00:00
|
|
|
/* Default prompt history length. */
|
|
|
|
#define PROMPT_HISTORY 100
|
|
|
|
|
2009-07-20 15:42:05 +00:00
|
|
|
/*
|
|
|
|
* Minimum layout cell size, NOT including separator line. The scroll region
|
|
|
|
* cannot be one line in height so this must be at least two.
|
|
|
|
*/
|
|
|
|
#define PANE_MINIMUM 2
|
2009-01-14 19:29:32 +00:00
|
|
|
|
2009-01-20 19:35:03 +00:00
|
|
|
/* Automatic name refresh interval, in milliseconds. */
|
2009-02-13 00:43:04 +00:00
|
|
|
#define NAME_INTERVAL 500
|
2009-01-20 19:35:03 +00:00
|
|
|
|
2009-03-02 16:55:23 +00:00
|
|
|
/* Escape timer period, in milliseconds. */
|
|
|
|
#define ESCAPE_PERIOD 250
|
|
|
|
|
2009-05-02 08:34:39 +00:00
|
|
|
/* Maximum poll timeout (when attached). */
|
|
|
|
#define POLL_TIMEOUT 50
|
|
|
|
|
2009-07-28 22:12:16 +00:00
|
|
|
/*
|
|
|
|
* Maximum sizes of strings in message data. Don't forget to bump
|
|
|
|
* PROTOCOL_VERSION if any of these change!
|
|
|
|
*/
|
|
|
|
#define COMMAND_LENGTH 2048 /* packed argv size */
|
|
|
|
#define TERMINAL_LENGTH 128 /* length of TERM environment variable */
|
|
|
|
#define PRINT_LENGTH 512 /* printed error/message size */
|
2009-08-09 17:48:55 +00:00
|
|
|
#define ENVIRON_LENGTH 1024 /* environment variable length */
|
2009-07-28 22:12:16 +00:00
|
|
|
|
2007-07-25 23:13:18 +00:00
|
|
|
/* Fatal errors. */
|
|
|
|
#define fatal(msg) log_fatal("%s: %s", __func__, msg);
|
2007-08-27 11:05:21 +00:00
|
|
|
#define fatalx(msg) log_fatalx("%s: %s", __func__, msg);
|
2007-07-09 19:04:12 +00:00
|
|
|
|
|
|
|
/* Definition to shut gcc up about unused arguments. */
|
|
|
|
#define unused __attribute__ ((unused))
|
|
|
|
|
|
|
|
/* Attribute to make gcc check printf-like arguments. */
|
|
|
|
#define printflike1 __attribute__ ((format (printf, 1, 2)))
|
|
|
|
#define printflike2 __attribute__ ((format (printf, 2, 3)))
|
|
|
|
#define printflike3 __attribute__ ((format (printf, 3, 4)))
|
|
|
|
#define printflike4 __attribute__ ((format (printf, 4, 5)))
|
2009-06-25 15:48:25 +00:00
|
|
|
#define printflike5 __attribute__ ((format (printf, 5, 6)))
|
2007-07-09 19:04:12 +00:00
|
|
|
|
2009-01-07 22:52:33 +00:00
|
|
|
/* Number of items in array. */
|
2009-06-26 15:31:15 +00:00
|
|
|
#ifndef nitems
|
2009-01-26 22:57:20 +00:00
|
|
|
#define nitems(_a) (sizeof((_a)) / sizeof((_a)[0]))
|
2009-06-26 15:31:15 +00:00
|
|
|
#endif
|
2009-01-07 22:52:33 +00:00
|
|
|
|
2007-07-09 19:04:12 +00:00
|
|
|
/* Buffer macros. */
|
|
|
|
#define BUFFER_USED(b) ((b)->size)
|
|
|
|
#define BUFFER_FREE(b) ((b)->space - (b)->off - (b)->size)
|
|
|
|
#define BUFFER_IN(b) ((b)->base + (b)->off + (b)->size)
|
|
|
|
#define BUFFER_OUT(b) ((b)->base + (b)->off)
|
|
|
|
|
|
|
|
/* Buffer structure. */
|
|
|
|
struct buffer {
|
|
|
|
u_char *base; /* buffer start */
|
|
|
|
size_t space; /* total size of buffer */
|
|
|
|
|
|
|
|
size_t size; /* size of data in buffer */
|
|
|
|
size_t off; /* offset of data in buffer */
|
|
|
|
};
|
|
|
|
|
2008-06-04 16:46:23 +00:00
|
|
|
/* Bell option values. */
|
|
|
|
#define BELL_NONE 0
|
|
|
|
#define BELL_ANY 1
|
|
|
|
#define BELL_CURRENT 2
|
|
|
|
|
2007-07-09 19:04:12 +00:00
|
|
|
/* Key codes. ncurses defines KEY_*. Grrr. */
|
2009-07-25 08:52:04 +00:00
|
|
|
#define KEYC_NONE 0xfff
|
|
|
|
/* 0x1000 is base for special keys */
|
|
|
|
#define KEYC_ESCAPE 0x2000
|
|
|
|
#define KEYC_CTRL 0x4000
|
|
|
|
#define KEYC_SHIFT 0x8000
|
|
|
|
#define KEYC_PREFIX 0x10000
|
2009-07-22 16:24:59 +00:00
|
|
|
|
|
|
|
enum key_code {
|
|
|
|
/* Mouse key. */
|
|
|
|
KEYC_MOUSE = 0x1000,
|
|
|
|
|
2009-07-28 22:37:02 +00:00
|
|
|
/* Backspace key. */
|
|
|
|
KEYC_BSPACE,
|
|
|
|
|
2009-07-22 16:24:59 +00:00
|
|
|
/* Function keys. */
|
|
|
|
KEYC_F1,
|
|
|
|
KEYC_F2,
|
|
|
|
KEYC_F3,
|
|
|
|
KEYC_F4,
|
|
|
|
KEYC_F5,
|
|
|
|
KEYC_F6,
|
|
|
|
KEYC_F7,
|
|
|
|
KEYC_F8,
|
|
|
|
KEYC_F9,
|
|
|
|
KEYC_F10,
|
|
|
|
KEYC_F11,
|
|
|
|
KEYC_F12,
|
|
|
|
KEYC_F13,
|
|
|
|
KEYC_F14,
|
|
|
|
KEYC_F15,
|
|
|
|
KEYC_F16,
|
|
|
|
KEYC_F17,
|
|
|
|
KEYC_F18,
|
|
|
|
KEYC_F19,
|
|
|
|
KEYC_F20,
|
|
|
|
KEYC_IC,
|
|
|
|
KEYC_DC,
|
|
|
|
KEYC_HOME,
|
|
|
|
KEYC_END,
|
|
|
|
KEYC_NPAGE,
|
|
|
|
KEYC_PPAGE,
|
|
|
|
KEYC_BTAB,
|
|
|
|
|
|
|
|
/* Arrow keys. */
|
|
|
|
KEYC_UP,
|
|
|
|
KEYC_DOWN,
|
|
|
|
KEYC_LEFT,
|
|
|
|
KEYC_RIGHT,
|
|
|
|
|
|
|
|
/* Numeric keypad. Numbered from top-left, KPY_X. */
|
|
|
|
KEYC_KP0_1,
|
|
|
|
KEYC_KP0_2,
|
|
|
|
KEYC_KP0_3,
|
|
|
|
KEYC_KP1_0,
|
|
|
|
KEYC_KP1_1,
|
|
|
|
KEYC_KP1_2,
|
|
|
|
KEYC_KP1_3,
|
|
|
|
KEYC_KP2_0,
|
|
|
|
KEYC_KP2_1,
|
|
|
|
KEYC_KP2_2,
|
|
|
|
KEYC_KP3_0,
|
|
|
|
KEYC_KP3_1,
|
|
|
|
KEYC_KP3_2,
|
|
|
|
KEYC_KP3_3,
|
|
|
|
KEYC_KP4_0,
|
|
|
|
KEYC_KP4_2,
|
|
|
|
};
|
2008-07-23 23:44:50 +00:00
|
|
|
|
2009-01-09 23:57:42 +00:00
|
|
|
/* Termcap codes. */
|
|
|
|
enum tty_code_code {
|
|
|
|
TTYC_AX = 0,
|
|
|
|
TTYC_ACSC, /* acs_chars, ac */
|
|
|
|
TTYC_BEL, /* bell, bl */
|
|
|
|
TTYC_BLINK, /* enter_blink_mode, mb */
|
|
|
|
TTYC_BOLD, /* enter_bold_mode, md */
|
|
|
|
TTYC_CIVIS, /* cursor_invisible, vi */
|
|
|
|
TTYC_CLEAR, /* clear_screen, cl */
|
|
|
|
TTYC_CNORM, /* cursor_normal, ve */
|
|
|
|
TTYC_COLORS, /* max_colors, Co */
|
|
|
|
TTYC_CSR, /* change_scroll_region, cs */
|
|
|
|
TTYC_CUD, /* parm_down_cursor, DO */
|
|
|
|
TTYC_CUD1, /* cursor_down, do */
|
|
|
|
TTYC_CUP, /* cursor_address, cm */
|
|
|
|
TTYC_DCH, /* parm_dch, DC */
|
|
|
|
TTYC_DCH1, /* delete_character, dc */
|
|
|
|
TTYC_DIM, /* enter_dim_mode, mh */
|
|
|
|
TTYC_DL, /* parm_delete_line, DL */
|
|
|
|
TTYC_DL1, /* delete_line, dl */
|
|
|
|
TTYC_EL, /* clr_eol, ce */
|
|
|
|
TTYC_EL1, /* clr_bol, cb */
|
|
|
|
TTYC_ENACS, /* ena_acs, eA */
|
|
|
|
TTYC_ICH, /* parm_ich, IC */
|
|
|
|
TTYC_ICH1, /* insert_character, ic */
|
|
|
|
TTYC_IL, /* parm_insert_line, IL */
|
|
|
|
TTYC_IL1, /* insert_line, il */
|
|
|
|
TTYC_INVIS, /* enter_secure_mode, mk */
|
|
|
|
TTYC_IS1, /* init_1string, i1 */
|
|
|
|
TTYC_IS2, /* init_2string, i2 */
|
|
|
|
TTYC_IS3, /* init_3string, i3 */
|
2009-01-10 19:35:40 +00:00
|
|
|
TTYC_KCBT, /* key_btab, kB */
|
2009-01-09 23:57:42 +00:00
|
|
|
TTYC_KCUB1, /* key_left, kl */
|
|
|
|
TTYC_KCUD1, /* key_down, kd */
|
|
|
|
TTYC_KCUF1, /* key_right, kr */
|
|
|
|
TTYC_KCUU1, /* key_up, ku */
|
|
|
|
TTYC_KDCH1, /* key_dc, kD */
|
|
|
|
TTYC_KEND, /* key_end, ke */
|
|
|
|
TTYC_KF1, /* key_f1, k1 */
|
|
|
|
TTYC_KF10, /* key_f10, k; */
|
|
|
|
TTYC_KF11, /* key_f11, F1 */
|
2009-03-02 18:05:40 +00:00
|
|
|
TTYC_KF12, /* key_f12, F2 */
|
|
|
|
TTYC_KF13, /* key_f13, F3 */
|
|
|
|
TTYC_KF14, /* key_f14, F4 */
|
|
|
|
TTYC_KF15, /* key_f15, F5 */
|
|
|
|
TTYC_KF16, /* key_f16, F6 */
|
|
|
|
TTYC_KF17, /* key_f17, F7 */
|
|
|
|
TTYC_KF18, /* key_f18, F8 */
|
|
|
|
TTYC_KF19, /* key_f19, F9 */
|
|
|
|
TTYC_KF20, /* key_f20, F10 */
|
2009-01-09 23:57:42 +00:00
|
|
|
TTYC_KF2, /* key_f2, k2 */
|
|
|
|
TTYC_KF3, /* key_f3, k3 */
|
|
|
|
TTYC_KF4, /* key_f4, k4 */
|
|
|
|
TTYC_KF5, /* key_f5, k5 */
|
|
|
|
TTYC_KF6, /* key_f6, k6 */
|
|
|
|
TTYC_KF7, /* key_f7, k7 */
|
|
|
|
TTYC_KF8, /* key_f8, k8 */
|
|
|
|
TTYC_KF9, /* key_f9, k9 */
|
|
|
|
TTYC_KHOME, /* key_home, kh */
|
|
|
|
TTYC_KICH1, /* key_ic, kI */
|
|
|
|
TTYC_KMOUS, /* key_mouse, Km */
|
|
|
|
TTYC_KNP, /* key_npage, kN */
|
|
|
|
TTYC_KPP, /* key_ppage, kP */
|
|
|
|
TTYC_OP, /* orig_pair, op */
|
|
|
|
TTYC_REV, /* enter_reverse_mode, mr */
|
|
|
|
TTYC_RI, /* scroll_reverse, sr */
|
|
|
|
TTYC_RMACS, /* exit_alt_charset_mode */
|
|
|
|
TTYC_RMCUP, /* exit_ca_mode, te */
|
2009-01-10 22:28:40 +00:00
|
|
|
TTYC_RMIR, /* exit_insert_mode, ei */
|
2009-01-09 23:57:42 +00:00
|
|
|
TTYC_RMKX, /* keypad_local, ke */
|
|
|
|
TTYC_SETAB, /* set_a_background, AB */
|
|
|
|
TTYC_SETAF, /* set_a_foreground, AF */
|
|
|
|
TTYC_SGR0, /* exit_attribute_mode, me */
|
|
|
|
TTYC_SMACS, /* enter_alt_charset_mode, as */
|
|
|
|
TTYC_SMCUP, /* enter_ca_mode, ti */
|
2009-01-10 22:28:40 +00:00
|
|
|
TTYC_SMIR, /* enter_insert_mode, im */
|
2009-01-09 23:57:42 +00:00
|
|
|
TTYC_SMKX, /* keypad_xmit, ks */
|
|
|
|
TTYC_SMSO, /* enter_standout_mode, so */
|
|
|
|
TTYC_SMUL, /* enter_underline_mode, us */
|
2009-04-23 21:09:17 +00:00
|
|
|
TTYC_XENL, /* eat_newline_glitch, xn */
|
2009-01-09 23:57:42 +00:00
|
|
|
};
|
2009-04-23 21:09:17 +00:00
|
|
|
#define NTTYCODE (TTYC_XENL + 1)
|
2009-01-09 23:57:42 +00:00
|
|
|
|
|
|
|
/* Termcap types. */
|
|
|
|
enum tty_code_type {
|
|
|
|
TTYCODE_NONE = 0,
|
|
|
|
TTYCODE_STRING,
|
|
|
|
TTYCODE_NUMBER,
|
|
|
|
TTYCODE_FLAG,
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Termcap code. */
|
|
|
|
struct tty_code {
|
|
|
|
enum tty_code_type type;
|
|
|
|
union {
|
|
|
|
char *string;
|
|
|
|
int number;
|
|
|
|
int flag;
|
|
|
|
} value;
|
|
|
|
};
|
2009-01-10 01:30:38 +00:00
|
|
|
|
|
|
|
/* Entry in terminal code table. */
|
|
|
|
struct tty_term_code_entry {
|
|
|
|
enum tty_code_code code;
|
|
|
|
enum tty_code_type type;
|
|
|
|
const char *name;
|
|
|
|
};
|
|
|
|
|
2007-07-09 19:04:12 +00:00
|
|
|
/* Message codes. */
|
2009-07-30 20:21:55 +00:00
|
|
|
enum msgtype {
|
2007-10-03 21:31:07 +00:00
|
|
|
MSG_COMMAND,
|
2009-01-11 00:48:42 +00:00
|
|
|
MSG_DETACH,
|
2007-09-26 18:50:49 +00:00
|
|
|
MSG_ERROR,
|
2007-08-27 13:45:26 +00:00
|
|
|
MSG_EXIT,
|
2007-11-27 20:01:30 +00:00
|
|
|
MSG_EXITED,
|
2009-01-11 00:48:42 +00:00
|
|
|
MSG_EXITING,
|
2007-10-03 21:31:07 +00:00
|
|
|
MSG_IDENTIFY,
|
2009-01-11 00:48:42 +00:00
|
|
|
MSG_PRINT,
|
2007-10-03 21:31:07 +00:00
|
|
|
MSG_READY,
|
|
|
|
MSG_RESIZE,
|
2009-01-21 22:47:31 +00:00
|
|
|
MSG_SHUTDOWN,
|
2009-01-18 12:09:42 +00:00
|
|
|
MSG_SUSPEND,
|
2009-01-21 22:47:31 +00:00
|
|
|
MSG_UNLOCK,
|
2009-08-14 21:04:04 +00:00
|
|
|
MSG_VERSION,
|
2009-01-18 12:09:42 +00:00
|
|
|
MSG_WAKEUP,
|
2009-08-09 17:48:55 +00:00
|
|
|
MSG_ENVIRON
|
2007-08-27 13:45:26 +00:00
|
|
|
};
|
|
|
|
|
2009-07-28 22:12:16 +00:00
|
|
|
/*
|
2009-08-14 21:04:04 +00:00
|
|
|
* Message data.
|
2009-07-28 22:12:16 +00:00
|
|
|
*
|
|
|
|
* Don't forget to bump PROTOCOL_VERSION if any of these change!
|
|
|
|
*/
|
|
|
|
struct msg_print_data {
|
|
|
|
char msg[PRINT_LENGTH];
|
|
|
|
};
|
|
|
|
|
2007-10-03 21:31:07 +00:00
|
|
|
struct msg_command_data {
|
2008-07-01 20:35:16 +00:00
|
|
|
pid_t pid; /* pid from $TMUX or -1 */
|
2007-10-23 10:48:23 +00:00
|
|
|
u_int idx; /* index from $TMUX */
|
|
|
|
|
2009-07-28 22:12:16 +00:00
|
|
|
int argc;
|
|
|
|
char argv[COMMAND_LENGTH];
|
2007-07-09 19:04:12 +00:00
|
|
|
};
|
|
|
|
|
2007-10-03 21:31:07 +00:00
|
|
|
struct msg_identify_data {
|
2007-10-23 09:36:19 +00:00
|
|
|
char tty[TTY_NAME_MAX];
|
|
|
|
|
2009-01-10 19:37:35 +00:00
|
|
|
char cwd[MAXPATHLEN];
|
|
|
|
|
2009-07-28 22:12:16 +00:00
|
|
|
char term[TERMINAL_LENGTH];
|
|
|
|
|
2008-09-09 22:16:37 +00:00
|
|
|
#define IDENTIFY_UTF8 0x1
|
2008-09-25 20:08:57 +00:00
|
|
|
#define IDENTIFY_256COLOURS 0x2
|
2009-03-07 10:29:06 +00:00
|
|
|
#define IDENTIFY_88COLOURS 0x4
|
|
|
|
#define IDENTIFY_HASDEFAULTS 0x8
|
2008-09-09 22:16:37 +00:00
|
|
|
int flags;
|
|
|
|
|
2007-09-27 09:52:03 +00:00
|
|
|
u_int sx;
|
|
|
|
u_int sy;
|
2007-07-09 19:04:12 +00:00
|
|
|
};
|
|
|
|
|
2007-10-03 21:31:07 +00:00
|
|
|
struct msg_resize_data {
|
|
|
|
u_int sx;
|
|
|
|
u_int sy;
|
2007-10-03 11:26:34 +00:00
|
|
|
};
|
|
|
|
|
2009-07-28 22:12:16 +00:00
|
|
|
struct msg_unlock_data {
|
|
|
|
char pass[PASS_MAX];
|
|
|
|
};
|
|
|
|
|
2009-08-09 17:48:55 +00:00
|
|
|
struct msg_environ_data {
|
|
|
|
char var[ENVIRON_LENGTH];
|
|
|
|
};
|
|
|
|
|
2009-07-28 23:11:18 +00:00
|
|
|
/* Mode key commands. */
|
2009-02-13 21:39:45 +00:00
|
|
|
enum mode_key_cmd {
|
2009-07-28 22:55:59 +00:00
|
|
|
MODEKEY_NONE,
|
|
|
|
MODEKEY_OTHER,
|
|
|
|
|
|
|
|
/* Editing keys. */
|
|
|
|
MODEKEYEDIT_BACKSPACE,
|
|
|
|
MODEKEYEDIT_CANCEL,
|
|
|
|
MODEKEYEDIT_COMPLETE,
|
|
|
|
MODEKEYEDIT_CURSORLEFT,
|
|
|
|
MODEKEYEDIT_CURSORRIGHT,
|
|
|
|
MODEKEYEDIT_DELETE,
|
2009-08-20 11:22:48 +00:00
|
|
|
MODEKEYEDIT_DELETELINE,
|
2009-07-28 22:55:59 +00:00
|
|
|
MODEKEYEDIT_DELETETOENDOFLINE,
|
|
|
|
MODEKEYEDIT_ENDOFLINE,
|
|
|
|
MODEKEYEDIT_ENTER,
|
|
|
|
MODEKEYEDIT_HISTORYDOWN,
|
|
|
|
MODEKEYEDIT_HISTORYUP,
|
|
|
|
MODEKEYEDIT_PASTE,
|
|
|
|
MODEKEYEDIT_STARTOFLINE,
|
|
|
|
MODEKEYEDIT_SWITCHMODE,
|
|
|
|
MODEKEYEDIT_SWITCHMODEAPPEND,
|
|
|
|
|
|
|
|
/* Menu (choice) keys. */
|
|
|
|
MODEKEYCHOICE_CANCEL,
|
|
|
|
MODEKEYCHOICE_CHOOSE,
|
|
|
|
MODEKEYCHOICE_DOWN,
|
|
|
|
MODEKEYCHOICE_PAGEDOWN,
|
|
|
|
MODEKEYCHOICE_PAGEUP,
|
|
|
|
MODEKEYCHOICE_UP,
|
|
|
|
|
|
|
|
/* Copy keys. */
|
|
|
|
MODEKEYCOPY_BACKTOINDENTATION,
|
2009-08-16 19:26:49 +00:00
|
|
|
MODEKEYCOPY_CANCEL,
|
2009-07-28 22:55:59 +00:00
|
|
|
MODEKEYCOPY_CLEARSELECTION,
|
|
|
|
MODEKEYCOPY_COPYSELECTION,
|
|
|
|
MODEKEYCOPY_DOWN,
|
|
|
|
MODEKEYCOPY_ENDOFLINE,
|
2009-08-20 11:20:24 +00:00
|
|
|
MODEKEYCOPY_GOTOLINE,
|
2009-08-16 19:26:49 +00:00
|
|
|
MODEKEYCOPY_HALFPAGEDOWN,
|
|
|
|
MODEKEYCOPY_HALFPAGEUP,
|
2009-07-28 22:55:59 +00:00
|
|
|
MODEKEYCOPY_LEFT,
|
|
|
|
MODEKEYCOPY_NEXTPAGE,
|
|
|
|
MODEKEYCOPY_NEXTWORD,
|
|
|
|
MODEKEYCOPY_PREVIOUSPAGE,
|
|
|
|
MODEKEYCOPY_PREVIOUSWORD,
|
|
|
|
MODEKEYCOPY_RIGHT,
|
2009-08-20 11:20:24 +00:00
|
|
|
MODEKEYCOPY_SEARCHAGAIN,
|
|
|
|
MODEKEYCOPY_SEARCHDOWN,
|
|
|
|
MODEKEYCOPY_SEARCHUP,
|
2009-07-28 22:55:59 +00:00
|
|
|
MODEKEYCOPY_STARTOFLINE,
|
|
|
|
MODEKEYCOPY_STARTSELECTION,
|
|
|
|
MODEKEYCOPY_UP,
|
2009-02-13 21:39:45 +00:00
|
|
|
};
|
|
|
|
|
2009-07-28 23:11:18 +00:00
|
|
|
/* Entry in the default mode key tables. */
|
2009-07-28 22:55:59 +00:00
|
|
|
struct mode_key_entry {
|
|
|
|
int key;
|
2009-02-13 21:39:45 +00:00
|
|
|
|
2009-07-28 22:55:59 +00:00
|
|
|
/*
|
|
|
|
* Editing mode for vi: 0 is edit mode, keys not in the table are
|
|
|
|
* returned as MODEKEY_OTHER; 1 is command mode, keys not in the table
|
|
|
|
* are returned as MODEKEY_NONE. This is also matched on, allowing some
|
|
|
|
* keys to be bound in edit mode.
|
|
|
|
*/
|
|
|
|
int mode;
|
|
|
|
enum mode_key_cmd cmd;
|
|
|
|
};
|
2009-07-28 23:11:18 +00:00
|
|
|
|
|
|
|
/* Data required while mode keys are in use. */
|
2009-07-28 22:55:59 +00:00
|
|
|
struct mode_key_data {
|
2009-07-28 23:11:18 +00:00
|
|
|
struct mode_key_tree *tree;
|
|
|
|
int mode;
|
2009-07-28 22:55:59 +00:00
|
|
|
};
|
2009-02-13 21:39:45 +00:00
|
|
|
#define MODEKEY_EMACS 0
|
|
|
|
#define MODEKEY_VI 1
|
|
|
|
|
2009-07-28 23:11:18 +00:00
|
|
|
/* Binding between a key and a command. */
|
|
|
|
struct mode_key_binding {
|
|
|
|
int key;
|
|
|
|
|
|
|
|
int mode;
|
|
|
|
enum mode_key_cmd cmd;
|
|
|
|
|
|
|
|
SPLAY_ENTRY(mode_key_binding) entry;
|
|
|
|
};
|
|
|
|
SPLAY_HEAD(mode_key_tree, mode_key_binding);
|
|
|
|
|
|
|
|
/* Command to string mapping. */
|
|
|
|
struct mode_key_cmdstr {
|
|
|
|
enum mode_key_cmd cmd;
|
|
|
|
const char *name;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Named mode key table description. */
|
|
|
|
struct mode_key_table {
|
|
|
|
const char *name;
|
|
|
|
struct mode_key_cmdstr *cmdstr;
|
|
|
|
struct mode_key_tree *tree;
|
|
|
|
const struct mode_key_entry *table; /* default entries */
|
|
|
|
};
|
|
|
|
|
2007-07-09 19:04:12 +00:00
|
|
|
/* Modes. */
|
2008-09-08 22:18:03 +00:00
|
|
|
#define MODE_CURSOR 0x1
|
|
|
|
#define MODE_INSERT 0x2
|
|
|
|
#define MODE_KCURSOR 0x4
|
|
|
|
#define MODE_KKEYPAD 0x8
|
2008-09-25 20:08:57 +00:00
|
|
|
#define MODE_MOUSE 0x10
|
|
|
|
|
|
|
|
/* Grid output. */
|
2009-04-27 14:51:59 +00:00
|
|
|
#if defined(DEBUG) && \
|
|
|
|
((defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
|
|
|
|
(defined(__GNUC__) && __GNUC__ >= 3))
|
2009-07-22 17:33:02 +00:00
|
|
|
#define GRID_DEBUG(gd, fmt, ...) log_debug2("%s: (sx=%u, sy=%u, hsize=%u) " \
|
2008-09-25 20:08:57 +00:00
|
|
|
fmt, __func__, (gd)->sx, (gd)->sy, (gd)->hsize, ## __VA_ARGS__)
|
2008-11-23 19:38:12 +00:00
|
|
|
#else
|
|
|
|
#define GRID_DEBUG(...)
|
|
|
|
#endif
|
2008-09-25 20:08:57 +00:00
|
|
|
|
|
|
|
/* Grid attributes. */
|
|
|
|
#define GRID_ATTR_BRIGHT 0x1
|
|
|
|
#define GRID_ATTR_DIM 0x2
|
|
|
|
#define GRID_ATTR_UNDERSCORE 0x4
|
|
|
|
#define GRID_ATTR_BLINK 0x8
|
|
|
|
#define GRID_ATTR_REVERSE 0x10
|
|
|
|
#define GRID_ATTR_HIDDEN 0x20
|
|
|
|
#define GRID_ATTR_ITALICS 0x40
|
|
|
|
#define GRID_ATTR_CHARSET 0x80 /* alternative character set */
|
|
|
|
|
|
|
|
/* Grid flags. */
|
|
|
|
#define GRID_FLAG_FG256 0x1
|
|
|
|
#define GRID_FLAG_BG256 0x2
|
|
|
|
#define GRID_FLAG_PADDING 0x4
|
2009-01-18 21:46:30 +00:00
|
|
|
#define GRID_FLAG_UTF8 0x8
|
2008-09-25 20:08:57 +00:00
|
|
|
|
2009-08-09 17:32:06 +00:00
|
|
|
/* Grid line flags. */
|
|
|
|
#define GRID_LINE_WRAPPED 0x1
|
|
|
|
|
2009-03-28 20:17:29 +00:00
|
|
|
/* Grid cell data. */
|
2008-09-25 20:08:57 +00:00
|
|
|
struct grid_cell {
|
|
|
|
u_char attr;
|
|
|
|
u_char flags;
|
|
|
|
u_char fg;
|
|
|
|
u_char bg;
|
2009-03-28 20:17:29 +00:00
|
|
|
u_char data;
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
/* Grid cell UTF-8 data. Used instead of data in grid_cell for UTF-8 cells. */
|
2009-03-29 11:18:28 +00:00
|
|
|
#define UTF8_SIZE 8
|
2009-03-28 20:17:29 +00:00
|
|
|
struct grid_utf8 {
|
|
|
|
u_char width;
|
2009-03-29 11:18:28 +00:00
|
|
|
u_char data[UTF8_SIZE];
|
2008-09-25 20:08:57 +00:00
|
|
|
} __packed;
|
2008-09-26 06:45:28 +00:00
|
|
|
|
2009-08-09 17:28:24 +00:00
|
|
|
/* Grid line. */
|
|
|
|
struct grid_line {
|
|
|
|
u_int cellsize;
|
|
|
|
struct grid_cell *celldata;
|
|
|
|
|
|
|
|
u_int utf8size;
|
|
|
|
struct grid_utf8 *utf8data;
|
2009-08-09 17:32:06 +00:00
|
|
|
|
|
|
|
int flags;
|
2009-08-09 17:28:24 +00:00
|
|
|
} __packed;
|
|
|
|
|
2009-03-28 16:30:05 +00:00
|
|
|
/* Entire grid of cells. */
|
2009-03-28 15:43:41 +00:00
|
|
|
struct grid {
|
2009-07-14 06:40:33 +00:00
|
|
|
int flags;
|
|
|
|
#define GRID_HISTORY 0x1 /* scroll lines into history */
|
|
|
|
|
2008-09-25 20:08:57 +00:00
|
|
|
u_int sx;
|
|
|
|
u_int sy;
|
2008-09-26 06:45:28 +00:00
|
|
|
|
2008-09-25 20:08:57 +00:00
|
|
|
u_int hsize;
|
|
|
|
u_int hlimit;
|
|
|
|
|
2009-08-09 17:28:24 +00:00
|
|
|
struct grid_line *linedata;
|
2008-09-25 20:08:57 +00:00
|
|
|
};
|
2007-12-06 09:46:23 +00:00
|
|
|
|
2008-12-08 16:19:51 +00:00
|
|
|
/* Option data structures. */
|
|
|
|
struct options_entry {
|
|
|
|
char *name;
|
|
|
|
|
|
|
|
enum {
|
|
|
|
OPTIONS_STRING,
|
|
|
|
OPTIONS_NUMBER,
|
|
|
|
OPTIONS_KEY,
|
|
|
|
} type;
|
|
|
|
union {
|
|
|
|
char *string;
|
|
|
|
long long number;
|
|
|
|
int key;
|
|
|
|
} value;
|
|
|
|
|
|
|
|
SPLAY_ENTRY(options_entry) entry;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct options {
|
|
|
|
SPLAY_HEAD(options_tree, options_entry) tree;
|
|
|
|
struct options *parent;
|
|
|
|
};
|
|
|
|
|
2007-12-06 09:46:23 +00:00
|
|
|
/* Screen selection. */
|
|
|
|
struct screen_sel {
|
|
|
|
int flag;
|
2007-07-09 19:04:12 +00:00
|
|
|
|
2007-12-06 09:46:23 +00:00
|
|
|
u_int sx;
|
|
|
|
u_int sy;
|
|
|
|
|
|
|
|
u_int ex;
|
|
|
|
u_int ey;
|
2008-12-08 16:19:51 +00:00
|
|
|
|
|
|
|
struct grid_cell cell;
|
2007-12-06 09:46:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Virtual screen. */
|
2007-07-09 19:04:12 +00:00
|
|
|
struct screen {
|
2007-11-30 11:08:35 +00:00
|
|
|
char *title;
|
2007-07-09 19:04:12 +00:00
|
|
|
|
2009-03-28 15:43:41 +00:00
|
|
|
struct grid *grid; /* grid data */
|
2007-10-26 17:15:50 +00:00
|
|
|
|
|
|
|
u_int cx; /* cursor x */
|
|
|
|
u_int cy; /* cursor y */
|
2008-09-09 22:16:37 +00:00
|
|
|
|
2008-09-25 20:08:57 +00:00
|
|
|
u_int rupper; /* scroll region top */
|
|
|
|
u_int rlower; /* scroll region bottom */
|
2007-11-22 19:17:01 +00:00
|
|
|
|
2007-12-06 09:46:23 +00:00
|
|
|
int mode;
|
2007-11-22 19:17:01 +00:00
|
|
|
|
2009-06-25 15:54:38 +00:00
|
|
|
bitstr_t *tabs;
|
|
|
|
|
2007-12-06 09:46:23 +00:00
|
|
|
struct screen_sel sel;
|
2007-11-22 19:17:01 +00:00
|
|
|
};
|
|
|
|
|
2007-12-06 09:46:23 +00:00
|
|
|
/* Screen write context. */
|
|
|
|
struct screen_write_ctx {
|
2009-02-11 06:31:09 +00:00
|
|
|
struct window_pane *wp;
|
2007-12-06 09:46:23 +00:00
|
|
|
struct screen *s;
|
2007-11-21 18:24:49 +00:00
|
|
|
};
|
|
|
|
|
2008-09-25 20:08:57 +00:00
|
|
|
/* Screen size. */
|
|
|
|
#define screen_size_x(s) ((s)->grid->sx)
|
|
|
|
#define screen_size_y(s) ((s)->grid->sy)
|
|
|
|
#define screen_hsize(s) ((s)->grid->hsize)
|
|
|
|
#define screen_hlimit(s) ((s)->grid->hlimit)
|
2007-12-06 10:36:01 +00:00
|
|
|
|
2007-09-28 22:47:22 +00:00
|
|
|
/* Input parser sequence argument. */
|
|
|
|
struct input_arg {
|
2007-09-29 14:25:49 +00:00
|
|
|
u_char data[64];
|
|
|
|
size_t used;
|
2007-09-28 22:47:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Input parser context. */
|
|
|
|
struct input_ctx {
|
2009-01-11 23:31:46 +00:00
|
|
|
struct window_pane *wp;
|
2007-12-06 09:46:23 +00:00
|
|
|
struct screen_write_ctx ctx;
|
2007-10-24 15:29:29 +00:00
|
|
|
|
2007-09-28 22:47:22 +00:00
|
|
|
u_char *buf;
|
|
|
|
size_t len;
|
|
|
|
size_t off;
|
2009-08-20 11:48:01 +00:00
|
|
|
size_t was;
|
2007-09-28 22:47:22 +00:00
|
|
|
|
2009-03-28 16:30:05 +00:00
|
|
|
struct grid_cell cell;
|
2009-05-04 17:58:27 +00:00
|
|
|
|
2008-09-25 20:08:57 +00:00
|
|
|
struct grid_cell saved_cell;
|
|
|
|
u_int saved_cx;
|
|
|
|
u_int saved_cy;
|
|
|
|
|
2007-11-30 11:08:35 +00:00
|
|
|
#define MAXSTRINGLEN 1024
|
|
|
|
u_char *string_buf;
|
|
|
|
size_t string_len;
|
|
|
|
int string_type;
|
2008-10-09 21:22:16 +00:00
|
|
|
#define STRING_SYSTEM 0
|
|
|
|
#define STRING_APPLICATION 1
|
|
|
|
#define STRING_NAME 2
|
2007-10-01 17:37:41 +00:00
|
|
|
|
2008-09-25 20:08:57 +00:00
|
|
|
u_char utf8_buf[4];
|
2008-09-09 22:16:37 +00:00
|
|
|
u_int utf8_len;
|
|
|
|
u_int utf8_off;
|
|
|
|
|
2008-11-04 20:41:10 +00:00
|
|
|
u_char intermediate;
|
2007-10-10 19:45:20 +00:00
|
|
|
void *(*state)(u_char, struct input_ctx *);
|
2007-09-28 22:47:22 +00:00
|
|
|
|
|
|
|
u_char private;
|
|
|
|
ARRAY_DECL(, struct input_arg) args;
|
|
|
|
};
|
|
|
|
|
2007-11-21 13:11:41 +00:00
|
|
|
/*
|
|
|
|
* Window mode. Windows can be in several modes and this is used to call the
|
|
|
|
* right function to handle input and output.
|
|
|
|
*/
|
2008-06-20 17:31:48 +00:00
|
|
|
struct client;
|
2009-01-11 23:31:46 +00:00
|
|
|
struct window;
|
2007-11-21 13:11:41 +00:00
|
|
|
struct window_mode {
|
2009-01-11 23:31:46 +00:00
|
|
|
struct screen *(*init)(struct window_pane *);
|
|
|
|
void (*free)(struct window_pane *);
|
|
|
|
void (*resize)(struct window_pane *, u_int, u_int);
|
|
|
|
void (*key)(struct window_pane *, struct client *, int);
|
2009-01-28 19:52:21 +00:00
|
|
|
void (*mouse)(struct window_pane *,
|
|
|
|
struct client *, u_char, u_char, u_char);
|
2009-01-11 23:31:46 +00:00
|
|
|
void (*timer)(struct window_pane *);
|
2007-11-21 13:11:41 +00:00
|
|
|
};
|
|
|
|
|
2009-01-11 23:31:46 +00:00
|
|
|
/* Child window structure. */
|
|
|
|
struct window_pane {
|
|
|
|
struct window *window;
|
2009-07-20 15:42:05 +00:00
|
|
|
struct layout_cell *layout_cell;
|
2009-01-12 18:22:47 +00:00
|
|
|
|
|
|
|
u_int sx;
|
|
|
|
u_int sy;
|
|
|
|
|
2009-04-01 18:21:42 +00:00
|
|
|
u_int xoff;
|
2009-01-12 18:22:47 +00:00
|
|
|
u_int yoff;
|
2009-01-14 19:29:32 +00:00
|
|
|
|
|
|
|
int flags;
|
2009-07-15 17:42:44 +00:00
|
|
|
#define PANE_REDRAW 0x1
|
2009-05-04 17:58:27 +00:00
|
|
|
|
2008-06-29 07:04:31 +00:00
|
|
|
char *cmd;
|
2009-01-10 19:37:35 +00:00
|
|
|
char *cwd;
|
2007-07-09 19:04:12 +00:00
|
|
|
|
2009-02-08 16:11:26 +00:00
|
|
|
pid_t pid;
|
2007-07-09 19:04:12 +00:00
|
|
|
int fd;
|
2009-01-26 22:57:20 +00:00
|
|
|
char tty[TTY_NAME_MAX];
|
2007-07-09 19:04:12 +00:00
|
|
|
struct buffer *in;
|
|
|
|
struct buffer *out;
|
|
|
|
|
2007-09-28 22:47:22 +00:00
|
|
|
struct input_ctx ictx;
|
|
|
|
|
2009-01-11 23:31:46 +00:00
|
|
|
struct screen *screen;
|
|
|
|
struct screen base;
|
|
|
|
|
2009-07-14 06:40:33 +00:00
|
|
|
/* Saved in alternative screen mode. */
|
|
|
|
u_int saved_cx;
|
|
|
|
u_int saved_cy;
|
|
|
|
struct grid *saved_grid;
|
2009-08-09 16:57:49 +00:00
|
|
|
struct grid_cell saved_cell;
|
2009-07-14 06:40:33 +00:00
|
|
|
|
2009-01-11 23:31:46 +00:00
|
|
|
const struct window_mode *mode;
|
|
|
|
void *modedata;
|
2009-01-14 19:29:32 +00:00
|
|
|
|
|
|
|
TAILQ_ENTRY(window_pane) entry;
|
2009-01-11 23:31:46 +00:00
|
|
|
};
|
2009-01-14 19:29:32 +00:00
|
|
|
TAILQ_HEAD(window_panes, window_pane);
|
2009-01-11 23:31:46 +00:00
|
|
|
|
|
|
|
/* Window structure. */
|
|
|
|
struct window {
|
|
|
|
char *name;
|
2009-01-20 19:35:03 +00:00
|
|
|
struct timeval name_timer;
|
2009-01-11 23:31:46 +00:00
|
|
|
|
2009-05-04 17:58:27 +00:00
|
|
|
struct window_pane *active;
|
2009-01-14 19:29:32 +00:00
|
|
|
struct window_panes panes;
|
2009-07-20 15:42:05 +00:00
|
|
|
|
2009-07-28 23:04:29 +00:00
|
|
|
int lastlayout;
|
2009-07-20 15:42:05 +00:00
|
|
|
struct layout_cell *layout_root;
|
2009-01-11 23:31:46 +00:00
|
|
|
|
|
|
|
u_int sx;
|
|
|
|
u_int sy;
|
2009-05-04 17:58:27 +00:00
|
|
|
|
2007-09-29 09:15:49 +00:00
|
|
|
int flags;
|
|
|
|
#define WINDOW_BELL 0x1
|
2007-12-06 09:46:23 +00:00
|
|
|
#define WINDOW_HIDDEN 0x2
|
2008-06-04 16:46:23 +00:00
|
|
|
#define WINDOW_ACTIVITY 0x4
|
2009-07-19 14:35:56 +00:00
|
|
|
#define WINDOW_CONTENT 0x8
|
|
|
|
#define WINDOW_REDRAW 0x10
|
2008-06-14 16:47:20 +00:00
|
|
|
|
2009-01-11 23:31:46 +00:00
|
|
|
struct options options;
|
2007-10-26 12:29:07 +00:00
|
|
|
|
|
|
|
u_int references;
|
2007-07-09 19:04:12 +00:00
|
|
|
};
|
|
|
|
ARRAY_DECL(windows, struct window *);
|
|
|
|
|
2007-10-26 12:29:07 +00:00
|
|
|
/* Entry on local window list. */
|
|
|
|
struct winlink {
|
|
|
|
int idx;
|
|
|
|
struct window *window;
|
|
|
|
|
|
|
|
RB_ENTRY(winlink) entry;
|
2008-11-16 10:10:26 +00:00
|
|
|
SLIST_ENTRY(winlink) sentry;
|
2007-10-26 12:29:07 +00:00
|
|
|
};
|
|
|
|
RB_HEAD(winlinks, winlink);
|
2008-11-16 10:10:26 +00:00
|
|
|
SLIST_HEAD(winlink_stack, winlink);
|
2007-10-26 12:29:07 +00:00
|
|
|
|
2009-07-20 15:42:05 +00:00
|
|
|
/* Layout direction. */
|
|
|
|
enum layout_type {
|
|
|
|
LAYOUT_LEFTRIGHT,
|
|
|
|
LAYOUT_TOPBOTTOM,
|
|
|
|
LAYOUT_WINDOWPANE
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Layout cells queue. */
|
|
|
|
TAILQ_HEAD(layout_cells, layout_cell);
|
|
|
|
|
|
|
|
/* Layout cell. */
|
|
|
|
struct layout_cell {
|
|
|
|
enum layout_type type;
|
|
|
|
|
|
|
|
struct layout_cell *parent;
|
|
|
|
|
|
|
|
u_int sx;
|
|
|
|
u_int sy;
|
|
|
|
|
|
|
|
u_int xoff;
|
|
|
|
u_int yoff;
|
|
|
|
|
|
|
|
struct window_pane *wp;
|
|
|
|
struct layout_cells cells;
|
|
|
|
|
|
|
|
TAILQ_ENTRY(layout_cell) entry;
|
|
|
|
};
|
|
|
|
|
2008-06-20 08:36:20 +00:00
|
|
|
/* Paste buffer. */
|
|
|
|
struct paste_buffer {
|
|
|
|
char *data;
|
2008-08-28 17:45:30 +00:00
|
|
|
struct timeval tv;
|
2008-06-20 08:36:20 +00:00
|
|
|
};
|
|
|
|
ARRAY_DECL(paste_stack, struct paste_buffer *);
|
|
|
|
|
2009-08-09 17:48:55 +00:00
|
|
|
/* Environment variable. */
|
|
|
|
struct environ_entry {
|
|
|
|
char *name;
|
|
|
|
char *value;
|
|
|
|
|
|
|
|
RB_ENTRY(environ_entry) entry;
|
|
|
|
};
|
|
|
|
RB_HEAD(environ, environ_entry);
|
|
|
|
|
2007-07-09 19:04:12 +00:00
|
|
|
/* Client session. */
|
2008-06-04 16:46:23 +00:00
|
|
|
struct session_alert {
|
|
|
|
struct winlink *wl;
|
|
|
|
int type;
|
|
|
|
|
2008-11-05 01:19:24 +00:00
|
|
|
SLIST_ENTRY(session_alert) entry;
|
2008-06-04 16:46:23 +00:00
|
|
|
};
|
|
|
|
|
2007-07-09 19:04:12 +00:00
|
|
|
struct session {
|
2007-10-03 21:31:07 +00:00
|
|
|
char *name;
|
2008-08-28 17:45:30 +00:00
|
|
|
struct timeval tv;
|
2007-07-09 19:04:12 +00:00
|
|
|
|
2007-10-03 23:32:26 +00:00
|
|
|
u_int sx;
|
|
|
|
u_int sy;
|
|
|
|
|
2007-11-24 23:29:49 +00:00
|
|
|
struct winlink *curw;
|
2008-11-16 10:10:26 +00:00
|
|
|
struct winlink_stack lastw;
|
2007-11-24 23:29:49 +00:00
|
|
|
struct winlinks windows;
|
2007-10-05 18:25:05 +00:00
|
|
|
|
2008-06-03 21:42:37 +00:00
|
|
|
struct options options;
|
|
|
|
|
2008-06-20 08:36:20 +00:00
|
|
|
struct paste_stack buffers;
|
|
|
|
|
2008-11-05 01:19:24 +00:00
|
|
|
SLIST_HEAD(, session_alert) alerts;
|
2007-10-12 11:24:15 +00:00
|
|
|
|
2007-10-05 18:25:05 +00:00
|
|
|
#define SESSION_UNATTACHED 0x1 /* not attached to any clients */
|
|
|
|
int flags;
|
2009-08-09 17:48:55 +00:00
|
|
|
|
2009-08-16 18:59:12 +00:00
|
|
|
struct termios tio;
|
|
|
|
|
2009-08-09 17:48:55 +00:00
|
|
|
struct environ environ;
|
2007-07-09 19:04:12 +00:00
|
|
|
};
|
|
|
|
ARRAY_DECL(sessions, struct session *);
|
|
|
|
|
2007-11-27 19:23:34 +00:00
|
|
|
/* TTY information. */
|
|
|
|
struct tty_key {
|
2009-01-09 23:57:42 +00:00
|
|
|
int key;
|
2007-11-27 19:23:34 +00:00
|
|
|
char *string;
|
|
|
|
|
2009-01-09 16:45:58 +00:00
|
|
|
int flags;
|
2009-01-12 22:48:00 +00:00
|
|
|
#define TTYKEY_CTRL 0x1
|
2009-01-09 16:45:58 +00:00
|
|
|
#define TTYKEY_RAW 0x2
|
|
|
|
|
2007-11-27 19:23:34 +00:00
|
|
|
RB_ENTRY(tty_key) entry;
|
|
|
|
};
|
|
|
|
|
2007-12-06 18:28:55 +00:00
|
|
|
struct tty_term {
|
|
|
|
char *name;
|
|
|
|
u_int references;
|
|
|
|
|
2009-01-09 23:57:42 +00:00
|
|
|
struct tty_code codes[NTTYCODE];
|
|
|
|
|
2008-09-08 22:18:03 +00:00
|
|
|
#define TERM_HASDEFAULTS 0x1
|
|
|
|
#define TERM_256COLOURS 0x2
|
2009-03-07 10:29:06 +00:00
|
|
|
#define TERM_88COLOURS 0x4
|
|
|
|
#define TERM_EARLYWRAP 0x8
|
2008-09-08 17:40:51 +00:00
|
|
|
int flags;
|
|
|
|
|
2008-11-05 01:19:24 +00:00
|
|
|
SLIST_ENTRY(tty_term) entry;
|
2007-12-06 18:28:55 +00:00
|
|
|
};
|
2009-01-10 01:30:38 +00:00
|
|
|
SLIST_HEAD(tty_terms, tty_term);
|
2007-12-06 18:28:55 +00:00
|
|
|
|
2007-11-27 19:23:34 +00:00
|
|
|
struct tty {
|
|
|
|
char *path;
|
|
|
|
|
2009-02-11 17:50:36 +00:00
|
|
|
u_int sx;
|
|
|
|
u_int sy;
|
|
|
|
|
2009-01-11 23:31:46 +00:00
|
|
|
u_int cx;
|
|
|
|
u_int cy;
|
|
|
|
|
2009-01-28 19:52:21 +00:00
|
|
|
int mode;
|
2009-01-11 23:31:46 +00:00
|
|
|
|
|
|
|
u_int rlower;
|
|
|
|
u_int rupper;
|
|
|
|
|
2007-12-06 18:28:55 +00:00
|
|
|
char *termname;
|
|
|
|
struct tty_term *term;
|
2007-11-27 19:23:34 +00:00
|
|
|
|
|
|
|
int fd;
|
|
|
|
struct buffer *in;
|
|
|
|
struct buffer *out;
|
|
|
|
|
2008-09-09 22:16:37 +00:00
|
|
|
int log_fd;
|
|
|
|
|
2007-11-27 19:23:34 +00:00
|
|
|
struct termios tio;
|
|
|
|
|
2008-09-25 20:08:57 +00:00
|
|
|
struct grid_cell cell;
|
2007-11-27 19:23:34 +00:00
|
|
|
|
|
|
|
u_char acs[UCHAR_MAX + 1];
|
|
|
|
|
2008-06-19 23:07:11 +00:00
|
|
|
#define TTY_NOCURSOR 0x1
|
2008-06-20 06:36:01 +00:00
|
|
|
#define TTY_FREEZE 0x2
|
2008-06-25 07:30:08 +00:00
|
|
|
#define TTY_ESCAPE 0x4
|
2008-09-09 22:16:37 +00:00
|
|
|
#define TTY_UTF8 0x8
|
2009-08-14 21:17:54 +00:00
|
|
|
#define TTY_STARTED 0x10
|
2009-08-14 21:20:01 +00:00
|
|
|
#define TTY_OPENED 0x20
|
2009-01-18 18:31:45 +00:00
|
|
|
int flags;
|
2008-06-19 23:07:11 +00:00
|
|
|
|
2008-09-25 20:08:57 +00:00
|
|
|
int term_flags;
|
|
|
|
|
2008-08-28 17:45:30 +00:00
|
|
|
struct timeval key_timer;
|
2008-06-25 07:30:08 +00:00
|
|
|
|
2007-11-27 19:23:34 +00:00
|
|
|
size_t ksize; /* maximum key size */
|
|
|
|
RB_HEAD(tty_keys, tty_key) ktree;
|
|
|
|
};
|
|
|
|
|
2009-07-23 12:38:01 +00:00
|
|
|
/* TTY command context and function pointer. */
|
|
|
|
struct tty_ctx {
|
|
|
|
struct window_pane *wp;
|
|
|
|
|
|
|
|
const struct grid_cell *cell;
|
|
|
|
const struct grid_utf8 *utf8;
|
|
|
|
|
2009-07-23 12:48:18 +00:00
|
|
|
u_int num;
|
|
|
|
void *ptr;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Cursor and region position before the screen was updated - this is
|
|
|
|
* where the command should be applied; the values in the screen have
|
|
|
|
* already been updated.
|
|
|
|
*/
|
|
|
|
u_int ocx;
|
|
|
|
u_int ocy;
|
|
|
|
|
|
|
|
u_int orupper;
|
|
|
|
u_int orlower;
|
2009-07-23 12:38:01 +00:00
|
|
|
};
|
|
|
|
|
2007-07-09 19:04:12 +00:00
|
|
|
/* Client connection. */
|
|
|
|
struct client {
|
2009-08-14 21:04:04 +00:00
|
|
|
struct imsgbuf ibuf;
|
2007-07-09 19:04:12 +00:00
|
|
|
|
2009-08-09 17:48:55 +00:00
|
|
|
struct environ environ;
|
|
|
|
|
2008-06-18 18:52:44 +00:00
|
|
|
char *title;
|
2009-01-10 19:37:35 +00:00
|
|
|
char *cwd;
|
2008-06-18 18:52:44 +00:00
|
|
|
|
2007-11-27 19:23:34 +00:00
|
|
|
struct tty tty;
|
2008-08-28 17:45:30 +00:00
|
|
|
struct timeval status_timer;
|
2009-01-14 22:13:30 +00:00
|
|
|
struct timeval repeat_timer;
|
2007-11-27 19:23:34 +00:00
|
|
|
|
2009-01-11 23:31:46 +00:00
|
|
|
struct screen status;
|
|
|
|
|
2007-10-03 21:31:07 +00:00
|
|
|
#define CLIENT_TERMINAL 0x1
|
|
|
|
#define CLIENT_PREFIX 0x2
|
2007-11-27 23:28:51 +00:00
|
|
|
#define CLIENT_MOUSE 0x4
|
2008-06-07 06:47:38 +00:00
|
|
|
#define CLIENT_REDRAW 0x8
|
|
|
|
#define CLIENT_STATUS 0x10
|
2009-01-14 22:13:30 +00:00
|
|
|
#define CLIENT_REPEAT 0x20 /* allow command to repeat within repeat time */
|
2009-01-18 12:09:42 +00:00
|
|
|
#define CLIENT_SUSPENDED 0x40
|
2009-08-09 17:19:18 +00:00
|
|
|
#define CLIENT_BAD 0x80
|
2007-10-03 21:31:07 +00:00
|
|
|
int flags;
|
2007-10-03 10:18:32 +00:00
|
|
|
|
2008-06-19 18:27:55 +00:00
|
|
|
char *message_string;
|
2008-08-28 17:45:30 +00:00
|
|
|
struct timeval message_timer;
|
2008-06-19 18:27:55 +00:00
|
|
|
|
|
|
|
char *prompt_string;
|
|
|
|
char *prompt_buffer;
|
2008-06-19 19:40:35 +00:00
|
|
|
size_t prompt_index;
|
2009-07-17 09:26:21 +00:00
|
|
|
int (*prompt_callbackfn)(void *, const char *);
|
|
|
|
void (*prompt_freefn)(void *);
|
2008-06-19 19:40:35 +00:00
|
|
|
void *prompt_data;
|
2009-04-27 17:27:36 +00:00
|
|
|
|
|
|
|
#define PROMPT_HIDDEN 0x1
|
|
|
|
#define PROMPT_SINGLE 0x2
|
|
|
|
int prompt_flags;
|
|
|
|
|
2009-01-06 15:37:15 +00:00
|
|
|
u_int prompt_hindex;
|
|
|
|
ARRAY_DECL(, char *) prompt_hdata;
|
2009-04-27 17:27:36 +00:00
|
|
|
|
2009-02-13 21:39:45 +00:00
|
|
|
struct mode_key_data prompt_mdata;
|
2008-06-19 18:27:55 +00:00
|
|
|
|
2007-07-09 19:04:12 +00:00
|
|
|
struct session *session;
|
|
|
|
};
|
|
|
|
ARRAY_DECL(clients, struct client *);
|
|
|
|
|
2007-09-26 13:43:15 +00:00
|
|
|
/* Client context. */
|
|
|
|
struct client_ctx {
|
2009-08-14 21:04:04 +00:00
|
|
|
struct imsgbuf ibuf;
|
2007-09-26 13:43:15 +00:00
|
|
|
|
2009-07-23 23:42:59 +00:00
|
|
|
enum {
|
|
|
|
CCTX_DETACH,
|
|
|
|
CCTX_EXIT,
|
|
|
|
CCTX_DIED,
|
|
|
|
CCTX_SHUTDOWN,
|
|
|
|
} exittype;
|
|
|
|
const char *errstr;
|
2007-10-03 21:31:07 +00:00
|
|
|
};
|
2007-09-26 13:43:15 +00:00
|
|
|
|
2007-10-03 21:31:07 +00:00
|
|
|
/* Key/command line command. */
|
|
|
|
struct cmd_ctx {
|
2009-07-18 11:06:09 +00:00
|
|
|
/*
|
|
|
|
* curclient is the client where this command was executed if inside
|
|
|
|
* tmux. This is NULL if the command came from the command-line.
|
|
|
|
*
|
|
|
|
* cmdclient is the client which sent the MSG_COMMAND to the server, if
|
|
|
|
* any. This is NULL unless the command came from the command-line.
|
|
|
|
*
|
2009-07-23 13:25:27 +00:00
|
|
|
* cmdclient and curclient may both be NULL if the command is in the
|
|
|
|
* configuration file.
|
2009-07-18 11:06:09 +00:00
|
|
|
*/
|
2008-06-02 18:08:17 +00:00
|
|
|
struct client *curclient;
|
2009-07-25 08:52:04 +00:00
|
|
|
struct client *cmdclient;
|
|
|
|
|
2008-06-02 18:08:17 +00:00
|
|
|
struct session *cursession;
|
2009-07-18 11:06:09 +00:00
|
|
|
|
2008-06-02 18:08:17 +00:00
|
|
|
struct msg_command_data *msgdata;
|
2007-10-03 21:31:07 +00:00
|
|
|
|
2009-08-20 11:35:16 +00:00
|
|
|
void printflike2 (*print)(struct cmd_ctx *, const char *, ...);
|
|
|
|
void printflike2 (*info)(struct cmd_ctx *, const char *, ...);
|
|
|
|
void printflike2 (*error)(struct cmd_ctx *, const char *, ...);
|
2007-10-03 12:34:16 +00:00
|
|
|
};
|
|
|
|
|
2008-06-02 18:08:17 +00:00
|
|
|
struct cmd {
|
|
|
|
const struct cmd_entry *entry;
|
|
|
|
void *data;
|
2009-01-18 14:40:48 +00:00
|
|
|
|
|
|
|
TAILQ_ENTRY(cmd) qentry;
|
2008-06-02 18:08:17 +00:00
|
|
|
};
|
2009-01-18 14:40:48 +00:00
|
|
|
TAILQ_HEAD(cmd_list, cmd);
|
2008-06-02 18:08:17 +00:00
|
|
|
|
2007-10-03 21:31:07 +00:00
|
|
|
struct cmd_entry {
|
2007-10-03 11:26:34 +00:00
|
|
|
const char *name;
|
2007-10-03 21:31:07 +00:00
|
|
|
const char *alias;
|
2007-10-04 21:48:11 +00:00
|
|
|
const char *usage;
|
2007-10-03 21:31:07 +00:00
|
|
|
|
|
|
|
#define CMD_STARTSERVER 0x1
|
2008-06-02 18:08:17 +00:00
|
|
|
#define CMD_CANTNEST 0x2
|
2009-08-11 14:42:59 +00:00
|
|
|
#define CMD_SENDENVIRON 0x4
|
|
|
|
#define CMD_ARG1 0x8
|
|
|
|
#define CMD_ARG01 0x10
|
|
|
|
#define CMD_ARG2 0x20
|
|
|
|
#define CMD_ARG12 0x40
|
2007-10-03 12:34:16 +00:00
|
|
|
int flags;
|
2007-10-03 21:31:07 +00:00
|
|
|
|
2009-07-14 06:43:33 +00:00
|
|
|
#define CMD_CHFLAG(flag) \
|
|
|
|
((flag) >= 'a' && (flag) <= 'z' ? 1ULL << ((flag) - 'a') : \
|
|
|
|
(flag) >= 'A' && (flag) <= 'Z' ? 1ULL << (26 + (flag) - 'A') : 0)
|
|
|
|
uint64_t chflags;
|
|
|
|
|
2008-06-05 21:25:00 +00:00
|
|
|
void (*init)(struct cmd *, int);
|
2008-06-05 16:35:32 +00:00
|
|
|
int (*parse)(struct cmd *, int, char **, char **);
|
2009-01-19 18:23:40 +00:00
|
|
|
int (*exec)(struct cmd *, struct cmd_ctx *);
|
2008-06-05 16:35:32 +00:00
|
|
|
void (*free)(struct cmd *);
|
2009-01-18 14:40:48 +00:00
|
|
|
size_t (*print)(struct cmd *, char *, size_t);
|
2007-10-03 21:31:07 +00:00
|
|
|
};
|
|
|
|
|
2008-06-04 16:11:53 +00:00
|
|
|
/* Generic command data. */
|
2008-06-05 21:25:00 +00:00
|
|
|
struct cmd_target_data {
|
2009-07-14 06:43:33 +00:00
|
|
|
uint64_t chflags;
|
2008-06-05 21:25:00 +00:00
|
|
|
char *target;
|
|
|
|
char *arg;
|
2009-08-11 14:42:59 +00:00
|
|
|
char *arg2;
|
2008-06-04 16:11:53 +00:00
|
|
|
};
|
|
|
|
|
2008-06-05 21:25:00 +00:00
|
|
|
struct cmd_srcdst_data {
|
2009-07-14 06:43:33 +00:00
|
|
|
uint64_t chflags;
|
2008-06-05 21:25:00 +00:00
|
|
|
char *src;
|
|
|
|
char *dst;
|
|
|
|
char *arg;
|
2009-08-11 14:42:59 +00:00
|
|
|
char *arg2;
|
2008-06-04 16:11:53 +00:00
|
|
|
};
|
|
|
|
|
2008-06-20 08:36:20 +00:00
|
|
|
struct cmd_buffer_data {
|
2009-07-14 06:43:33 +00:00
|
|
|
uint64_t chflags;
|
2008-06-20 08:36:20 +00:00
|
|
|
char *target;
|
|
|
|
int buffer;
|
|
|
|
char *arg;
|
2009-08-11 14:42:59 +00:00
|
|
|
char *arg2;
|
2008-12-08 16:19:51 +00:00
|
|
|
};
|
|
|
|
|
2007-10-03 21:31:07 +00:00
|
|
|
/* Key binding. */
|
2009-01-06 14:10:32 +00:00
|
|
|
struct key_binding {
|
2007-10-03 21:31:07 +00:00
|
|
|
int key;
|
2009-01-18 14:40:48 +00:00
|
|
|
struct cmd_list *cmdlist;
|
2009-03-28 14:08:09 +00:00
|
|
|
int can_repeat;
|
2009-01-06 14:10:32 +00:00
|
|
|
|
2009-01-10 01:51:22 +00:00
|
|
|
SPLAY_ENTRY(key_binding) entry;
|
2007-10-03 11:26:34 +00:00
|
|
|
};
|
2009-01-06 14:10:32 +00:00
|
|
|
SPLAY_HEAD(key_bindings, key_binding);
|
2007-10-03 11:26:34 +00:00
|
|
|
|
2008-06-23 07:41:21 +00:00
|
|
|
/* Set/display option data. */
|
|
|
|
struct set_option_entry {
|
|
|
|
const char *name;
|
|
|
|
enum {
|
|
|
|
SET_OPTION_STRING,
|
|
|
|
SET_OPTION_NUMBER,
|
2008-09-26 06:45:28 +00:00
|
|
|
SET_OPTION_KEY,
|
2008-06-23 22:12:29 +00:00
|
|
|
SET_OPTION_COLOUR,
|
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!
2009-01-27 20:22:33 +00:00
|
|
|
SET_OPTION_ATTRIBUTES,
|
2008-06-23 07:41:21 +00:00
|
|
|
SET_OPTION_FLAG,
|
|
|
|
SET_OPTION_CHOICE
|
|
|
|
} type;
|
2008-06-23 22:12:29 +00:00
|
|
|
|
2008-06-23 07:41:21 +00:00
|
|
|
u_int minimum;
|
|
|
|
u_int maximum;
|
2008-09-26 06:45:28 +00:00
|
|
|
|
2008-06-23 07:41:21 +00:00
|
|
|
const char **choices;
|
|
|
|
};
|
|
|
|
extern const struct set_option_entry set_option_table[];
|
2008-12-08 16:19:51 +00:00
|
|
|
extern const struct set_option_entry set_window_option_table[];
|
2008-07-02 21:22:57 +00:00
|
|
|
|
2007-07-09 19:04:12 +00:00
|
|
|
/* tmux.c */
|
2007-09-26 13:43:15 +00:00
|
|
|
extern volatile sig_atomic_t sigwinch;
|
|
|
|
extern volatile sig_atomic_t sigterm;
|
2009-01-18 12:09:42 +00:00
|
|
|
extern volatile sig_atomic_t sigcont;
|
2009-02-08 16:11:26 +00:00
|
|
|
extern volatile sig_atomic_t sigchld;
|
2009-05-16 10:02:51 +00:00
|
|
|
extern volatile sig_atomic_t sigusr1;
|
|
|
|
extern volatile sig_atomic_t sigusr2;
|
2009-07-08 18:01:31 +00:00
|
|
|
extern struct options global_s_options;
|
|
|
|
extern struct options global_w_options;
|
2009-08-09 17:48:55 +00:00
|
|
|
extern struct environ global_environ;
|
2008-06-02 18:08:17 +00:00
|
|
|
extern char *cfg_file;
|
2009-01-11 00:48:42 +00:00
|
|
|
extern int server_locked;
|
2009-07-20 16:07:23 +00:00
|
|
|
extern u_int password_failures;
|
2009-01-11 00:48:42 +00:00
|
|
|
extern char *server_password;
|
|
|
|
extern time_t server_activity;
|
2007-10-19 10:21:36 +00:00
|
|
|
extern int debug_level;
|
2008-06-16 17:35:40 +00:00
|
|
|
extern int be_quiet;
|
2009-01-09 23:57:42 +00:00
|
|
|
extern time_t start_time;
|
2009-03-27 15:57:10 +00:00
|
|
|
extern char *socket_path;
|
2007-09-26 13:43:15 +00:00
|
|
|
void logfile(const char *);
|
|
|
|
void siginit(void);
|
|
|
|
void sigreset(void);
|
2009-01-18 12:09:42 +00:00
|
|
|
void sighandler(int);
|
2007-09-26 13:43:15 +00:00
|
|
|
|
2008-06-02 18:08:17 +00:00
|
|
|
/* cfg.c */
|
|
|
|
int load_cfg(const char *, char **x);
|
|
|
|
|
2008-07-02 21:22:57 +00:00
|
|
|
/* mode-key.c */
|
2009-07-28 23:11:18 +00:00
|
|
|
extern const struct mode_key_table mode_key_tables[];
|
|
|
|
extern struct mode_key_tree mode_key_tree_vi_edit;
|
|
|
|
extern struct mode_key_tree mode_key_tree_vi_choice;
|
|
|
|
extern struct mode_key_tree mode_key_tree_vi_copy;
|
|
|
|
extern struct mode_key_tree mode_key_tree_emacs_edit;
|
|
|
|
extern struct mode_key_tree mode_key_tree_emacs_choice;
|
|
|
|
extern struct mode_key_tree mode_key_tree_emacs_copy;
|
|
|
|
int mode_key_cmp(struct mode_key_binding *, struct mode_key_binding *);
|
|
|
|
SPLAY_PROTOTYPE(mode_key_tree, mode_key_binding, entry, mode_key_cmp);
|
|
|
|
const char *mode_key_tostring(struct mode_key_cmdstr *r, enum mode_key_cmd);
|
2009-07-28 23:19:06 +00:00
|
|
|
enum mode_key_cmd mode_key_fromstring(struct mode_key_cmdstr *, const char *);
|
|
|
|
const struct mode_key_table *mode_key_findtable(const char *);
|
2009-07-28 23:11:18 +00:00
|
|
|
void mode_key_init_trees(void);
|
|
|
|
void mode_key_free_trees(void);
|
|
|
|
void mode_key_init(struct mode_key_data *, struct mode_key_tree *);
|
2009-02-13 21:39:45 +00:00
|
|
|
enum mode_key_cmd mode_key_lookup(struct mode_key_data *, int);
|
2008-07-02 21:22:57 +00:00
|
|
|
|
2008-06-03 21:42:37 +00:00
|
|
|
/* options.c */
|
|
|
|
int options_cmp(struct options_entry *, struct options_entry *);
|
|
|
|
SPLAY_PROTOTYPE(options_tree, options_entry, entry, options_cmp);
|
|
|
|
void options_init(struct options *, struct options *);
|
|
|
|
void options_free(struct options *);
|
2008-06-23 07:41:21 +00:00
|
|
|
struct options_entry *options_find1(struct options *, const char *);
|
|
|
|
struct options_entry *options_find(struct options *, const char *);
|
2009-07-22 17:46:53 +00:00
|
|
|
void options_remove(struct options *, const char *);
|
2008-06-03 21:42:37 +00:00
|
|
|
void printflike3 options_set_string(
|
|
|
|
struct options *, const char *, const char *, ...);
|
|
|
|
char *options_get_string(struct options *, const char *);
|
|
|
|
void options_set_number(struct options *, const char *, long long);
|
2008-06-15 08:01:54 +00:00
|
|
|
long long options_get_number(struct options *, const char *);
|
2008-06-03 21:42:37 +00:00
|
|
|
|
2009-08-09 17:48:55 +00:00
|
|
|
/* environ.c */
|
|
|
|
int environ_cmp(struct environ_entry *, struct environ_entry *);
|
|
|
|
RB_PROTOTYPE(environ, environ_entry, entry, environ_cmp);
|
|
|
|
void environ_init(struct environ *);
|
|
|
|
void environ_free(struct environ *);
|
|
|
|
void environ_copy(struct environ *, struct environ *);
|
|
|
|
struct environ_entry *environ_find(struct environ *, const char *);
|
|
|
|
void environ_set(struct environ *, const char *, const char *);
|
|
|
|
void environ_put(struct environ *, const char *);
|
|
|
|
void environ_unset(struct environ *, const char *);
|
|
|
|
void environ_update(const char *, struct environ *, struct environ *);
|
|
|
|
|
2007-11-27 19:23:34 +00:00
|
|
|
/* tty.c */
|
2009-07-23 12:38:01 +00:00
|
|
|
u_char tty_get_acs(struct tty *, u_char);
|
|
|
|
void tty_reset(struct tty *);
|
|
|
|
void tty_region(struct tty *, u_int, u_int, u_int);
|
|
|
|
void tty_cursor(struct tty *, u_int, u_int, u_int, u_int);
|
|
|
|
void tty_putcode(struct tty *, enum tty_code_code);
|
|
|
|
void tty_putcode1(struct tty *, enum tty_code_code, int);
|
|
|
|
void tty_putcode2(struct tty *, enum tty_code_code, int, int);
|
|
|
|
void tty_puts(struct tty *, const char *);
|
|
|
|
void tty_putc(struct tty *, u_char);
|
|
|
|
void tty_pututf8(struct tty *, const struct grid_utf8 *);
|
2009-08-14 21:23:20 +00:00
|
|
|
void tty_init(struct tty *, int, char *, char *);
|
2009-07-23 12:38:01 +00:00
|
|
|
void tty_start_tty(struct tty *);
|
|
|
|
void tty_stop_tty(struct tty *);
|
|
|
|
void tty_detect_utf8(struct tty *);
|
|
|
|
void tty_set_title(struct tty *, const char *);
|
|
|
|
void tty_update_mode(struct tty *, int);
|
|
|
|
void tty_draw_line(struct tty *, struct screen *, u_int, u_int, u_int);
|
2009-08-09 15:26:24 +00:00
|
|
|
int tty_open(struct tty *, const char *, char **);
|
2009-08-14 21:17:54 +00:00
|
|
|
void tty_close(struct tty *);
|
|
|
|
void tty_free(struct tty *);
|
2009-08-14 21:30:24 +00:00
|
|
|
void tty_write(void (*)(
|
|
|
|
struct tty *, const struct tty_ctx *), const struct tty_ctx *);
|
|
|
|
void tty_cmd_alignmenttest(struct tty *, const struct tty_ctx *);
|
|
|
|
void tty_cmd_cell(struct tty *, const struct tty_ctx *);
|
|
|
|
void tty_cmd_clearendofline(struct tty *, const struct tty_ctx *);
|
|
|
|
void tty_cmd_clearendofscreen(struct tty *, const struct tty_ctx *);
|
|
|
|
void tty_cmd_clearline(struct tty *, const struct tty_ctx *);
|
|
|
|
void tty_cmd_clearscreen(struct tty *, const struct tty_ctx *);
|
|
|
|
void tty_cmd_clearstartofline(struct tty *, const struct tty_ctx *);
|
|
|
|
void tty_cmd_clearstartofscreen(struct tty *, const struct tty_ctx *);
|
|
|
|
void tty_cmd_deletecharacter(struct tty *, const struct tty_ctx *);
|
|
|
|
void tty_cmd_deleteline(struct tty *, const struct tty_ctx *);
|
|
|
|
void tty_cmd_insertcharacter(struct tty *, const struct tty_ctx *);
|
|
|
|
void tty_cmd_insertline(struct tty *, const struct tty_ctx *);
|
|
|
|
void tty_cmd_linefeed(struct tty *, const struct tty_ctx *);
|
|
|
|
void tty_cmd_utf8character(struct tty *, const struct tty_ctx *);
|
|
|
|
void tty_cmd_reverseindex(struct tty *, const struct tty_ctx *);
|
2009-01-09 23:57:42 +00:00
|
|
|
|
|
|
|
/* tty-term.c */
|
2009-01-10 01:30:38 +00:00
|
|
|
extern struct tty_terms tty_terms;
|
|
|
|
extern struct tty_term_code_entry tty_term_codes[NTTYCODE];
|
2009-08-09 15:26:24 +00:00
|
|
|
struct tty_term *tty_term_find(char *, int, const char *, char **);
|
2009-01-09 23:57:42 +00:00
|
|
|
void tty_term_free(struct tty_term *);
|
|
|
|
int tty_term_has(struct tty_term *, enum tty_code_code);
|
|
|
|
const char *tty_term_string(struct tty_term *, enum tty_code_code);
|
|
|
|
const char *tty_term_string1(struct tty_term *, enum tty_code_code, int);
|
|
|
|
const char *tty_term_string2(
|
|
|
|
struct tty_term *, enum tty_code_code, int, int);
|
|
|
|
int tty_term_number(struct tty_term *, enum tty_code_code);
|
|
|
|
int tty_term_flag(struct tty_term *, enum tty_code_code);
|
2007-11-27 19:23:34 +00:00
|
|
|
|
|
|
|
/* tty-keys.c */
|
2009-07-23 12:38:01 +00:00
|
|
|
int tty_keys_cmp(struct tty_key *, struct tty_key *);
|
2007-11-27 19:23:34 +00:00
|
|
|
RB_PROTOTYPE(tty_keys, tty_key, entry, tty_keys_cmp);
|
2009-07-23 12:38:01 +00:00
|
|
|
void tty_keys_init(struct tty *);
|
|
|
|
void tty_keys_free(struct tty *);
|
|
|
|
int tty_keys_next(struct tty *, int *, u_char *);
|
2007-11-27 19:23:34 +00:00
|
|
|
|
2008-12-08 16:19:51 +00:00
|
|
|
/* options-cmd.c */
|
|
|
|
void set_option_string(struct cmd_ctx *,
|
2009-08-09 16:48:34 +00:00
|
|
|
struct options *, const struct set_option_entry *, char *, int);
|
2008-12-08 16:19:51 +00:00
|
|
|
void set_option_number(struct cmd_ctx *,
|
|
|
|
struct options *, const struct set_option_entry *, char *);
|
|
|
|
void set_option_key(struct cmd_ctx *,
|
|
|
|
struct options *, const struct set_option_entry *, char *);
|
|
|
|
void set_option_colour(struct cmd_ctx *,
|
|
|
|
struct options *, const struct set_option_entry *, char *);
|
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!
2009-01-27 20:22:33 +00:00
|
|
|
void set_option_attributes(struct cmd_ctx *,
|
|
|
|
struct options *, const struct set_option_entry *, char *);
|
2008-12-08 16:19:51 +00:00
|
|
|
void set_option_flag(struct cmd_ctx *,
|
|
|
|
struct options *, const struct set_option_entry *, char *);
|
|
|
|
void set_option_choice(struct cmd_ctx *,
|
|
|
|
struct options *, const struct set_option_entry *, char *);
|
|
|
|
|
2008-06-20 08:36:20 +00:00
|
|
|
/* paste.c */
|
|
|
|
void paste_init_stack(struct paste_stack *);
|
|
|
|
void paste_free_stack(struct paste_stack *);
|
|
|
|
struct paste_buffer *paste_walk_stack(struct paste_stack *, uint *);
|
|
|
|
struct paste_buffer *paste_get_top(struct paste_stack *);
|
|
|
|
struct paste_buffer *paste_get_index(struct paste_stack *, u_int);
|
|
|
|
int paste_free_top(struct paste_stack *);
|
|
|
|
int paste_free_index(struct paste_stack *, u_int);
|
2009-01-25 18:51:28 +00:00
|
|
|
void paste_add(struct paste_stack *, char *, u_int);
|
|
|
|
int paste_replace(struct paste_stack *, u_int, char *);
|
2008-06-20 08:36:20 +00:00
|
|
|
|
2009-01-11 00:48:42 +00:00
|
|
|
/* clock.c */
|
|
|
|
void clock_draw(struct screen_write_ctx *, u_int, int);
|
|
|
|
|
2007-10-03 21:31:07 +00:00
|
|
|
/* cmd.c */
|
2009-07-28 22:12:16 +00:00
|
|
|
int cmd_pack_argv(int, char **, char *, size_t);
|
|
|
|
int cmd_unpack_argv(char *, size_t, int, char ***);
|
|
|
|
void cmd_free_argv(int, char **);
|
2007-10-03 21:31:07 +00:00
|
|
|
struct cmd *cmd_parse(int, char **, char **);
|
2009-01-19 18:23:40 +00:00
|
|
|
int cmd_exec(struct cmd *, struct cmd_ctx *);
|
2007-10-03 21:31:07 +00:00
|
|
|
void cmd_free(struct cmd *);
|
2009-01-18 14:40:48 +00:00
|
|
|
size_t cmd_print(struct cmd *, char *, size_t);
|
2008-06-05 21:25:00 +00:00
|
|
|
struct session *cmd_current_session(struct cmd_ctx *);
|
2008-06-02 18:08:17 +00:00
|
|
|
struct client *cmd_find_client(struct cmd_ctx *, const char *);
|
2008-06-05 21:25:00 +00:00
|
|
|
struct session *cmd_find_session(struct cmd_ctx *, const char *);
|
|
|
|
struct winlink *cmd_find_window(
|
2009-07-14 06:42:06 +00:00
|
|
|
struct cmd_ctx *, const char *, struct session **);
|
|
|
|
int cmd_find_index(
|
|
|
|
struct cmd_ctx *, const char *, struct session **);
|
2009-07-30 20:45:20 +00:00
|
|
|
struct winlink *cmd_find_pane(struct cmd_ctx *,
|
|
|
|
const char *, struct session **, struct window_pane **);
|
2008-06-23 22:24:16 +00:00
|
|
|
extern const struct cmd_entry *cmd_table[];
|
2007-10-04 11:52:03 +00:00
|
|
|
extern const struct cmd_entry cmd_attach_session_entry;
|
2007-10-04 09:30:53 +00:00
|
|
|
extern const struct cmd_entry cmd_bind_key_entry;
|
2009-03-07 09:29:54 +00:00
|
|
|
extern const struct cmd_entry cmd_break_pane_entry;
|
2009-01-15 19:27:31 +00:00
|
|
|
extern const struct cmd_entry cmd_choose_session_entry;
|
|
|
|
extern const struct cmd_entry cmd_choose_window_entry;
|
2009-05-14 16:56:23 +00:00
|
|
|
extern const struct cmd_entry cmd_clear_history_entry;
|
2009-01-10 19:35:40 +00:00
|
|
|
extern const struct cmd_entry cmd_clock_mode_entry;
|
2008-06-19 20:45:21 +00:00
|
|
|
extern const struct cmd_entry cmd_command_prompt_entry;
|
2009-04-27 13:21:16 +00:00
|
|
|
extern const struct cmd_entry cmd_confirm_before_entry;
|
2009-02-03 17:21:19 +00:00
|
|
|
extern const struct cmd_entry cmd_copy_buffer_entry;
|
2007-11-22 18:09:43 +00:00
|
|
|
extern const struct cmd_entry cmd_copy_mode_entry;
|
2008-06-20 17:31:48 +00:00
|
|
|
extern const struct cmd_entry cmd_delete_buffer_entry;
|
2007-11-16 21:12:31 +00:00
|
|
|
extern const struct cmd_entry cmd_detach_client_entry;
|
2009-07-17 18:32:54 +00:00
|
|
|
extern const struct cmd_entry cmd_display_message_entry;
|
2009-01-14 19:41:15 +00:00
|
|
|
extern const struct cmd_entry cmd_down_pane_entry;
|
2009-01-18 17:20:52 +00:00
|
|
|
extern const struct cmd_entry cmd_find_window_entry;
|
2007-10-25 17:44:25 +00:00
|
|
|
extern const struct cmd_entry cmd_has_session_entry;
|
2009-07-09 18:14:18 +00:00
|
|
|
extern const struct cmd_entry cmd_if_shell_entry;
|
2009-01-13 06:50:10 +00:00
|
|
|
extern const struct cmd_entry cmd_kill_pane_entry;
|
2008-06-03 05:10:38 +00:00
|
|
|
extern const struct cmd_entry cmd_kill_server_entry;
|
2007-11-12 14:21:41 +00:00
|
|
|
extern const struct cmd_entry cmd_kill_session_entry;
|
2007-10-19 11:10:35 +00:00
|
|
|
extern const struct cmd_entry cmd_kill_window_entry;
|
2007-10-04 00:18:59 +00:00
|
|
|
extern const struct cmd_entry cmd_last_window_entry;
|
2007-10-26 13:03:59 +00:00
|
|
|
extern const struct cmd_entry cmd_link_window_entry;
|
2008-06-20 17:31:48 +00:00
|
|
|
extern const struct cmd_entry cmd_list_buffers_entry;
|
2007-10-23 09:36:19 +00:00
|
|
|
extern const struct cmd_entry cmd_list_clients_entry;
|
2008-06-23 22:24:16 +00:00
|
|
|
extern const struct cmd_entry cmd_list_commands_entry;
|
2007-10-04 00:18:59 +00:00
|
|
|
extern const struct cmd_entry cmd_list_keys_entry;
|
|
|
|
extern const struct cmd_entry cmd_list_sessions_entry;
|
2007-10-04 11:23:17 +00:00
|
|
|
extern const struct cmd_entry cmd_list_windows_entry;
|
2009-01-25 19:00:10 +00:00
|
|
|
extern const struct cmd_entry cmd_load_buffer_entry;
|
2009-01-11 00:48:42 +00:00
|
|
|
extern const struct cmd_entry cmd_lock_server_entry;
|
2008-06-25 20:33:20 +00:00
|
|
|
extern const struct cmd_entry cmd_move_window_entry;
|
2007-10-04 00:18:59 +00:00
|
|
|
extern const struct cmd_entry cmd_new_session_entry;
|
|
|
|
extern const struct cmd_entry cmd_new_window_entry;
|
2009-04-01 18:21:42 +00:00
|
|
|
extern const struct cmd_entry cmd_next_layout_entry;
|
2007-10-04 00:18:59 +00:00
|
|
|
extern const struct cmd_entry cmd_next_window_entry;
|
2007-11-23 17:52:54 +00:00
|
|
|
extern const struct cmd_entry cmd_paste_buffer_entry;
|
2009-04-30 21:17:06 +00:00
|
|
|
extern const struct cmd_entry cmd_previous_layout_entry;
|
2007-10-04 00:18:59 +00:00
|
|
|
extern const struct cmd_entry cmd_previous_window_entry;
|
2007-11-16 21:12:31 +00:00
|
|
|
extern const struct cmd_entry cmd_refresh_client_entry;
|
2007-11-09 11:02:01 +00:00
|
|
|
extern const struct cmd_entry cmd_rename_session_entry;
|
2007-10-04 10:39:07 +00:00
|
|
|
extern const struct cmd_entry cmd_rename_window_entry;
|
2009-04-30 06:01:24 +00:00
|
|
|
extern const struct cmd_entry cmd_resize_pane_entry;
|
2008-06-29 07:04:31 +00:00
|
|
|
extern const struct cmd_entry cmd_respawn_window_entry;
|
2009-04-03 17:21:46 +00:00
|
|
|
extern const struct cmd_entry cmd_rotate_window_entry;
|
2009-01-11 23:14:57 +00:00
|
|
|
extern const struct cmd_entry cmd_save_buffer_entry;
|
2007-11-21 13:11:41 +00:00
|
|
|
extern const struct cmd_entry cmd_scroll_mode_entry;
|
2009-05-16 11:48:47 +00:00
|
|
|
extern const struct cmd_entry cmd_select_layout_entry;
|
2009-01-14 19:56:55 +00:00
|
|
|
extern const struct cmd_entry cmd_select_pane_entry;
|
2009-01-11 00:48:42 +00:00
|
|
|
extern const struct cmd_entry cmd_select_prompt_entry;
|
2007-10-04 10:54:21 +00:00
|
|
|
extern const struct cmd_entry cmd_select_window_entry;
|
2008-06-01 20:20:25 +00:00
|
|
|
extern const struct cmd_entry cmd_send_keys_entry;
|
2007-10-12 13:03:58 +00:00
|
|
|
extern const struct cmd_entry cmd_send_prefix_entry;
|
2009-01-10 01:30:38 +00:00
|
|
|
extern const struct cmd_entry cmd_server_info_entry;
|
2008-06-20 08:36:20 +00:00
|
|
|
extern const struct cmd_entry cmd_set_buffer_entry;
|
2009-08-09 17:48:55 +00:00
|
|
|
extern const struct cmd_entry cmd_set_environment_entry;
|
2007-10-04 10:11:32 +00:00
|
|
|
extern const struct cmd_entry cmd_set_option_entry;
|
2009-01-11 00:48:42 +00:00
|
|
|
extern const struct cmd_entry cmd_set_password_entry;
|
2008-06-04 17:54:27 +00:00
|
|
|
extern const struct cmd_entry cmd_set_window_option_entry;
|
2008-06-20 08:36:20 +00:00
|
|
|
extern const struct cmd_entry cmd_show_buffer_entry;
|
2009-08-09 17:48:55 +00:00
|
|
|
extern const struct cmd_entry cmd_show_environment_entry;
|
2008-06-15 08:01:54 +00:00
|
|
|
extern const struct cmd_entry cmd_show_options_entry;
|
2008-06-16 06:10:02 +00:00
|
|
|
extern const struct cmd_entry cmd_show_window_options_entry;
|
2008-12-15 21:21:56 +00:00
|
|
|
extern const struct cmd_entry cmd_source_file_entry;
|
2009-01-11 23:31:46 +00:00
|
|
|
extern const struct cmd_entry cmd_split_window_entry;
|
2008-06-02 21:08:36 +00:00
|
|
|
extern const struct cmd_entry cmd_start_server_entry;
|
2009-01-18 12:09:42 +00:00
|
|
|
extern const struct cmd_entry cmd_suspend_client_entry;
|
2009-04-02 23:28:16 +00:00
|
|
|
extern const struct cmd_entry cmd_swap_pane_entry;
|
2007-10-30 11:10:33 +00:00
|
|
|
extern const struct cmd_entry cmd_swap_window_entry;
|
2007-11-16 21:31:03 +00:00
|
|
|
extern const struct cmd_entry cmd_switch_client_entry;
|
2007-10-04 09:30:53 +00:00
|
|
|
extern const struct cmd_entry cmd_unbind_key_entry;
|
2007-10-26 16:57:32 +00:00
|
|
|
extern const struct cmd_entry cmd_unlink_window_entry;
|
2009-01-14 19:41:15 +00:00
|
|
|
extern const struct cmd_entry cmd_up_pane_entry;
|
2007-09-26 18:32:17 +00:00
|
|
|
|
2009-01-18 14:40:48 +00:00
|
|
|
/* cmd-list.c */
|
|
|
|
struct cmd_list *cmd_list_parse(int, char **, char **);
|
2009-01-19 18:23:40 +00:00
|
|
|
int cmd_list_exec(struct cmd_list *, struct cmd_ctx *);
|
2009-01-18 14:40:48 +00:00
|
|
|
void cmd_list_free(struct cmd_list *);
|
|
|
|
size_t cmd_list_print(struct cmd_list *, char *, size_t);
|
|
|
|
|
2008-06-19 20:45:21 +00:00
|
|
|
/* cmd-string.c */
|
2009-01-18 14:40:48 +00:00
|
|
|
int cmd_string_parse(const char *, struct cmd_list **, char **);
|
2008-06-19 20:45:21 +00:00
|
|
|
|
2008-06-02 18:08:17 +00:00
|
|
|
/* cmd-generic.c */
|
2009-01-18 14:40:48 +00:00
|
|
|
size_t cmd_prarg(char *, size_t, const char *, char *);
|
2009-07-30 20:45:20 +00:00
|
|
|
#define CMD_TARGET_PANE_USAGE "[-t target-pane]"
|
2008-06-05 21:25:00 +00:00
|
|
|
#define CMD_TARGET_WINDOW_USAGE "[-t target-window]"
|
|
|
|
#define CMD_TARGET_SESSION_USAGE "[-t target-session]"
|
|
|
|
#define CMD_TARGET_CLIENT_USAGE "[-t target-client]"
|
|
|
|
void cmd_target_init(struct cmd *, int);
|
|
|
|
int cmd_target_parse(struct cmd *, int, char **, char **);
|
|
|
|
void cmd_target_free(struct cmd *);
|
2009-01-18 14:40:48 +00:00
|
|
|
size_t cmd_target_print(struct cmd *, char *, size_t);
|
2009-07-30 20:45:20 +00:00
|
|
|
#define CMD_SRCDST_PANE_USAGE "[-s src-pane] [-t dst-pane]"
|
2008-06-05 21:25:00 +00:00
|
|
|
#define CMD_SRCDST_WINDOW_USAGE "[-s src-window] [-t dst-window]"
|
|
|
|
#define CMD_SRCDST_SESSION_USAGE "[-s src-session] [-t dst-session]"
|
|
|
|
#define CMD_SRCDST_CLIENT_USAGE "[-s src-client] [-t dst-client]"
|
|
|
|
void cmd_srcdst_init(struct cmd *, int);
|
|
|
|
int cmd_srcdst_parse(struct cmd *, int, char **, char **);
|
|
|
|
void cmd_srcdst_free(struct cmd *);
|
2009-01-18 14:40:48 +00:00
|
|
|
size_t cmd_srcdst_print(struct cmd *, char *, size_t);
|
2009-07-30 20:45:20 +00:00
|
|
|
#define CMD_BUFFER_PANE_USAGE "[-b buffer-index] [-t target-pane]"
|
2008-06-30 05:34:06 +00:00
|
|
|
#define CMD_BUFFER_WINDOW_USAGE "[-b buffer-index] [-t target-window]"
|
|
|
|
#define CMD_BUFFER_SESSION_USAGE "[-b buffer-index] [-t target-session]"
|
|
|
|
#define CMD_BUFFER_CLIENT_USAGE "[-b buffer-index] [-t target-client]"
|
2008-06-20 08:36:20 +00:00
|
|
|
void cmd_buffer_init(struct cmd *, int);
|
|
|
|
int cmd_buffer_parse(struct cmd *, int, char **, char **);
|
|
|
|
void cmd_buffer_free(struct cmd *);
|
2009-01-18 14:40:48 +00:00
|
|
|
size_t cmd_buffer_print(struct cmd *, char *, size_t);
|
2008-06-02 18:08:17 +00:00
|
|
|
|
2007-09-26 13:43:15 +00:00
|
|
|
/* client.c */
|
2009-03-27 17:04:04 +00:00
|
|
|
int client_init(char *, struct client_ctx *, int, int);
|
2007-09-26 13:43:15 +00:00
|
|
|
int client_main(struct client_ctx *);
|
2009-07-23 23:42:59 +00:00
|
|
|
int client_msg_dispatch(struct client_ctx *);
|
2007-09-26 13:43:15 +00:00
|
|
|
|
2007-10-03 10:18:32 +00:00
|
|
|
/* client-fn.c */
|
2009-07-30 20:21:55 +00:00
|
|
|
void client_write_server(struct client_ctx *, enum msgtype, void *, size_t);
|
2007-10-23 10:48:23 +00:00
|
|
|
void client_fill_session(struct msg_command_data *);
|
2009-07-30 20:57:39 +00:00
|
|
|
void client_suspend(void);
|
2007-10-03 10:18:32 +00:00
|
|
|
|
2007-10-03 21:31:07 +00:00
|
|
|
/* key-bindings.c */
|
2009-01-06 14:10:32 +00:00
|
|
|
extern struct key_bindings key_bindings;
|
|
|
|
int key_bindings_cmp(struct key_binding *, struct key_binding *);
|
|
|
|
SPLAY_PROTOTYPE(key_bindings, key_binding, entry, key_bindings_cmp);
|
|
|
|
struct key_binding *key_bindings_lookup(int);
|
2009-03-28 14:08:09 +00:00
|
|
|
void key_bindings_add(int, int, struct cmd_list *);
|
2007-10-03 21:31:07 +00:00
|
|
|
void key_bindings_remove(int);
|
2009-07-14 06:40:03 +00:00
|
|
|
void key_bindings_clean(void);
|
2007-10-03 21:31:07 +00:00
|
|
|
void key_bindings_init(void);
|
|
|
|
void key_bindings_free(void);
|
2009-01-14 22:13:30 +00:00
|
|
|
void key_bindings_dispatch(struct key_binding *, struct client *);
|
2008-06-19 20:45:21 +00:00
|
|
|
void printflike2 key_bindings_error(struct cmd_ctx *, const char *, ...);
|
|
|
|
void printflike2 key_bindings_print(struct cmd_ctx *, const char *, ...);
|
|
|
|
void printflike2 key_bindings_info(struct cmd_ctx *, const char *, ...);
|
2007-07-09 19:04:12 +00:00
|
|
|
|
2007-10-03 11:26:34 +00:00
|
|
|
/* key-string.c */
|
2007-10-04 00:18:59 +00:00
|
|
|
int key_string_lookup_string(const char *);
|
|
|
|
const char *key_string_lookup_key(int);
|
2007-10-03 11:26:34 +00:00
|
|
|
|
2007-07-09 19:04:12 +00:00
|
|
|
/* server.c */
|
2007-09-26 10:35:24 +00:00
|
|
|
extern struct clients clients;
|
2009-01-15 19:27:31 +00:00
|
|
|
int server_client_index(struct client *);
|
2009-03-27 17:04:04 +00:00
|
|
|
int server_start(char *);
|
2007-07-09 19:04:12 +00:00
|
|
|
|
2007-09-26 10:35:24 +00:00
|
|
|
/* server-msg.c */
|
2007-09-26 13:43:15 +00:00
|
|
|
int server_msg_dispatch(struct client *);
|
2007-09-26 10:35:24 +00:00
|
|
|
|
|
|
|
/* server-fn.c */
|
2009-08-09 17:48:55 +00:00
|
|
|
void server_fill_environ(struct session *, struct environ *);
|
2009-07-28 22:12:16 +00:00
|
|
|
void server_write_error(struct client *, const char *);
|
2007-09-29 09:53:25 +00:00
|
|
|
void server_write_client(
|
2009-07-30 20:21:55 +00:00
|
|
|
struct client *, enum msgtype, const void *, size_t);
|
2007-10-04 00:02:10 +00:00
|
|
|
void server_write_session(
|
2009-07-30 20:21:55 +00:00
|
|
|
struct session *, enum msgtype, const void *, size_t);
|
2007-10-04 00:02:10 +00:00
|
|
|
void server_redraw_client(struct client *);
|
2007-11-27 19:23:34 +00:00
|
|
|
void server_status_client(struct client *);
|
2007-10-04 00:02:10 +00:00
|
|
|
void server_redraw_session(struct session *);
|
2007-11-27 19:23:34 +00:00
|
|
|
void server_status_session(struct session *);
|
|
|
|
void server_redraw_window(struct window *);
|
|
|
|
void server_status_window(struct window *);
|
2009-01-11 00:48:42 +00:00
|
|
|
void server_lock(void);
|
|
|
|
int server_unlock(const char *);
|
2009-07-18 11:07:14 +00:00
|
|
|
void server_kill_window(struct window *);
|
2007-09-26 10:35:24 +00:00
|
|
|
|
2007-10-01 14:53:29 +00:00
|
|
|
/* status.c */
|
2009-02-10 00:18:06 +00:00
|
|
|
int status_redraw(struct client *);
|
2009-07-17 18:32:54 +00:00
|
|
|
char *status_replace(struct session *, const char *, time_t);
|
2009-07-15 17:50:11 +00:00
|
|
|
void printflike2 status_message_set(struct client *, const char *, ...);
|
2009-02-13 18:57:55 +00:00
|
|
|
void status_message_clear(struct client *);
|
2009-02-10 00:18:06 +00:00
|
|
|
int status_message_redraw(struct client *);
|
2009-07-17 09:26:21 +00:00
|
|
|
void status_prompt_set(struct client *, const char *,
|
|
|
|
int (*)(void *, const char *), void (*)(void *), void *, int);
|
2009-02-13 18:57:55 +00:00
|
|
|
void status_prompt_clear(struct client *);
|
2009-02-10 00:18:06 +00:00
|
|
|
int status_prompt_redraw(struct client *);
|
2008-06-19 19:40:35 +00:00
|
|
|
void status_prompt_key(struct client *, int);
|
2009-08-20 11:51:20 +00:00
|
|
|
void status_prompt_update(struct client *, const char *);
|
2007-10-01 14:53:29 +00:00
|
|
|
|
2007-10-04 19:03:52 +00:00
|
|
|
/* resize.c */
|
|
|
|
void recalculate_sizes(void);
|
|
|
|
|
2007-09-26 18:09:23 +00:00
|
|
|
/* input.c */
|
2009-01-11 23:31:46 +00:00
|
|
|
void input_init(struct window_pane *);
|
|
|
|
void input_free(struct window_pane *);
|
|
|
|
void input_parse(struct window_pane *);
|
2007-07-09 19:04:12 +00:00
|
|
|
|
2007-09-28 22:47:22 +00:00
|
|
|
/* input-key.c */
|
2009-01-11 23:31:46 +00:00
|
|
|
void input_key(struct window_pane *, int);
|
2009-01-28 19:52:21 +00:00
|
|
|
void input_mouse(struct window_pane *, u_char, u_char, u_char);
|
2007-09-28 22:47:22 +00:00
|
|
|
|
2008-09-10 18:59:29 +00:00
|
|
|
/* colour.c */
|
|
|
|
const char *colour_tostring(u_char);
|
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!
2009-01-27 20:22:33 +00:00
|
|
|
int colour_fromstring(const char *);
|
2009-03-07 10:29:06 +00:00
|
|
|
u_char colour_256to16(u_char);
|
|
|
|
u_char colour_256to88(u_char);
|
2008-09-10 18:59:29 +00:00
|
|
|
|
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!
2009-01-27 20:22:33 +00:00
|
|
|
/* attributes.c */
|
|
|
|
const char *attributes_tostring(u_char);
|
|
|
|
int attributes_fromstring(const char *);
|
|
|
|
|
2008-09-25 20:08:57 +00:00
|
|
|
/* grid.c */
|
|
|
|
extern const struct grid_cell grid_default_cell;
|
2009-03-28 15:43:41 +00:00
|
|
|
struct grid *grid_create(u_int, u_int, u_int);
|
|
|
|
void grid_destroy(struct grid *);
|
|
|
|
int grid_compare(struct grid *, struct grid *);
|
|
|
|
void grid_expand_line(struct grid *, u_int, u_int);
|
2009-03-28 20:17:29 +00:00
|
|
|
void grid_expand_line_utf8(struct grid *, u_int, u_int);
|
2009-03-28 15:43:41 +00:00
|
|
|
void grid_scroll_line(struct grid *);
|
|
|
|
const struct grid_cell *grid_peek_cell(struct grid *, u_int, u_int);
|
|
|
|
struct grid_cell *grid_get_cell(struct grid *, u_int, u_int);
|
2009-03-28 16:30:05 +00:00
|
|
|
void grid_set_cell(struct grid *, u_int, u_int, const struct grid_cell *);
|
2009-03-28 20:17:29 +00:00
|
|
|
const struct grid_utf8 *grid_peek_utf8(struct grid *, u_int, u_int);
|
|
|
|
struct grid_utf8 *grid_get_utf8(struct grid *, u_int, u_int);
|
|
|
|
void grid_set_utf8(struct grid *, u_int, u_int, const struct grid_utf8 *);
|
2009-03-28 15:43:41 +00:00
|
|
|
void grid_clear(struct grid *, u_int, u_int, u_int, u_int);
|
|
|
|
void grid_clear_lines(struct grid *, u_int, u_int);
|
|
|
|
void grid_move_lines(struct grid *, u_int, u_int, u_int);
|
|
|
|
void grid_move_cells(struct grid *, u_int, u_int, u_int, u_int);
|
2009-06-25 16:02:37 +00:00
|
|
|
char *grid_string_cells(struct grid *, u_int, u_int, u_int);
|
2009-07-14 06:40:33 +00:00
|
|
|
void grid_duplicate_lines(
|
|
|
|
struct grid *, u_int, struct grid *, u_int, u_int);
|
2008-09-25 20:08:57 +00:00
|
|
|
|
|
|
|
/* grid-view.c */
|
2009-03-28 15:43:41 +00:00
|
|
|
const struct grid_cell *grid_view_peek_cell(struct grid *, u_int, u_int);
|
|
|
|
struct grid_cell *grid_view_get_cell(struct grid *, u_int, u_int);
|
2008-09-25 20:08:57 +00:00
|
|
|
void grid_view_set_cell(
|
2009-03-28 16:30:05 +00:00
|
|
|
struct grid *, u_int, u_int, const struct grid_cell *);
|
2009-03-28 20:17:29 +00:00
|
|
|
const struct grid_utf8 *grid_view_peek_utf8(struct grid *, u_int, u_int);
|
|
|
|
struct grid_utf8 *grid_view_get_utf8(struct grid *, u_int, u_int);
|
|
|
|
void grid_view_set_utf8(
|
|
|
|
struct grid *, u_int, u_int, const struct grid_utf8 *);
|
2009-03-28 15:43:41 +00:00
|
|
|
void grid_view_clear(struct grid *, u_int, u_int, u_int, u_int);
|
|
|
|
void grid_view_scroll_region_up(struct grid *, u_int, u_int);
|
|
|
|
void grid_view_scroll_region_down(struct grid *, u_int, u_int);
|
|
|
|
void grid_view_insert_lines(struct grid *, u_int, u_int);
|
2009-07-09 18:04:17 +00:00
|
|
|
void grid_view_insert_lines_region(struct grid *, u_int, u_int, u_int);
|
2009-03-28 15:43:41 +00:00
|
|
|
void grid_view_delete_lines(struct grid *, u_int, u_int);
|
2009-07-09 18:04:17 +00:00
|
|
|
void grid_view_delete_lines_region(struct grid *, u_int, u_int, u_int);
|
2009-03-28 15:43:41 +00:00
|
|
|
void grid_view_insert_cells(struct grid *, u_int, u_int, u_int);
|
|
|
|
void grid_view_delete_cells(struct grid *, u_int, u_int, u_int);
|
2009-06-25 16:02:37 +00:00
|
|
|
char *grid_view_string_cells(struct grid *, u_int, u_int, u_int);
|
2007-12-06 09:46:23 +00:00
|
|
|
|
|
|
|
/* screen-write.c */
|
2009-01-11 23:31:46 +00:00
|
|
|
void screen_write_start(
|
|
|
|
struct screen_write_ctx *, struct window_pane *, struct screen *);
|
2007-12-06 09:46:23 +00:00
|
|
|
void screen_write_stop(struct screen_write_ctx *);
|
2009-06-25 15:48:25 +00:00
|
|
|
size_t printflike2 screen_write_strlen(int, const char *, ...);
|
2009-06-25 15:47:07 +00:00
|
|
|
void printflike3 screen_write_puts(struct screen_write_ctx *,
|
|
|
|
struct grid_cell *, const char *, ...);
|
2009-06-25 15:48:25 +00:00
|
|
|
void printflike5 screen_write_nputs(struct screen_write_ctx *,
|
|
|
|
ssize_t, struct grid_cell *, int, const char *, ...);
|
2009-06-25 15:47:07 +00:00
|
|
|
void screen_write_vnputs(struct screen_write_ctx *,
|
2009-06-25 15:48:25 +00:00
|
|
|
ssize_t, struct grid_cell *, int, const char *, va_list);
|
2008-09-25 20:08:57 +00:00
|
|
|
void screen_write_putc(
|
|
|
|
struct screen_write_ctx *, struct grid_cell *, u_char);
|
|
|
|
void screen_write_copy(struct screen_write_ctx *,
|
|
|
|
struct screen *, u_int, u_int, u_int, u_int);
|
|
|
|
void screen_write_cursorup(struct screen_write_ctx *, u_int);
|
|
|
|
void screen_write_cursordown(struct screen_write_ctx *, u_int);
|
|
|
|
void screen_write_cursorright(struct screen_write_ctx *, u_int);
|
|
|
|
void screen_write_cursorleft(struct screen_write_ctx *, u_int);
|
2009-06-25 15:51:54 +00:00
|
|
|
void screen_write_alignmenttest(struct screen_write_ctx *);
|
2008-09-25 20:08:57 +00:00
|
|
|
void screen_write_insertcharacter(struct screen_write_ctx *, u_int);
|
|
|
|
void screen_write_deletecharacter(struct screen_write_ctx *, u_int);
|
|
|
|
void screen_write_insertline(struct screen_write_ctx *, u_int);
|
|
|
|
void screen_write_deleteline(struct screen_write_ctx *, u_int);
|
|
|
|
void screen_write_clearline(struct screen_write_ctx *);
|
|
|
|
void screen_write_clearendofline(struct screen_write_ctx *);
|
|
|
|
void screen_write_clearstartofline(struct screen_write_ctx *);
|
|
|
|
void screen_write_cursormove(struct screen_write_ctx *, u_int, u_int);
|
|
|
|
void screen_write_cursormode(struct screen_write_ctx *, int);
|
|
|
|
void screen_write_reverseindex(struct screen_write_ctx *);
|
|
|
|
void screen_write_scrollregion(struct screen_write_ctx *, u_int, u_int);
|
|
|
|
void screen_write_insertmode(struct screen_write_ctx *, int);
|
|
|
|
void screen_write_mousemode(struct screen_write_ctx *, int);
|
2009-08-09 17:32:06 +00:00
|
|
|
void screen_write_linefeed(struct screen_write_ctx *, int);
|
2008-09-25 20:08:57 +00:00
|
|
|
void screen_write_carriagereturn(struct screen_write_ctx *);
|
|
|
|
void screen_write_kcursormode(struct screen_write_ctx *, int);
|
|
|
|
void screen_write_kkeypadmode(struct screen_write_ctx *, int);
|
|
|
|
void screen_write_clearendofscreen(struct screen_write_ctx *);
|
|
|
|
void screen_write_clearstartofscreen(struct screen_write_ctx *);
|
|
|
|
void screen_write_clearscreen(struct screen_write_ctx *);
|
2009-03-28 16:30:05 +00:00
|
|
|
void screen_write_cell(
|
2009-03-28 20:17:29 +00:00
|
|
|
struct screen_write_ctx *, const struct grid_cell *, u_char *);
|
2007-12-06 09:46:23 +00:00
|
|
|
|
|
|
|
/* screen-redraw.c */
|
2009-07-15 17:43:45 +00:00
|
|
|
void screen_redraw_screen(struct client *, int);
|
2009-04-02 21:08:15 +00:00
|
|
|
void screen_redraw_pane(struct client *, struct window_pane *);
|
2007-11-20 21:42:29 +00:00
|
|
|
|
2007-07-09 19:04:12 +00:00
|
|
|
/* screen.c */
|
2008-09-10 19:15:06 +00:00
|
|
|
void screen_init(struct screen *, u_int, u_int, u_int);
|
|
|
|
void screen_reinit(struct screen *);
|
|
|
|
void screen_free(struct screen *);
|
2009-06-25 15:54:38 +00:00
|
|
|
void screen_reset_tabs(struct screen *);
|
2008-09-25 20:08:57 +00:00
|
|
|
void screen_set_title(struct screen *, const char *);
|
2007-07-09 19:04:12 +00:00
|
|
|
void screen_resize(struct screen *, u_int, u_int);
|
2008-12-08 16:19:51 +00:00
|
|
|
void screen_set_selection(
|
|
|
|
struct screen *, u_int, u_int, u_int, u_int, struct grid_cell *);
|
2007-12-06 09:46:23 +00:00
|
|
|
void screen_clear_selection(struct screen *);
|
|
|
|
int screen_check_selection(struct screen *, u_int, u_int);
|
2007-07-09 19:04:12 +00:00
|
|
|
|
|
|
|
/* window.c */
|
|
|
|
extern struct windows windows;
|
2009-07-02 18:17:46 +00:00
|
|
|
const char *window_default_command(void);
|
2007-10-26 12:29:07 +00:00
|
|
|
int window_cmp(struct window *, struct window *);
|
|
|
|
int winlink_cmp(struct winlink *, struct winlink *);
|
|
|
|
RB_PROTOTYPE(windows, window, entry, window_cmp);
|
|
|
|
RB_PROTOTYPE(winlinks, winlink, entry, winlink_cmp);
|
|
|
|
struct winlink *winlink_find_by_index(struct winlinks *, int);
|
|
|
|
struct winlink *winlink_find_by_window(struct winlinks *, struct window *);
|
2009-08-16 19:16:27 +00:00
|
|
|
int winlink_next_index(struct winlinks *, int);
|
2009-01-10 14:43:43 +00:00
|
|
|
u_int winlink_count(struct winlinks *);
|
2007-10-26 12:29:07 +00:00
|
|
|
struct winlink *winlink_add(struct winlinks *, struct window *, int);
|
|
|
|
void winlink_remove(struct winlinks *, struct winlink *);
|
|
|
|
struct winlink *winlink_next(struct winlinks *, struct winlink *);
|
|
|
|
struct winlink *winlink_previous(struct winlinks *, struct winlink *);
|
2008-11-16 10:10:26 +00:00
|
|
|
void winlink_stack_push(struct winlink_stack *, struct winlink *);
|
|
|
|
void winlink_stack_remove(struct winlink_stack *, struct winlink *);
|
2009-01-14 19:29:32 +00:00
|
|
|
int window_index(struct window *, u_int *);
|
2009-03-07 09:29:54 +00:00
|
|
|
struct window *window_create1(u_int, u_int);
|
2009-08-09 17:48:55 +00:00
|
|
|
struct window *window_create(const char *, const char *, const char *,
|
2009-08-16 18:59:12 +00:00
|
|
|
struct environ *, struct termios *, u_int, u_int, u_int,
|
|
|
|
char **);
|
2007-07-09 19:04:12 +00:00
|
|
|
void window_destroy(struct window *);
|
2009-01-14 19:29:32 +00:00
|
|
|
void window_set_active_pane(struct window *, struct window_pane *);
|
2009-07-23 13:10:38 +00:00
|
|
|
struct window_pane *window_add_pane(struct window *, u_int);
|
2009-07-22 17:46:53 +00:00
|
|
|
void window_resize(struct window *, u_int, u_int);
|
2009-01-14 19:29:32 +00:00
|
|
|
void window_remove_pane(struct window *, struct window_pane *);
|
|
|
|
struct window_pane *window_pane_at_index(struct window *, u_int);
|
2009-07-17 18:32:54 +00:00
|
|
|
u_int window_pane_index(struct window *, struct window_pane *);
|
2009-01-14 19:29:32 +00:00
|
|
|
u_int window_count_panes(struct window *);
|
|
|
|
void window_destroy_panes(struct window *);
|
2009-01-11 23:31:46 +00:00
|
|
|
struct window_pane *window_pane_create(struct window *, u_int, u_int, u_int);
|
|
|
|
void window_pane_destroy(struct window_pane *);
|
2009-08-16 18:59:12 +00:00
|
|
|
int window_pane_spawn(struct window_pane *, const char *,
|
|
|
|
const char *, struct environ *, struct termios *, char **);
|
2009-07-22 17:46:53 +00:00
|
|
|
void window_pane_resize(struct window_pane *, u_int, u_int);
|
2009-01-11 23:31:46 +00:00
|
|
|
int window_pane_set_mode(
|
|
|
|
struct window_pane *, const struct window_mode *);
|
|
|
|
void window_pane_reset_mode(struct window_pane *);
|
|
|
|
void window_pane_parse(struct window_pane *);
|
|
|
|
void window_pane_key(struct window_pane *, struct client *, int);
|
2009-01-28 19:52:21 +00:00
|
|
|
void window_pane_mouse(struct window_pane *,
|
|
|
|
struct client *, u_char, u_char, u_char);
|
2009-07-15 17:42:44 +00:00
|
|
|
int window_pane_visible(struct window_pane *);
|
2009-06-25 16:04:24 +00:00
|
|
|
char *window_pane_search(
|
2009-07-20 15:42:05 +00:00
|
|
|
struct window_pane *, const char *, u_int *);
|
2007-11-21 13:11:41 +00:00
|
|
|
|
2009-04-01 18:21:42 +00:00
|
|
|
/* layout.c */
|
2009-07-20 15:42:05 +00:00
|
|
|
struct layout_cell *layout_create_cell(struct layout_cell *);
|
|
|
|
void layout_free_cell(struct layout_cell *);
|
|
|
|
void layout_print_cell(struct layout_cell *, const char *, u_int);
|
|
|
|
void layout_set_size(
|
|
|
|
struct layout_cell *, u_int, u_int, u_int, u_int);
|
|
|
|
void layout_make_leaf(
|
|
|
|
struct layout_cell *, struct window_pane *);
|
|
|
|
void layout_make_node(struct layout_cell *, enum layout_type);
|
|
|
|
void layout_fix_offsets(struct layout_cell *);
|
|
|
|
void layout_fix_panes(struct window *, u_int, u_int);
|
|
|
|
u_int layout_resize_check(struct layout_cell *, enum layout_type);
|
|
|
|
void layout_resize_adjust(
|
|
|
|
struct layout_cell *, enum layout_type, int);
|
|
|
|
void layout_init(struct window *);
|
|
|
|
void layout_free(struct window *);
|
|
|
|
void layout_resize(struct window *, u_int, u_int);
|
|
|
|
void layout_resize_pane(
|
|
|
|
struct window_pane *, enum layout_type, int);
|
|
|
|
int layout_split_pane(struct window_pane *,
|
|
|
|
enum layout_type, int, struct window_pane *);
|
|
|
|
void layout_close_pane(struct window_pane *);
|
|
|
|
|
|
|
|
/* layout-set.c */
|
|
|
|
const char *layout_set_name(u_int);
|
|
|
|
int layout_set_lookup(const char *);
|
|
|
|
u_int layout_set_select(struct window *, u_int);
|
|
|
|
u_int layout_set_next(struct window *);
|
|
|
|
u_int layout_set_previous(struct window *);
|
|
|
|
void layout_set_active_changed(struct window *);
|
2009-05-18 21:01:38 +00:00
|
|
|
|
2009-01-10 19:35:40 +00:00
|
|
|
/* window-clock.c */
|
|
|
|
extern const struct window_mode window_clock_mode;
|
|
|
|
|
2007-11-22 18:09:43 +00:00
|
|
|
/* window-copy.c */
|
|
|
|
extern const struct window_mode window_copy_mode;
|
2009-01-27 23:35:44 +00:00
|
|
|
void window_copy_pageup(struct window_pane *);
|
2007-11-22 18:09:43 +00:00
|
|
|
|
2007-11-21 13:11:41 +00:00
|
|
|
/* window-scroll.c */
|
|
|
|
extern const struct window_mode window_scroll_mode;
|
2009-01-27 23:35:44 +00:00
|
|
|
void window_scroll_pageup(struct window_pane *);
|
2007-07-09 19:04:12 +00:00
|
|
|
|
2007-11-21 19:44:05 +00:00
|
|
|
/* window-more.c */
|
|
|
|
extern const struct window_mode window_more_mode;
|
2009-01-11 23:31:46 +00:00
|
|
|
void window_more_vadd(struct window_pane *, const char *, va_list);
|
2007-11-21 19:44:05 +00:00
|
|
|
|
2009-01-15 19:27:31 +00:00
|
|
|
/* window-choose.c */
|
|
|
|
extern const struct window_mode window_choose_mode;
|
|
|
|
void window_choose_vadd(
|
|
|
|
struct window_pane *, int, const char *, va_list);
|
|
|
|
void printflike3 window_choose_add(
|
|
|
|
struct window_pane *, int, const char *, ...);
|
|
|
|
void window_choose_ready(struct window_pane *,
|
2009-07-17 12:12:54 +00:00
|
|
|
u_int, void (*)(void *, int), void (*)(void *), void *);
|
2009-01-15 19:27:31 +00:00
|
|
|
|
2009-01-20 19:35:03 +00:00
|
|
|
/* names.c */
|
|
|
|
void set_window_names(void);
|
|
|
|
char *default_window_name(struct window *);
|
|
|
|
|
2007-07-09 19:04:12 +00:00
|
|
|
/* session.c */
|
|
|
|
extern struct sessions sessions;
|
2008-06-06 17:55:27 +00:00
|
|
|
void session_alert_add(struct session *, struct window *, int);
|
|
|
|
void session_alert_cancel(struct session *, struct winlink *);
|
|
|
|
int session_alert_has(struct session *, struct winlink *, int);
|
|
|
|
int session_alert_has_window(struct session *, struct window *, int);
|
2007-07-09 19:04:12 +00:00
|
|
|
struct session *session_find(const char *);
|
2009-08-16 18:59:12 +00:00
|
|
|
struct session *session_create(const char *, const char *, const char *,
|
2009-08-16 19:16:27 +00:00
|
|
|
struct environ *, struct termios *, int, u_int, u_int,
|
|
|
|
char **);
|
2008-06-06 17:55:27 +00:00
|
|
|
void session_destroy(struct session *);
|
|
|
|
int session_index(struct session *, u_int *);
|
2009-05-04 17:58:27 +00:00
|
|
|
struct winlink *session_new(struct session *,
|
2009-01-23 16:59:14 +00:00
|
|
|
const char *, const char *, const char *, int, char **);
|
|
|
|
struct winlink *session_attach(
|
|
|
|
struct session *, struct window *, int, char **);
|
2007-10-26 12:29:07 +00:00
|
|
|
int session_detach(struct session *, struct winlink *);
|
2007-07-09 19:04:12 +00:00
|
|
|
int session_has(struct session *, struct window *);
|
2009-01-18 18:31:45 +00:00
|
|
|
int session_next(struct session *, int);
|
|
|
|
int session_previous(struct session *, int);
|
2007-10-26 16:57:32 +00:00
|
|
|
int session_select(struct session *, int);
|
2007-09-20 18:03:23 +00:00
|
|
|
int session_last(struct session *);
|
2007-07-09 19:04:12 +00:00
|
|
|
|
2008-09-09 22:16:37 +00:00
|
|
|
/* utf8.c */
|
2009-04-30 20:54:53 +00:00
|
|
|
void utf8_build(void);
|
2009-06-25 16:00:50 +00:00
|
|
|
int utf8_width(const u_char *);
|
2008-09-09 22:16:37 +00:00
|
|
|
|
2009-01-20 19:35:03 +00:00
|
|
|
/* osdep-*.c */
|
2009-02-13 00:43:04 +00:00
|
|
|
char *osdep_get_name(int, char *);
|
2009-01-20 19:35:03 +00:00
|
|
|
|
2007-07-09 19:04:12 +00:00
|
|
|
/* buffer.c */
|
|
|
|
struct buffer *buffer_create(size_t);
|
|
|
|
void buffer_destroy(struct buffer *);
|
|
|
|
void buffer_ensure(struct buffer *, size_t);
|
|
|
|
void buffer_add(struct buffer *, size_t);
|
|
|
|
void buffer_remove(struct buffer *, size_t);
|
|
|
|
void buffer_write(struct buffer *, const void *, size_t);
|
|
|
|
void buffer_read(struct buffer *, void *, size_t);
|
2007-11-27 19:23:34 +00:00
|
|
|
void buffer_write8(struct buffer *, uint8_t);
|
|
|
|
uint8_t buffer_read8(struct buffer *);
|
2007-07-09 19:04:12 +00:00
|
|
|
|
|
|
|
/* buffer-poll.c */
|
|
|
|
int buffer_poll(struct pollfd *, struct buffer *, struct buffer *);
|
|
|
|
|
|
|
|
/* log.c */
|
2008-08-08 17:35:42 +00:00
|
|
|
void log_open_tty(int);
|
|
|
|
void log_open_file(int, const char *);
|
2007-07-09 19:04:12 +00:00
|
|
|
void log_close(void);
|
|
|
|
void printflike1 log_warn(const char *, ...);
|
|
|
|
void printflike1 log_warnx(const char *, ...);
|
|
|
|
void printflike1 log_info(const char *, ...);
|
|
|
|
void printflike1 log_debug(const char *, ...);
|
|
|
|
void printflike1 log_debug2(const char *, ...);
|
2009-08-20 11:35:16 +00:00
|
|
|
__dead void printflike1 log_fatal(const char *, ...);
|
|
|
|
__dead void printflike1 log_fatalx(const char *, ...);
|
2007-07-09 19:04:12 +00:00
|
|
|
|
|
|
|
/* xmalloc.c */
|
|
|
|
char *xstrdup(const char *);
|
|
|
|
void *xcalloc(size_t, size_t);
|
|
|
|
void *xmalloc(size_t);
|
|
|
|
void *xrealloc(void *, size_t, size_t);
|
|
|
|
void xfree(void *);
|
|
|
|
int printflike2 xasprintf(char **, const char *, ...);
|
|
|
|
int xvasprintf(char **, const char *, va_list);
|
|
|
|
int printflike3 xsnprintf(char *, size_t, const char *, ...);
|
|
|
|
int xvsnprintf(char *, size_t, const char *, va_list);
|
|
|
|
|
2009-06-25 16:34:50 +00:00
|
|
|
#endif /* TMUX_H */
|