2014-11-08 12:27:43 +00:00
|
|
|
/* $OpenBSD$ */
|
2007-07-09 19:04:12 +00:00
|
|
|
|
|
|
|
/*
|
2016-01-19 15:59:12 +00:00
|
|
|
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
2007-07-09 19:04:12 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
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
|
|
|
|
2009-11-08 22:40:36 +00:00
|
|
|
#include <event.h>
|
2008-05-31 18:04:57 +00:00
|
|
|
#include <limits.h>
|
2007-07-09 19:04:12 +00:00
|
|
|
#include <stdarg.h>
|
2008-06-18 20:11:25 +00:00
|
|
|
#include <stdio.h>
|
2009-01-09 23:57:42 +00:00
|
|
|
#include <termios.h>
|
2016-03-01 12:02:08 +00:00
|
|
|
#include <wchar.h>
|
2007-07-09 19:04:12 +00:00
|
|
|
|
2014-02-24 23:07:22 +00:00
|
|
|
#ifdef HAVE_UTEMPTER
|
|
|
|
#include <utempter.h>
|
|
|
|
#endif
|
|
|
|
|
2009-06-25 17:02:59 +00:00
|
|
|
#include "compat.h"
|
2015-11-19 22:46:46 +00:00
|
|
|
#include "xmalloc.h"
|
2009-06-25 17:02:59 +00:00
|
|
|
|
2009-08-09 17:48:55 +00:00
|
|
|
extern char **environ;
|
2007-07-09 19:04:12 +00:00
|
|
|
|
2016-10-11 07:23:34 +00:00
|
|
|
struct args;
|
2019-04-28 20:05:50 +00:00
|
|
|
struct args_value;
|
2015-10-28 09:51:55 +00:00
|
|
|
struct client;
|
Rewrite of choose mode, both to simplify and tidy the code and to add
some modern features.
Now the common code is in mode-tree.c, which provides an API used by the
three modes now separated into window-{buffer,client,tree}.c. Buffer
mode shows buffers, client mode clients and tree mode a tree of
sessions, windows and panes.
Each mode has a common set of key bindings plus a few that are specific
to the mode. Other changes are:
- each mode has a preview pane: for buffers this is the buffer content
(very useful), for others it is a preview of the pane;
- items may be sorted in different ways ('O' key);
- multiple items may be tagged and an operation applied to all of them
(for example, to delete multiple buffers at once);
- in tree mode a command may be run on the selected item (session,
window, pane) or on tagged items (key ':');
- displayed items may be filtered in tree mode by using a format (this
is used to implement find-window) (key 'f');
- the custom format (-F) for the display is no longer available;
- shortcut keys change from 0-9, a-z, A-Z which was always a bit weird
with keys used for other uses to 0-9, M-a to M-z.
Now that the code is simpler, other improvements will come later.
Primary key bindings for each mode are documented under the commands in
the man page (choose-buffer, choose-client, choose-tree).
Parts written by Thomas Adam.
2017-05-30 21:44:59 +00:00
|
|
|
struct cmd_find_state;
|
2016-10-16 19:04:05 +00:00
|
|
|
struct cmdq_item;
|
|
|
|
struct cmdq_list;
|
2015-10-28 09:51:55 +00:00
|
|
|
struct environ;
|
2017-05-01 12:20:55 +00:00
|
|
|
struct format_job_tree;
|
2019-03-07 19:01:21 +00:00
|
|
|
struct format_tree;
|
2015-10-28 09:51:55 +00:00
|
|
|
struct input_ctx;
|
2018-08-23 15:45:05 +00:00
|
|
|
struct job;
|
Rewrite of choose mode, both to simplify and tidy the code and to add
some modern features.
Now the common code is in mode-tree.c, which provides an API used by the
three modes now separated into window-{buffer,client,tree}.c. Buffer
mode shows buffers, client mode clients and tree mode a tree of
sessions, windows and panes.
Each mode has a common set of key bindings plus a few that are specific
to the mode. Other changes are:
- each mode has a preview pane: for buffers this is the buffer content
(very useful), for others it is a preview of the pane;
- items may be sorted in different ways ('O' key);
- multiple items may be tagged and an operation applied to all of them
(for example, to delete multiple buffers at once);
- in tree mode a command may be run on the selected item (session,
window, pane) or on tagged items (key ':');
- displayed items may be filtered in tree mode by using a format (this
is used to implement find-window) (key 'f');
- the custom format (-F) for the display is no longer available;
- shortcut keys change from 0-9, a-z, A-Z which was always a bit weird
with keys used for other uses to 0-9, M-a to M-z.
Now that the code is simpler, other improvements will come later.
Primary key bindings for each mode are documented under the commands in
the man page (choose-buffer, choose-client, choose-tree).
Parts written by Thomas Adam.
2017-05-30 21:44:59 +00:00
|
|
|
struct mode_tree_data;
|
2015-10-28 09:51:55 +00:00
|
|
|
struct mouse_event;
|
|
|
|
struct options;
|
2017-01-16 14:49:14 +00:00
|
|
|
struct options_entry;
|
2019-03-18 11:58:40 +00:00
|
|
|
struct options_array_item;
|
2015-10-28 09:51:55 +00:00
|
|
|
struct session;
|
|
|
|
struct tmuxpeer;
|
|
|
|
struct tmuxproc;
|
2018-12-18 13:20:44 +00:00
|
|
|
struct winlink;
|
2015-10-28 09:51:55 +00:00
|
|
|
|
2018-08-02 11:18:34 +00:00
|
|
|
/* Client-server protocol version. */
|
|
|
|
#define PROTOCOL_VERSION 8
|
|
|
|
|
2019-12-10 14:22:15 +00:00
|
|
|
/* Default configuration files. */
|
2017-03-09 15:39:13 +00:00
|
|
|
#ifndef TMUX_CONF
|
2019-12-10 14:22:15 +00:00
|
|
|
#define TMUX_CONF "/etc/tmux.conf:~/.tmux.conf"
|
2017-03-09 15:39:13 +00:00
|
|
|
#endif
|
2009-01-06 15:37:15 +00:00
|
|
|
|
2018-09-25 14:27:20 +00:00
|
|
|
/* Minimum layout cell size, NOT including border lines. */
|
|
|
|
#define PANE_MINIMUM 1
|
2009-01-14 19:29:32 +00:00
|
|
|
|
Support for windows larger than the client.
This adds two new options, window-size and default-size, and a new
command, resize-window.
The force-width and force-height options, and the session_width and
session_height formats have been removed.
The new window-size option tells tmux how to work out the size of
windows: largest means it picks the size of the largest session,
smallest the smallest session (similar to the old behaviour) and
manual means that it does not automatically resize
windows. aggressive-resize modifies the choice of session for largest
and smallest as it did before.
If a window is in a session attached to a client that is too small,
only part of the window is shown. tmux attempts to keep the cursor
visible, so the part of the window displayed is changed as the cursor
moves (with a small delay, to try and avoid excess redrawing when
applications redraw status lines or similar that are not currently
visible).
Drawing windows which are larger than the client is not as efficient
as those which fit, particularly when the cursor moves, so it is
recommended to avoid using this on slow machines or networks (set
window-size to smallest or manual).
The resize-window command can be used to resize a window manually. If
it is used, the window-size option is automatically set to manual for
the window (undo this with "setw -u window-size"). resize-window works
in a similar way to resize-pane (-U -D -L -R -x -y flags) but also has
-a and -A flags. -a sets the window to the size of the smallest client
(what it would be if window-size was smallest) and -A the largest.
For the same behaviour as force-width or force-height, use
resize-width -x or -y.
If the global window-size option is set to manual, the default-size
option is used for new windows. If -x or -y is used with new-session,
that sets the default-size option for the new session.
The maximum size of a window is 10000x10000. But expect applications
to complain and higher memory use if you make a window that big. The
minimum size is the size required for the current layout including
borders.
This change allows some code improvements, most notably that since
windows can now never be cropped, that code can be removed from the
layout code, and since panes can now never be outside the size of the
window, window_pane_visible can be removed.
2018-08-20 14:22:14 +00:00
|
|
|
/* Minimum and maximum window size. */
|
|
|
|
#define WINDOW_MINIMUM PANE_MINIMUM
|
|
|
|
#define WINDOW_MAXIMUM 10000
|
|
|
|
|
2015-08-29 00:29:15 +00:00
|
|
|
/* Automatic name refresh interval, in microseconds. Must be < 1 second. */
|
|
|
|
#define NAME_INTERVAL 500000
|
2009-01-20 19:35:03 +00:00
|
|
|
|
2017-02-08 08:25:12 +00:00
|
|
|
/* Maximum size of data to hold from a pane. */
|
|
|
|
#define READ_SIZE 4096
|
2015-05-12 22:40:38 +00:00
|
|
|
|
2019-11-28 09:45:15 +00:00
|
|
|
/* Default pixel cell sizes. */
|
|
|
|
#define DEFAULT_XPIXEL 16
|
|
|
|
#define DEFAULT_YPIXEL 32
|
|
|
|
|
2017-01-09 19:27:00 +00:00
|
|
|
/* Attribute to make GCC check printf-like arguments. */
|
2014-10-20 23:57:13 +00:00
|
|
|
#define printflike(a, b) __attribute__ ((format (printf, a, b)))
|
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
|
|
|
|
2017-08-16 11:46:08 +00:00
|
|
|
/* Alert option values. */
|
|
|
|
#define ALERT_NONE 0
|
|
|
|
#define ALERT_ANY 1
|
|
|
|
#define ALERT_CURRENT 2
|
|
|
|
#define ALERT_OTHER 3
|
2008-06-04 16:46:23 +00:00
|
|
|
|
2017-07-26 16:14:08 +00:00
|
|
|
/* Visual option values. */
|
|
|
|
#define VISUAL_OFF 0
|
|
|
|
#define VISUAL_ON 1
|
|
|
|
#define VISUAL_BOTH 2
|
|
|
|
|
2009-11-10 23:31:21 +00:00
|
|
|
/* Special key codes. */
|
2015-11-12 11:05:34 +00:00
|
|
|
#define KEYC_NONE 0xffff00000000ULL
|
2015-12-12 18:19:00 +00:00
|
|
|
#define KEYC_UNKNOWN 0xfffe00000000ULL
|
2016-11-04 14:47:38 +00:00
|
|
|
#define KEYC_BASE 0x000010000000ULL
|
2017-06-23 15:36:52 +00:00
|
|
|
#define KEYC_USER 0x000020000000ULL
|
|
|
|
|
|
|
|
/* Available user keys. */
|
|
|
|
#define KEYC_NUSER 1000
|
2009-11-10 23:31:21 +00:00
|
|
|
|
|
|
|
/* Key modifier bits. */
|
2015-11-12 11:05:34 +00:00
|
|
|
#define KEYC_ESCAPE 0x200000000000ULL
|
2017-06-28 11:36:39 +00:00
|
|
|
#define KEYC_CTRL 0x400000000000ULL
|
|
|
|
#define KEYC_SHIFT 0x800000000000ULL
|
2017-05-07 21:25:59 +00:00
|
|
|
#define KEYC_XTERM 0x1000000000000ULL
|
2019-07-09 14:03:12 +00:00
|
|
|
#define KEYC_LITERAL 0x2000000000000ULL
|
2009-07-22 16:24:59 +00:00
|
|
|
|
2011-04-06 22:17:33 +00:00
|
|
|
/* Mask to obtain key w/o modifiers. */
|
2019-07-09 14:03:12 +00:00
|
|
|
#define KEYC_MASK_MOD (KEYC_ESCAPE|KEYC_CTRL|KEYC_SHIFT|KEYC_XTERM|KEYC_LITERAL)
|
2010-06-05 20:29:11 +00:00
|
|
|
#define KEYC_MASK_KEY (~KEYC_MASK_MOD)
|
|
|
|
|
2015-04-19 21:34:21 +00:00
|
|
|
/* Is this a mouse key? */
|
|
|
|
#define KEYC_IS_MOUSE(key) (((key) & KEYC_MASK_KEY) >= KEYC_MOUSE && \
|
|
|
|
((key) & KEYC_MASK_KEY) < KEYC_BSPACE)
|
|
|
|
|
2016-10-11 09:30:36 +00:00
|
|
|
/* Multiple click timeout. */
|
|
|
|
#define KEYC_CLICK_TIMEOUT 300
|
|
|
|
|
2015-04-19 21:34:21 +00:00
|
|
|
/* Mouse key codes. */
|
2018-08-22 20:06:14 +00:00
|
|
|
#define KEYC_MOUSE_KEY(name) \
|
|
|
|
KEYC_ ## name ## _PANE, \
|
|
|
|
KEYC_ ## name ## _STATUS, \
|
|
|
|
KEYC_ ## name ## _STATUS_LEFT, \
|
|
|
|
KEYC_ ## name ## _STATUS_RIGHT, \
|
2019-03-25 18:59:55 +00:00
|
|
|
KEYC_ ## name ## _STATUS_DEFAULT, \
|
2015-04-19 21:34:21 +00:00
|
|
|
KEYC_ ## name ## _BORDER
|
2018-08-22 20:06:14 +00:00
|
|
|
#define KEYC_MOUSE_STRING(name, s) \
|
|
|
|
{ #s "Pane", KEYC_ ## name ## _PANE }, \
|
|
|
|
{ #s "Status", KEYC_ ## name ## _STATUS }, \
|
|
|
|
{ #s "StatusLeft", KEYC_ ## name ## _STATUS_LEFT }, \
|
|
|
|
{ #s "StatusRight", KEYC_ ## name ## _STATUS_RIGHT }, \
|
2019-03-25 18:59:55 +00:00
|
|
|
{ #s "StatusDefault", KEYC_ ## name ## _STATUS_DEFAULT }, \
|
2015-04-19 21:34:21 +00:00
|
|
|
{ #s "Border", KEYC_ ## name ## _BORDER }
|
|
|
|
|
2015-11-12 11:05:34 +00:00
|
|
|
/*
|
|
|
|
* A single key. This can be ASCII or Unicode or one of the keys starting at
|
|
|
|
* KEYC_BASE.
|
|
|
|
*/
|
2015-11-15 22:50:38 +00:00
|
|
|
typedef unsigned long long key_code;
|
2015-11-12 11:05:34 +00:00
|
|
|
|
2015-04-19 21:34:21 +00:00
|
|
|
/* Special key codes. */
|
2015-11-12 11:05:34 +00:00
|
|
|
enum {
|
2015-04-19 21:34:21 +00:00
|
|
|
/* Focus events. */
|
|
|
|
KEYC_FOCUS_IN = KEYC_BASE,
|
|
|
|
KEYC_FOCUS_OUT,
|
|
|
|
|
2018-07-16 08:48:22 +00:00
|
|
|
/* "Any" key, used if not found in key table. */
|
|
|
|
KEYC_ANY,
|
|
|
|
|
2017-06-12 07:04:24 +00:00
|
|
|
/* Paste brackets. */
|
|
|
|
KEYC_PASTE_START,
|
|
|
|
KEYC_PASTE_END,
|
|
|
|
|
2015-04-19 21:34:21 +00:00
|
|
|
/* Mouse keys. */
|
|
|
|
KEYC_MOUSE, /* unclassified mouse event */
|
2016-11-24 18:45:45 +00:00
|
|
|
KEYC_DRAGGING, /* dragging in progress */
|
2017-02-01 09:55:07 +00:00
|
|
|
KEYC_MOUSE_KEY(MOUSEMOVE),
|
2015-04-19 21:34:21 +00:00
|
|
|
KEYC_MOUSE_KEY(MOUSEDOWN1),
|
|
|
|
KEYC_MOUSE_KEY(MOUSEDOWN2),
|
|
|
|
KEYC_MOUSE_KEY(MOUSEDOWN3),
|
|
|
|
KEYC_MOUSE_KEY(MOUSEUP1),
|
|
|
|
KEYC_MOUSE_KEY(MOUSEUP2),
|
|
|
|
KEYC_MOUSE_KEY(MOUSEUP3),
|
|
|
|
KEYC_MOUSE_KEY(MOUSEDRAG1),
|
|
|
|
KEYC_MOUSE_KEY(MOUSEDRAG2),
|
|
|
|
KEYC_MOUSE_KEY(MOUSEDRAG3),
|
2016-03-18 07:28:27 +00:00
|
|
|
KEYC_MOUSE_KEY(MOUSEDRAGEND1),
|
|
|
|
KEYC_MOUSE_KEY(MOUSEDRAGEND2),
|
|
|
|
KEYC_MOUSE_KEY(MOUSEDRAGEND3),
|
2015-04-19 21:34:21 +00:00
|
|
|
KEYC_MOUSE_KEY(WHEELUP),
|
|
|
|
KEYC_MOUSE_KEY(WHEELDOWN),
|
2016-10-11 09:30:36 +00:00
|
|
|
KEYC_MOUSE_KEY(DOUBLECLICK1),
|
|
|
|
KEYC_MOUSE_KEY(DOUBLECLICK2),
|
|
|
|
KEYC_MOUSE_KEY(DOUBLECLICK3),
|
|
|
|
KEYC_MOUSE_KEY(TRIPLECLICK1),
|
|
|
|
KEYC_MOUSE_KEY(TRIPLECLICK2),
|
|
|
|
KEYC_MOUSE_KEY(TRIPLECLICK3),
|
2009-07-22 16:24:59 +00:00
|
|
|
|
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_IC,
|
|
|
|
KEYC_DC,
|
|
|
|
KEYC_HOME,
|
|
|
|
KEYC_END,
|
|
|
|
KEYC_NPAGE,
|
|
|
|
KEYC_PPAGE,
|
|
|
|
KEYC_BTAB,
|
|
|
|
|
|
|
|
/* Arrow keys. */
|
|
|
|
KEYC_UP,
|
|
|
|
KEYC_DOWN,
|
|
|
|
KEYC_LEFT,
|
|
|
|
KEYC_RIGHT,
|
|
|
|
|
2009-10-28 22:53:03 +00:00
|
|
|
/* Numeric keypad. */
|
|
|
|
KEYC_KP_SLASH,
|
|
|
|
KEYC_KP_STAR,
|
|
|
|
KEYC_KP_MINUS,
|
|
|
|
KEYC_KP_SEVEN,
|
|
|
|
KEYC_KP_EIGHT,
|
|
|
|
KEYC_KP_NINE,
|
|
|
|
KEYC_KP_PLUS,
|
|
|
|
KEYC_KP_FOUR,
|
|
|
|
KEYC_KP_FIVE,
|
|
|
|
KEYC_KP_SIX,
|
|
|
|
KEYC_KP_ONE,
|
|
|
|
KEYC_KP_TWO,
|
|
|
|
KEYC_KP_THREE,
|
|
|
|
KEYC_KP_ENTER,
|
|
|
|
KEYC_KP_ZERO,
|
|
|
|
KEYC_KP_PERIOD,
|
2009-07-22 16:24:59 +00:00
|
|
|
};
|
2008-07-23 23:44:50 +00:00
|
|
|
|
2009-01-09 23:57:42 +00:00
|
|
|
/* Termcap codes. */
|
|
|
|
enum tty_code_code {
|
2017-05-31 08:43:44 +00:00
|
|
|
TTYC_ACSC,
|
2019-04-07 12:01:03 +00:00
|
|
|
TTYC_AX,
|
2017-05-31 08:43:44 +00:00
|
|
|
TTYC_BCE,
|
|
|
|
TTYC_BEL,
|
|
|
|
TTYC_BLINK,
|
|
|
|
TTYC_BOLD,
|
|
|
|
TTYC_CIVIS,
|
|
|
|
TTYC_CLEAR,
|
|
|
|
TTYC_CNORM,
|
|
|
|
TTYC_COLORS,
|
|
|
|
TTYC_CR,
|
|
|
|
TTYC_CS,
|
|
|
|
TTYC_CSR,
|
|
|
|
TTYC_CUB,
|
|
|
|
TTYC_CUB1,
|
|
|
|
TTYC_CUD,
|
|
|
|
TTYC_CUD1,
|
|
|
|
TTYC_CUF,
|
|
|
|
TTYC_CUF1,
|
|
|
|
TTYC_CUP,
|
|
|
|
TTYC_CUU,
|
|
|
|
TTYC_CUU1,
|
|
|
|
TTYC_CVVIS,
|
|
|
|
TTYC_DCH,
|
|
|
|
TTYC_DCH1,
|
|
|
|
TTYC_DIM,
|
|
|
|
TTYC_DL,
|
|
|
|
TTYC_DL1,
|
2011-10-23 15:10:22 +00:00
|
|
|
TTYC_E3,
|
2017-05-31 08:43:44 +00:00
|
|
|
TTYC_ECH,
|
|
|
|
TTYC_ED,
|
|
|
|
TTYC_EL,
|
|
|
|
TTYC_EL1,
|
|
|
|
TTYC_ENACS,
|
|
|
|
TTYC_FSL,
|
|
|
|
TTYC_HOME,
|
|
|
|
TTYC_HPA,
|
|
|
|
TTYC_ICH,
|
|
|
|
TTYC_ICH1,
|
|
|
|
TTYC_IL,
|
|
|
|
TTYC_IL1,
|
|
|
|
TTYC_INDN,
|
|
|
|
TTYC_INVIS,
|
|
|
|
TTYC_KCBT,
|
|
|
|
TTYC_KCUB1,
|
|
|
|
TTYC_KCUD1,
|
|
|
|
TTYC_KCUF1,
|
|
|
|
TTYC_KCUU1,
|
2009-10-28 23:01:44 +00:00
|
|
|
TTYC_KDC2,
|
|
|
|
TTYC_KDC3,
|
|
|
|
TTYC_KDC4,
|
|
|
|
TTYC_KDC5,
|
|
|
|
TTYC_KDC6,
|
|
|
|
TTYC_KDC7,
|
2017-05-31 08:43:44 +00:00
|
|
|
TTYC_KDCH1,
|
2009-10-28 23:01:44 +00:00
|
|
|
TTYC_KDN2,
|
|
|
|
TTYC_KDN3,
|
|
|
|
TTYC_KDN4,
|
|
|
|
TTYC_KDN5,
|
|
|
|
TTYC_KDN6,
|
|
|
|
TTYC_KDN7,
|
2017-05-31 08:43:44 +00:00
|
|
|
TTYC_KEND,
|
2009-10-28 23:01:44 +00:00
|
|
|
TTYC_KEND2,
|
|
|
|
TTYC_KEND3,
|
|
|
|
TTYC_KEND4,
|
|
|
|
TTYC_KEND5,
|
|
|
|
TTYC_KEND6,
|
|
|
|
TTYC_KEND7,
|
2014-07-21 10:25:48 +00:00
|
|
|
TTYC_KF1,
|
|
|
|
TTYC_KF10,
|
|
|
|
TTYC_KF11,
|
|
|
|
TTYC_KF12,
|
|
|
|
TTYC_KF13,
|
|
|
|
TTYC_KF14,
|
|
|
|
TTYC_KF15,
|
|
|
|
TTYC_KF16,
|
|
|
|
TTYC_KF17,
|
|
|
|
TTYC_KF18,
|
|
|
|
TTYC_KF19,
|
|
|
|
TTYC_KF2,
|
|
|
|
TTYC_KF20,
|
|
|
|
TTYC_KF21,
|
|
|
|
TTYC_KF22,
|
|
|
|
TTYC_KF23,
|
|
|
|
TTYC_KF24,
|
|
|
|
TTYC_KF25,
|
|
|
|
TTYC_KF26,
|
|
|
|
TTYC_KF27,
|
|
|
|
TTYC_KF28,
|
|
|
|
TTYC_KF29,
|
|
|
|
TTYC_KF3,
|
|
|
|
TTYC_KF30,
|
|
|
|
TTYC_KF31,
|
|
|
|
TTYC_KF32,
|
|
|
|
TTYC_KF33,
|
|
|
|
TTYC_KF34,
|
|
|
|
TTYC_KF35,
|
|
|
|
TTYC_KF36,
|
|
|
|
TTYC_KF37,
|
|
|
|
TTYC_KF38,
|
|
|
|
TTYC_KF39,
|
|
|
|
TTYC_KF4,
|
|
|
|
TTYC_KF40,
|
|
|
|
TTYC_KF41,
|
|
|
|
TTYC_KF42,
|
|
|
|
TTYC_KF43,
|
|
|
|
TTYC_KF44,
|
|
|
|
TTYC_KF45,
|
|
|
|
TTYC_KF46,
|
|
|
|
TTYC_KF47,
|
|
|
|
TTYC_KF48,
|
|
|
|
TTYC_KF49,
|
|
|
|
TTYC_KF5,
|
|
|
|
TTYC_KF50,
|
|
|
|
TTYC_KF51,
|
|
|
|
TTYC_KF52,
|
|
|
|
TTYC_KF53,
|
|
|
|
TTYC_KF54,
|
|
|
|
TTYC_KF55,
|
|
|
|
TTYC_KF56,
|
|
|
|
TTYC_KF57,
|
|
|
|
TTYC_KF58,
|
|
|
|
TTYC_KF59,
|
|
|
|
TTYC_KF6,
|
|
|
|
TTYC_KF60,
|
|
|
|
TTYC_KF61,
|
|
|
|
TTYC_KF62,
|
|
|
|
TTYC_KF63,
|
|
|
|
TTYC_KF7,
|
|
|
|
TTYC_KF8,
|
|
|
|
TTYC_KF9,
|
2009-10-28 23:01:44 +00:00
|
|
|
TTYC_KHOM2,
|
|
|
|
TTYC_KHOM3,
|
|
|
|
TTYC_KHOM4,
|
|
|
|
TTYC_KHOM5,
|
|
|
|
TTYC_KHOM6,
|
|
|
|
TTYC_KHOM7,
|
2017-05-31 08:43:44 +00:00
|
|
|
TTYC_KHOME,
|
2009-10-28 23:01:44 +00:00
|
|
|
TTYC_KIC2,
|
|
|
|
TTYC_KIC3,
|
|
|
|
TTYC_KIC4,
|
|
|
|
TTYC_KIC5,
|
|
|
|
TTYC_KIC6,
|
|
|
|
TTYC_KIC7,
|
2017-05-31 08:43:44 +00:00
|
|
|
TTYC_KICH1,
|
2017-08-27 08:33:55 +00:00
|
|
|
TTYC_KIND,
|
2009-10-28 23:01:44 +00:00
|
|
|
TTYC_KLFT2,
|
|
|
|
TTYC_KLFT3,
|
|
|
|
TTYC_KLFT4,
|
|
|
|
TTYC_KLFT5,
|
|
|
|
TTYC_KLFT6,
|
|
|
|
TTYC_KLFT7,
|
2017-05-31 08:43:44 +00:00
|
|
|
TTYC_KMOUS,
|
|
|
|
TTYC_KNP,
|
2009-10-28 23:01:44 +00:00
|
|
|
TTYC_KNXT2,
|
|
|
|
TTYC_KNXT3,
|
|
|
|
TTYC_KNXT4,
|
|
|
|
TTYC_KNXT5,
|
|
|
|
TTYC_KNXT6,
|
|
|
|
TTYC_KNXT7,
|
2017-05-31 08:43:44 +00:00
|
|
|
TTYC_KPP,
|
2009-10-28 23:01:44 +00:00
|
|
|
TTYC_KPRV2,
|
|
|
|
TTYC_KPRV3,
|
|
|
|
TTYC_KPRV4,
|
|
|
|
TTYC_KPRV5,
|
|
|
|
TTYC_KPRV6,
|
|
|
|
TTYC_KPRV7,
|
2017-08-27 08:33:55 +00:00
|
|
|
TTYC_KRI,
|
2009-10-28 23:01:44 +00:00
|
|
|
TTYC_KRIT2,
|
|
|
|
TTYC_KRIT3,
|
|
|
|
TTYC_KRIT4,
|
|
|
|
TTYC_KRIT5,
|
|
|
|
TTYC_KRIT6,
|
|
|
|
TTYC_KRIT7,
|
|
|
|
TTYC_KUP2,
|
|
|
|
TTYC_KUP3,
|
|
|
|
TTYC_KUP4,
|
|
|
|
TTYC_KUP5,
|
|
|
|
TTYC_KUP6,
|
|
|
|
TTYC_KUP7,
|
2017-05-31 08:43:44 +00:00
|
|
|
TTYC_MS,
|
|
|
|
TTYC_OP,
|
|
|
|
TTYC_REV,
|
2018-02-04 10:10:39 +00:00
|
|
|
TTYC_RGB,
|
2017-05-31 08:43:44 +00:00
|
|
|
TTYC_RI,
|
2019-08-05 06:42:02 +00:00
|
|
|
TTYC_RIN,
|
2017-05-31 08:43:44 +00:00
|
|
|
TTYC_RMACS,
|
|
|
|
TTYC_RMCUP,
|
|
|
|
TTYC_RMKX,
|
|
|
|
TTYC_SE,
|
|
|
|
TTYC_SETAB,
|
|
|
|
TTYC_SETAF,
|
|
|
|
TTYC_SETRGBB,
|
|
|
|
TTYC_SETRGBF,
|
2019-06-27 15:17:41 +00:00
|
|
|
TTYC_SETULC,
|
2017-05-31 08:43:44 +00:00
|
|
|
TTYC_SGR0,
|
|
|
|
TTYC_SITM,
|
|
|
|
TTYC_SMACS,
|
|
|
|
TTYC_SMCUP,
|
2019-05-13 20:10:23 +00:00
|
|
|
TTYC_SMOL,
|
2017-05-31 08:43:44 +00:00
|
|
|
TTYC_SMKX,
|
|
|
|
TTYC_SMSO,
|
2018-10-08 12:21:37 +00:00
|
|
|
TTYC_SMULX,
|
2017-05-31 08:43:44 +00:00
|
|
|
TTYC_SMUL,
|
2017-03-22 07:16:54 +00:00
|
|
|
TTYC_SMXX,
|
2017-05-31 08:43:44 +00:00
|
|
|
TTYC_SS,
|
|
|
|
TTYC_TC,
|
|
|
|
TTYC_TSL,
|
2017-05-15 16:44:04 +00:00
|
|
|
TTYC_U8,
|
2017-05-31 08:43:44 +00:00
|
|
|
TTYC_VPA,
|
|
|
|
TTYC_XENL,
|
|
|
|
TTYC_XT,
|
2009-01-09 23:57:42 +00:00
|
|
|
};
|
2009-01-10 01:30:38 +00:00
|
|
|
|
2007-07-09 19:04:12 +00:00
|
|
|
/* Message codes. */
|
2009-07-30 20:21:55 +00:00
|
|
|
enum msgtype {
|
2013-10-05 23:06:01 +00:00
|
|
|
MSG_VERSION = 12,
|
|
|
|
|
|
|
|
MSG_IDENTIFY_FLAGS = 100,
|
|
|
|
MSG_IDENTIFY_TERM,
|
|
|
|
MSG_IDENTIFY_TTYNAME,
|
2015-10-18 20:42:42 +00:00
|
|
|
MSG_IDENTIFY_OLDCWD, /* unused */
|
2013-10-05 23:06:01 +00:00
|
|
|
MSG_IDENTIFY_STDIN,
|
|
|
|
MSG_IDENTIFY_ENVIRON,
|
|
|
|
MSG_IDENTIFY_DONE,
|
2015-06-14 10:07:44 +00:00
|
|
|
MSG_IDENTIFY_CLIENTPID,
|
2015-10-18 20:42:42 +00:00
|
|
|
MSG_IDENTIFY_CWD,
|
2013-10-05 23:06:01 +00:00
|
|
|
|
|
|
|
MSG_COMMAND = 200,
|
2009-01-11 00:48:42 +00:00
|
|
|
MSG_DETACH,
|
2013-10-05 23:06:01 +00:00
|
|
|
MSG_DETACHKILL,
|
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,
|
2013-10-05 23:06:01 +00:00
|
|
|
MSG_LOCK,
|
2007-10-03 21:31:07 +00:00
|
|
|
MSG_READY,
|
|
|
|
MSG_RESIZE,
|
2010-07-02 02:52:13 +00:00
|
|
|
MSG_SHELL,
|
2013-10-05 23:06:01 +00:00
|
|
|
MSG_SHUTDOWN,
|
2010-07-02 02:52:13 +00:00
|
|
|
MSG_STDERR,
|
2013-10-05 23:06:01 +00:00
|
|
|
MSG_STDIN,
|
2010-07-02 02:52:13 +00:00
|
|
|
MSG_STDOUT,
|
2013-10-05 23:06:01 +00:00
|
|
|
MSG_SUSPEND,
|
|
|
|
MSG_UNLOCK,
|
|
|
|
MSG_WAKEUP,
|
2017-01-13 10:12:12 +00:00
|
|
|
MSG_EXEC,
|
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!
|
|
|
|
*/
|
2007-10-03 21:31:07 +00:00
|
|
|
struct msg_command_data {
|
2013-10-05 23:48:24 +00:00
|
|
|
int argc;
|
|
|
|
}; /* followed by packed argv */
|
2007-07-09 19:04:12 +00:00
|
|
|
|
2012-05-22 20:56:35 +00:00
|
|
|
struct msg_stdin_data {
|
|
|
|
ssize_t size;
|
|
|
|
char data[BUFSIZ];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct msg_stdout_data {
|
|
|
|
ssize_t size;
|
|
|
|
char data[BUFSIZ];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct msg_stderr_data {
|
|
|
|
ssize_t size;
|
|
|
|
char data[BUFSIZ];
|
|
|
|
};
|
|
|
|
|
2017-01-25 14:24:54 +00:00
|
|
|
/* Mode keys. */
|
2009-02-13 21:39:45 +00:00
|
|
|
#define MODEKEY_EMACS 0
|
|
|
|
#define MODEKEY_VI 1
|
|
|
|
|
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
|
2009-11-28 14:41:17 +00:00
|
|
|
#define MODE_KKEYPAD 0x8 /* set = application, clear = number */
|
2010-12-30 22:27:38 +00:00
|
|
|
#define MODE_WRAP 0x10 /* whether lines wrap */
|
|
|
|
#define MODE_MOUSE_STANDARD 0x20
|
2011-01-21 23:56:11 +00:00
|
|
|
#define MODE_MOUSE_BUTTON 0x40
|
2015-01-20 08:18:04 +00:00
|
|
|
#define MODE_BLINKING 0x80
|
2015-11-23 23:47:57 +00:00
|
|
|
#define MODE_MOUSE_UTF8 0x100
|
2013-02-18 14:52:27 +00:00
|
|
|
#define MODE_MOUSE_SGR 0x200
|
|
|
|
#define MODE_BRACKETPASTE 0x400
|
2013-02-22 07:23:11 +00:00
|
|
|
#define MODE_FOCUSON 0x800
|
2017-02-01 09:55:07 +00:00
|
|
|
#define MODE_MOUSE_ALL 0x1000
|
2019-03-12 07:39:27 +00:00
|
|
|
#define MODE_ORIGIN 0x2000
|
2019-05-03 20:44:24 +00:00
|
|
|
#define MODE_CRLF 0x4000
|
2010-12-30 22:27:38 +00:00
|
|
|
|
2017-02-08 23:53:03 +00:00
|
|
|
#define ALL_MODES 0xffffff
|
2017-02-01 09:55:07 +00:00
|
|
|
#define ALL_MOUSE_MODES (MODE_MOUSE_STANDARD|MODE_MOUSE_BUTTON|MODE_MOUSE_ALL)
|
2010-04-05 05:11:44 +00:00
|
|
|
|
2015-11-15 22:50:38 +00:00
|
|
|
/*
|
2018-08-09 09:53:44 +00:00
|
|
|
* A single UTF-8 character. UTF8_SIZE must be big enough to hold
|
|
|
|
* combining characters as well, currently at most five (of three
|
|
|
|
* bytes) are supported.
|
2015-11-15 22:50:38 +00:00
|
|
|
*/
|
2018-08-09 09:53:44 +00:00
|
|
|
#define UTF8_SIZE 18
|
2009-10-23 17:16:25 +00:00
|
|
|
struct utf8_data {
|
|
|
|
u_char data[UTF8_SIZE];
|
|
|
|
|
2015-11-13 08:09:28 +00:00
|
|
|
u_char have;
|
|
|
|
u_char size;
|
2009-10-23 17:16:25 +00:00
|
|
|
|
2015-11-14 10:56:31 +00:00
|
|
|
u_char width; /* 0xff if invalid */
|
2015-11-13 08:09:28 +00:00
|
|
|
} __packed;
|
2015-11-14 11:45:43 +00:00
|
|
|
enum utf8_state {
|
|
|
|
UTF8_MORE,
|
|
|
|
UTF8_DONE,
|
|
|
|
UTF8_ERROR
|
|
|
|
};
|
2009-10-23 17:16:25 +00:00
|
|
|
|
2016-07-15 00:49:08 +00:00
|
|
|
/* Colour flags. */
|
|
|
|
#define COLOUR_FLAG_256 0x01000000
|
|
|
|
#define COLOUR_FLAG_RGB 0x02000000
|
|
|
|
|
2018-10-25 15:13:38 +00:00
|
|
|
/* Special colours. */
|
|
|
|
#define COLOUR_DEFAULT(c) ((c) == 8 || (c) == 9)
|
|
|
|
|
2017-03-22 07:16:54 +00:00
|
|
|
/* Grid attributes. Anything above 0xff is stored in an extended cell. */
|
2008-09-25 20:08:57 +00:00
|
|
|
#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 */
|
2017-03-22 07:16:54 +00:00
|
|
|
#define GRID_ATTR_STRIKETHROUGH 0x100
|
2018-10-08 12:21:37 +00:00
|
|
|
#define GRID_ATTR_UNDERSCORE_2 0x200
|
|
|
|
#define GRID_ATTR_UNDERSCORE_3 0x400
|
|
|
|
#define GRID_ATTR_UNDERSCORE_4 0x800
|
|
|
|
#define GRID_ATTR_UNDERSCORE_5 0x1000
|
2019-05-13 20:10:23 +00:00
|
|
|
#define GRID_ATTR_OVERLINE 0x2000
|
2018-10-08 12:21:37 +00:00
|
|
|
|
|
|
|
/* All underscore attributes. */
|
|
|
|
#define GRID_ATTR_ALL_UNDERSCORE \
|
|
|
|
(GRID_ATTR_UNDERSCORE| \
|
|
|
|
GRID_ATTR_UNDERSCORE_2| \
|
|
|
|
GRID_ATTR_UNDERSCORE_3| \
|
|
|
|
GRID_ATTR_UNDERSCORE_4| \
|
|
|
|
GRID_ATTR_UNDERSCORE_5)
|
2008-09-25 20:08:57 +00:00
|
|
|
|
|
|
|
/* Grid flags. */
|
|
|
|
#define GRID_FLAG_FG256 0x1
|
|
|
|
#define GRID_FLAG_BG256 0x2
|
|
|
|
#define GRID_FLAG_PADDING 0x4
|
2015-11-13 08:09:28 +00:00
|
|
|
#define GRID_FLAG_EXTENDED 0x8
|
2016-07-15 00:49:08 +00:00
|
|
|
#define GRID_FLAG_SELECTED 0x10
|
2017-01-07 15:28:13 +00:00
|
|
|
#define GRID_FLAG_NOPALETTE 0x20
|
2019-03-12 23:21:45 +00:00
|
|
|
#define GRID_FLAG_CLEARED 0x40
|
2008-09-25 20:08:57 +00:00
|
|
|
|
2009-08-09 17:32:06 +00:00
|
|
|
/* Grid line flags. */
|
|
|
|
#define GRID_LINE_WRAPPED 0x1
|
2016-07-15 00:49:08 +00:00
|
|
|
#define GRID_LINE_EXTENDED 0x2
|
2018-02-16 09:51:41 +00:00
|
|
|
#define GRID_LINE_DEAD 0x4
|
2016-01-29 11:13:56 +00:00
|
|
|
|
2009-03-28 20:17:29 +00:00
|
|
|
/* Grid cell data. */
|
2008-09-25 20:08:57 +00:00
|
|
|
struct grid_cell {
|
2019-07-06 20:37:29 +00:00
|
|
|
struct utf8_data data; /* 21 bytes */
|
2017-03-22 07:16:54 +00:00
|
|
|
u_short attr;
|
2019-07-06 20:37:29 +00:00
|
|
|
u_char flags;
|
2016-07-15 00:49:08 +00:00
|
|
|
int fg;
|
|
|
|
int bg;
|
2019-06-27 15:17:41 +00:00
|
|
|
int us;
|
2019-07-06 20:37:29 +00:00
|
|
|
} __packed;
|
2015-11-13 08:09:28 +00:00
|
|
|
struct grid_cell_entry {
|
|
|
|
u_char flags;
|
|
|
|
union {
|
|
|
|
u_int offset;
|
|
|
|
struct {
|
|
|
|
u_char attr;
|
|
|
|
u_char fg;
|
|
|
|
u_char bg;
|
|
|
|
u_char data;
|
|
|
|
} data;
|
|
|
|
};
|
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 {
|
2016-10-13 20:27:27 +00:00
|
|
|
u_int cellused;
|
2015-11-13 08:09:28 +00:00
|
|
|
u_int cellsize;
|
|
|
|
struct grid_cell_entry *celldata;
|
|
|
|
|
|
|
|
u_int extdsize;
|
|
|
|
struct grid_cell *extddata;
|
2009-08-09 17:28:24 +00:00
|
|
|
|
2015-11-13 08:09:28 +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 {
|
2015-11-13 08:09:28 +00:00
|
|
|
int flags;
|
|
|
|
#define GRID_HISTORY 0x1 /* scroll lines into history */
|
2009-07-14 06:40:33 +00:00
|
|
|
|
2015-11-13 08:09:28 +00:00
|
|
|
u_int sx;
|
|
|
|
u_int sy;
|
2008-09-26 06:45:28 +00:00
|
|
|
|
2016-09-02 20:57:20 +00:00
|
|
|
u_int hscrolled;
|
2015-11-13 08:09:28 +00:00
|
|
|
u_int hsize;
|
|
|
|
u_int hlimit;
|
2008-09-25 20:08:57 +00:00
|
|
|
|
2015-11-13 08:09:28 +00:00
|
|
|
struct grid_line *linedata;
|
2008-09-25 20:08:57 +00:00
|
|
|
};
|
2007-12-06 09:46:23 +00:00
|
|
|
|
2019-03-18 20:53:33 +00:00
|
|
|
/* Style alignment. */
|
|
|
|
enum style_align {
|
|
|
|
STYLE_ALIGN_DEFAULT,
|
|
|
|
STYLE_ALIGN_LEFT,
|
|
|
|
STYLE_ALIGN_CENTRE,
|
|
|
|
STYLE_ALIGN_RIGHT
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Style list. */
|
|
|
|
enum style_list {
|
|
|
|
STYLE_LIST_OFF,
|
|
|
|
STYLE_LIST_ON,
|
|
|
|
STYLE_LIST_FOCUS,
|
|
|
|
STYLE_LIST_LEFT_MARKER,
|
|
|
|
STYLE_LIST_RIGHT_MARKER,
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Style range. */
|
|
|
|
enum style_range_type {
|
|
|
|
STYLE_RANGE_NONE,
|
|
|
|
STYLE_RANGE_LEFT,
|
|
|
|
STYLE_RANGE_RIGHT,
|
|
|
|
STYLE_RANGE_WINDOW
|
|
|
|
};
|
|
|
|
struct style_range {
|
|
|
|
enum style_range_type type;
|
|
|
|
u_int argument;
|
|
|
|
|
|
|
|
u_int start;
|
|
|
|
u_int end; /* not included */
|
|
|
|
|
|
|
|
TAILQ_ENTRY(style_range) entry;
|
|
|
|
};
|
|
|
|
TAILQ_HEAD(style_ranges, style_range);
|
|
|
|
|
2019-09-15 21:42:57 +00:00
|
|
|
/* Style default. */
|
|
|
|
enum style_default_type {
|
|
|
|
STYLE_DEFAULT_BASE,
|
|
|
|
STYLE_DEFAULT_PUSH,
|
|
|
|
STYLE_DEFAULT_POP
|
|
|
|
};
|
|
|
|
|
2019-03-14 09:53:52 +00:00
|
|
|
/* Style option. */
|
|
|
|
struct style {
|
2019-03-18 20:53:33 +00:00
|
|
|
struct grid_cell gc;
|
|
|
|
|
2019-07-01 06:56:00 +00:00
|
|
|
int fill;
|
2019-03-18 20:53:33 +00:00
|
|
|
enum style_align align;
|
|
|
|
enum style_list list;
|
|
|
|
|
|
|
|
enum style_range_type range_type;
|
|
|
|
u_int range_argument;
|
2019-09-15 21:42:57 +00:00
|
|
|
|
|
|
|
enum style_default_type default_type;
|
2019-03-14 09:53:52 +00:00
|
|
|
};
|
|
|
|
|
2007-12-06 09:46:23 +00:00
|
|
|
/* Virtual screen. */
|
2018-07-31 11:49:26 +00:00
|
|
|
struct screen_sel;
|
2017-10-05 13:29:18 +00:00
|
|
|
struct screen_titles;
|
2007-07-09 19:04:12 +00:00
|
|
|
struct screen {
|
2016-07-15 00:49:08 +00:00
|
|
|
char *title;
|
2019-11-15 11:16:53 +00:00
|
|
|
char *path;
|
2017-10-05 13:29:18 +00:00
|
|
|
struct screen_titles *titles;
|
2007-07-09 19:04:12 +00:00
|
|
|
|
2016-07-15 00:49:08 +00:00
|
|
|
struct grid *grid; /* grid data */
|
2007-10-26 17:15:50 +00:00
|
|
|
|
2016-07-15 00:49:08 +00:00
|
|
|
u_int cx; /* cursor x */
|
|
|
|
u_int cy; /* cursor y */
|
2008-09-09 22:16:37 +00:00
|
|
|
|
2016-07-15 00:49:08 +00:00
|
|
|
u_int cstyle; /* cursor style */
|
|
|
|
char *ccolour; /* cursor colour string */
|
2011-05-22 16:25:02 +00:00
|
|
|
|
2016-07-15 00:49:08 +00:00
|
|
|
u_int rupper; /* scroll region top */
|
2016-10-13 20:27:27 +00:00
|
|
|
u_int rlower; /* scroll region bottom */
|
2007-11-22 19:17:01 +00:00
|
|
|
|
2016-07-15 00:49:08 +00:00
|
|
|
int mode;
|
2007-11-22 19:17:01 +00:00
|
|
|
|
2016-07-15 00:49:08 +00:00
|
|
|
bitstr_t *tabs;
|
2009-06-25 15:54:38 +00:00
|
|
|
|
2018-07-31 11:49:26 +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. */
|
2017-02-08 16:45:18 +00:00
|
|
|
struct screen_write_collect_item;
|
|
|
|
struct screen_write_collect_line;
|
2007-12-06 09:46:23 +00:00
|
|
|
struct screen_write_ctx {
|
2016-07-15 00:49:08 +00:00
|
|
|
struct window_pane *wp;
|
|
|
|
struct screen *s;
|
2017-02-08 16:45:18 +00:00
|
|
|
|
|
|
|
struct screen_write_collect_item *item;
|
|
|
|
struct screen_write_collect_line *list;
|
2017-02-08 17:31:09 +00:00
|
|
|
u_int scrolled;
|
2017-06-07 15:27:46 +00:00
|
|
|
u_int bg;
|
2016-07-15 00:49:08 +00:00
|
|
|
|
|
|
|
u_int cells;
|
|
|
|
u_int written;
|
|
|
|
u_int skipped;
|
2007-11-21 18:24:49 +00:00
|
|
|
};
|
|
|
|
|
2019-05-07 20:01:41 +00:00
|
|
|
/* Screen redraw context. */
|
|
|
|
struct screen_redraw_ctx {
|
|
|
|
struct client *c;
|
|
|
|
|
|
|
|
u_int statuslines;
|
|
|
|
int statustop;
|
|
|
|
|
|
|
|
int pane_status;
|
|
|
|
|
|
|
|
u_int sx;
|
|
|
|
u_int sy;
|
|
|
|
u_int ox;
|
|
|
|
u_int oy;
|
|
|
|
};
|
|
|
|
|
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
|
|
|
|
2019-05-10 18:04:06 +00:00
|
|
|
/* Menu. */
|
2019-05-10 14:12:47 +00:00
|
|
|
struct menu_item {
|
2019-05-28 07:18:42 +00:00
|
|
|
const char *name;
|
2019-05-10 18:04:06 +00:00
|
|
|
key_code key;
|
2019-05-28 07:18:42 +00:00
|
|
|
const char *command;
|
2019-05-10 14:12:47 +00:00
|
|
|
};
|
|
|
|
struct menu {
|
2019-05-28 07:18:42 +00:00
|
|
|
const char *title;
|
2019-05-10 14:12:47 +00:00
|
|
|
struct menu_item *items;
|
|
|
|
u_int count;
|
|
|
|
u_int width;
|
|
|
|
};
|
2019-05-10 18:04:06 +00:00
|
|
|
typedef void (*menu_choice_cb)(struct menu *, u_int, key_code, void *);
|
|
|
|
#define MENU_NOMOUSE 0x1
|
2019-05-10 14:12:47 +00:00
|
|
|
|
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.
|
|
|
|
*/
|
2019-03-07 20:24:21 +00:00
|
|
|
struct window_mode_entry;
|
2007-11-21 13:11:41 +00:00
|
|
|
struct window_mode {
|
2017-05-07 22:27:57 +00:00
|
|
|
const char *name;
|
2019-03-18 14:10:25 +00:00
|
|
|
const char *default_format;
|
2017-05-07 22:27:57 +00:00
|
|
|
|
2019-03-07 20:24:21 +00:00
|
|
|
struct screen *(*init)(struct window_mode_entry *,
|
|
|
|
struct cmd_find_state *, struct args *);
|
|
|
|
void (*free)(struct window_mode_entry *);
|
|
|
|
void (*resize)(struct window_mode_entry *, u_int, u_int);
|
|
|
|
void (*key)(struct window_mode_entry *, struct client *,
|
2018-12-18 13:20:44 +00:00
|
|
|
struct session *, struct winlink *, key_code,
|
|
|
|
struct mouse_event *);
|
2017-05-07 22:27:57 +00:00
|
|
|
|
2019-03-07 20:24:21 +00:00
|
|
|
const char *(*key_table)(struct window_mode_entry *);
|
|
|
|
void (*command)(struct window_mode_entry *, struct client *,
|
2018-12-18 13:20:44 +00:00
|
|
|
struct session *, struct winlink *, struct args *,
|
2017-05-07 22:27:57 +00:00
|
|
|
struct mouse_event *);
|
2019-03-07 20:24:21 +00:00
|
|
|
void (*formats)(struct window_mode_entry *,
|
|
|
|
struct format_tree *);
|
2007-11-21 13:11:41 +00:00
|
|
|
};
|
2016-06-15 09:13:46 +00:00
|
|
|
#define WINDOW_MODE_TIMEOUT 180
|
2007-11-21 13:11:41 +00:00
|
|
|
|
2019-03-07 20:24:21 +00:00
|
|
|
/* Active window mode. */
|
|
|
|
struct window_mode_entry {
|
|
|
|
struct window_pane *wp;
|
|
|
|
|
|
|
|
const struct window_mode *mode;
|
|
|
|
void *data;
|
|
|
|
|
2019-03-12 11:16:49 +00:00
|
|
|
struct screen *screen;
|
2019-03-07 20:24:21 +00:00
|
|
|
u_int prefix;
|
2019-03-12 11:16:49 +00:00
|
|
|
|
|
|
|
TAILQ_ENTRY (window_mode_entry) entry;
|
2019-03-07 20:24:21 +00:00
|
|
|
};
|
|
|
|
|
2009-01-11 23:31:46 +00:00
|
|
|
/* Child window structure. */
|
|
|
|
struct window_pane {
|
2011-04-06 22:16:33 +00:00
|
|
|
u_int id;
|
2014-05-08 06:03:30 +00:00
|
|
|
u_int active_point;
|
2011-04-06 22:16:33 +00:00
|
|
|
|
2009-01-11 23:31:46 +00:00
|
|
|
struct window *window;
|
2019-06-20 11:59:59 +00:00
|
|
|
struct options *options;
|
2013-02-24 00:25:03 +00:00
|
|
|
|
2009-07-20 15:42:05 +00:00
|
|
|
struct layout_cell *layout_cell;
|
2013-02-24 00:25:03 +00:00
|
|
|
struct layout_cell *saved_layout_cell;
|
2009-01-12 18:22:47 +00:00
|
|
|
|
|
|
|
u_int sx;
|
|
|
|
u_int sy;
|
|
|
|
|
2017-05-31 10:15:51 +00:00
|
|
|
u_int osx;
|
|
|
|
u_int osy;
|
|
|
|
|
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
|
2012-03-29 21:05:16 +00:00
|
|
|
#define PANE_DROP 0x2
|
2013-02-22 07:23:11 +00:00
|
|
|
#define PANE_FOCUSED 0x4
|
2013-02-22 21:47:34 +00:00
|
|
|
#define PANE_RESIZE 0x8
|
2017-05-31 11:00:00 +00:00
|
|
|
#define PANE_RESIZEFORCE 0x10
|
|
|
|
#define PANE_FOCUSPUSH 0x20
|
|
|
|
#define PANE_INPUTOFF 0x40
|
|
|
|
#define PANE_CHANGED 0x80
|
2017-07-03 12:38:50 +00:00
|
|
|
#define PANE_EXITED 0x100
|
2017-10-12 11:32:27 +00:00
|
|
|
#define PANE_STATUSREADY 0x200
|
|
|
|
#define PANE_STATUSDRAWN 0x400
|
2019-05-03 20:44:24 +00:00
|
|
|
#define PANE_EMPTY 0x800
|
2019-06-20 11:59:59 +00:00
|
|
|
#define PANE_STYLECHANGED 0x1000
|
2019-08-28 07:34:32 +00:00
|
|
|
#define PANE_RESIZED 0x2000
|
2009-05-04 17:58:27 +00:00
|
|
|
|
2014-05-13 08:08:32 +00:00
|
|
|
int argc;
|
|
|
|
char **argv;
|
2009-09-02 01:02:44 +00:00
|
|
|
char *shell;
|
2019-04-07 12:01:03 +00:00
|
|
|
char *cwd;
|
2007-07-09 19:04:12 +00:00
|
|
|
|
2009-02-08 16:11:26 +00:00
|
|
|
pid_t pid;
|
2009-01-26 22:57:20 +00:00
|
|
|
char tty[TTY_NAME_MAX];
|
2014-12-09 19:23:35 +00:00
|
|
|
int status;
|
2009-11-08 22:40:36 +00:00
|
|
|
|
|
|
|
int fd;
|
2009-11-08 23:02:56 +00:00
|
|
|
struct bufferevent *event;
|
2019-03-12 11:16:49 +00:00
|
|
|
u_int disabled;
|
2007-07-09 19:04:12 +00:00
|
|
|
|
2016-09-28 08:30:44 +00:00
|
|
|
struct event resize_timer;
|
|
|
|
|
2015-05-08 16:18:04 +00:00
|
|
|
struct input_ctx *ictx;
|
2007-09-28 22:47:22 +00:00
|
|
|
|
2019-06-20 11:59:59 +00:00
|
|
|
struct style cached_style;
|
|
|
|
struct style cached_active_style;
|
2017-01-07 15:28:13 +00:00
|
|
|
int *palette;
|
|
|
|
|
2009-10-12 00:35:08 +00:00
|
|
|
int pipe_fd;
|
2009-11-08 22:59:53 +00:00
|
|
|
struct bufferevent *pipe_event;
|
2009-10-12 00:35:08 +00:00
|
|
|
size_t pipe_off;
|
|
|
|
|
2009-01-11 23:31:46 +00:00
|
|
|
struct screen *screen;
|
|
|
|
struct screen base;
|
|
|
|
|
2016-04-29 15:00:48 +00:00
|
|
|
struct screen status_screen;
|
|
|
|
size_t status_size;
|
|
|
|
|
2009-07-14 06:40:33 +00:00
|
|
|
/* Saved in alternative screen mode. */
|
2009-12-04 22:14:47 +00:00
|
|
|
u_int saved_cx;
|
|
|
|
u_int saved_cy;
|
2009-07-14 06:40:33 +00:00
|
|
|
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
|
|
|
|
2019-03-12 11:16:49 +00:00
|
|
|
TAILQ_HEAD (, window_mode_entry) modes;
|
2016-06-15 09:13:46 +00:00
|
|
|
struct event modetimer;
|
|
|
|
time_t modelast;
|
2017-05-12 10:50:11 +00:00
|
|
|
char *searchstr;
|
2009-01-14 19:29:32 +00:00
|
|
|
|
|
|
|
TAILQ_ENTRY(window_pane) entry;
|
2011-04-06 22:16:33 +00:00
|
|
|
RB_ENTRY(window_pane) tree_entry;
|
2009-01-11 23:31:46 +00:00
|
|
|
};
|
2009-01-14 19:29:32 +00:00
|
|
|
TAILQ_HEAD(window_panes, window_pane);
|
2011-04-06 22:16:33 +00:00
|
|
|
RB_HEAD(window_pane_tree, window_pane);
|
2009-01-11 23:31:46 +00:00
|
|
|
|
|
|
|
/* Window structure. */
|
|
|
|
struct window {
|
2012-01-31 12:01:43 +00:00
|
|
|
u_int id;
|
2019-09-19 09:02:30 +00:00
|
|
|
void *latest;
|
2015-08-29 00:29:15 +00:00
|
|
|
|
2009-01-11 23:31:46 +00:00
|
|
|
char *name;
|
2015-08-29 00:29:15 +00:00
|
|
|
struct event name_event;
|
|
|
|
struct timeval name_time;
|
|
|
|
|
2015-08-29 08:30:54 +00:00
|
|
|
struct event alerts_timer;
|
Support for windows larger than the client.
This adds two new options, window-size and default-size, and a new
command, resize-window.
The force-width and force-height options, and the session_width and
session_height formats have been removed.
The new window-size option tells tmux how to work out the size of
windows: largest means it picks the size of the largest session,
smallest the smallest session (similar to the old behaviour) and
manual means that it does not automatically resize
windows. aggressive-resize modifies the choice of session for largest
and smallest as it did before.
If a window is in a session attached to a client that is too small,
only part of the window is shown. tmux attempts to keep the cursor
visible, so the part of the window displayed is changed as the cursor
moves (with a small delay, to try and avoid excess redrawing when
applications redraw status lines or similar that are not currently
visible).
Drawing windows which are larger than the client is not as efficient
as those which fit, particularly when the cursor moves, so it is
recommended to avoid using this on slow machines or networks (set
window-size to smallest or manual).
The resize-window command can be used to resize a window manually. If
it is used, the window-size option is automatically set to manual for
the window (undo this with "setw -u window-size"). resize-window works
in a similar way to resize-pane (-U -D -L -R -x -y flags) but also has
-a and -A flags. -a sets the window to the size of the smallest client
(what it would be if window-size was smallest) and -A the largest.
For the same behaviour as force-width or force-height, use
resize-width -x or -y.
If the global window-size option is set to manual, the default-size
option is used for new windows. If -x or -y is used with new-session,
that sets the default-size option for the new session.
The maximum size of a window is 10000x10000. But expect applications
to complain and higher memory use if you make a window that big. The
minimum size is the size required for the current layout including
borders.
This change allows some code improvements, most notably that since
windows can now never be cropped, that code can be removed from the
layout code, and since panes can now never be outside the size of the
window, window_pane_visible can be removed.
2018-08-20 14:22:14 +00:00
|
|
|
struct event offset_timer;
|
2015-08-29 08:30:54 +00:00
|
|
|
|
2015-06-15 10:58:01 +00:00
|
|
|
struct timeval activity_time;
|
2009-01-11 23:31:46 +00:00
|
|
|
|
2009-05-04 17:58:27 +00:00
|
|
|
struct window_pane *active;
|
2010-10-24 01:34:30 +00:00
|
|
|
struct window_pane *last;
|
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;
|
2013-02-24 00:25:03 +00:00
|
|
|
struct layout_cell *saved_layout_root;
|
2015-04-28 10:43:13 +00:00
|
|
|
char *old_layout;
|
2009-01-11 23:31:46 +00:00
|
|
|
|
|
|
|
u_int sx;
|
|
|
|
u_int sy;
|
2019-11-28 09:45:15 +00:00
|
|
|
u_int xpixel;
|
|
|
|
u_int ypixel;
|
2009-05-04 17:58:27 +00:00
|
|
|
|
2007-09-29 09:15:49 +00:00
|
|
|
int flags;
|
|
|
|
#define WINDOW_BELL 0x1
|
2010-12-06 21:57:56 +00:00
|
|
|
#define WINDOW_ACTIVITY 0x2
|
2018-08-02 11:18:34 +00:00
|
|
|
#define WINDOW_SILENCE 0x4
|
|
|
|
#define WINDOW_ZOOMED 0x8
|
2019-08-14 09:58:31 +00:00
|
|
|
#define WINDOW_WASZOOMED 0x10
|
2013-08-20 09:37:55 +00:00
|
|
|
#define WINDOW_ALERTFLAGS (WINDOW_BELL|WINDOW_ACTIVITY|WINDOW_SILENCE)
|
2008-06-14 16:47:20 +00:00
|
|
|
|
2016-10-19 09:22:07 +00:00
|
|
|
int alerts_queued;
|
|
|
|
TAILQ_ENTRY(window) alerts_entry;
|
|
|
|
|
2015-10-27 15:58:42 +00:00
|
|
|
struct options *options;
|
2007-10-26 12:29:07 +00:00
|
|
|
|
|
|
|
u_int references;
|
2016-10-19 09:22:07 +00:00
|
|
|
TAILQ_HEAD(, winlink) winlinks;
|
2015-04-22 15:30:11 +00:00
|
|
|
|
|
|
|
RB_ENTRY(window) entry;
|
2007-07-09 19:04:12 +00:00
|
|
|
};
|
2015-04-22 15:30:11 +00:00
|
|
|
RB_HEAD(windows, window);
|
2007-07-09 19:04:12 +00:00
|
|
|
|
2007-10-26 12:29:07 +00:00
|
|
|
/* Entry on local window list. */
|
|
|
|
struct winlink {
|
|
|
|
int idx;
|
2016-10-19 09:22:07 +00:00
|
|
|
struct session *session;
|
2007-10-26 12:29:07 +00:00
|
|
|
struct window *window;
|
|
|
|
|
2015-05-08 16:48:12 +00:00
|
|
|
int flags;
|
2010-06-22 23:26:18 +00:00
|
|
|
#define WINLINK_BELL 0x1
|
|
|
|
#define WINLINK_ACTIVITY 0x2
|
2014-04-17 07:36:45 +00:00
|
|
|
#define WINLINK_SILENCE 0x4
|
|
|
|
#define WINLINK_ALERTFLAGS (WINLINK_BELL|WINLINK_ACTIVITY|WINLINK_SILENCE)
|
2010-06-22 23:26:18 +00:00
|
|
|
|
2007-10-26 12:29:07 +00:00
|
|
|
RB_ENTRY(winlink) entry;
|
2016-10-19 09:22:07 +00:00
|
|
|
TAILQ_ENTRY(winlink) wentry;
|
2009-10-11 23:38:16 +00:00
|
|
|
TAILQ_ENTRY(winlink) sentry;
|
2007-10-26 12:29:07 +00:00
|
|
|
};
|
|
|
|
RB_HEAD(winlinks, winlink);
|
2009-10-11 23:38:16 +00:00
|
|
|
TAILQ_HEAD(winlink_stack, winlink);
|
2007-10-26 12:29:07 +00:00
|
|
|
|
Support for windows larger than the client.
This adds two new options, window-size and default-size, and a new
command, resize-window.
The force-width and force-height options, and the session_width and
session_height formats have been removed.
The new window-size option tells tmux how to work out the size of
windows: largest means it picks the size of the largest session,
smallest the smallest session (similar to the old behaviour) and
manual means that it does not automatically resize
windows. aggressive-resize modifies the choice of session for largest
and smallest as it did before.
If a window is in a session attached to a client that is too small,
only part of the window is shown. tmux attempts to keep the cursor
visible, so the part of the window displayed is changed as the cursor
moves (with a small delay, to try and avoid excess redrawing when
applications redraw status lines or similar that are not currently
visible).
Drawing windows which are larger than the client is not as efficient
as those which fit, particularly when the cursor moves, so it is
recommended to avoid using this on slow machines or networks (set
window-size to smallest or manual).
The resize-window command can be used to resize a window manually. If
it is used, the window-size option is automatically set to manual for
the window (undo this with "setw -u window-size"). resize-window works
in a similar way to resize-pane (-U -D -L -R -x -y flags) but also has
-a and -A flags. -a sets the window to the size of the smallest client
(what it would be if window-size was smallest) and -A the largest.
For the same behaviour as force-width or force-height, use
resize-width -x or -y.
If the global window-size option is set to manual, the default-size
option is used for new windows. If -x or -y is used with new-session,
that sets the default-size option for the new session.
The maximum size of a window is 10000x10000. But expect applications
to complain and higher memory use if you make a window that big. The
minimum size is the size required for the current layout including
borders.
This change allows some code improvements, most notably that since
windows can now never be cropped, that code can be removed from the
layout code, and since panes can now never be outside the size of the
window, window_pane_visible can be removed.
2018-08-20 14:22:14 +00:00
|
|
|
/* Window size option. */
|
|
|
|
#define WINDOW_SIZE_LARGEST 0
|
|
|
|
#define WINDOW_SIZE_SMALLEST 1
|
|
|
|
#define WINDOW_SIZE_MANUAL 2
|
2019-09-19 09:02:30 +00:00
|
|
|
#define WINDOW_SIZE_LATEST 3
|
Support for windows larger than the client.
This adds two new options, window-size and default-size, and a new
command, resize-window.
The force-width and force-height options, and the session_width and
session_height formats have been removed.
The new window-size option tells tmux how to work out the size of
windows: largest means it picks the size of the largest session,
smallest the smallest session (similar to the old behaviour) and
manual means that it does not automatically resize
windows. aggressive-resize modifies the choice of session for largest
and smallest as it did before.
If a window is in a session attached to a client that is too small,
only part of the window is shown. tmux attempts to keep the cursor
visible, so the part of the window displayed is changed as the cursor
moves (with a small delay, to try and avoid excess redrawing when
applications redraw status lines or similar that are not currently
visible).
Drawing windows which are larger than the client is not as efficient
as those which fit, particularly when the cursor moves, so it is
recommended to avoid using this on slow machines or networks (set
window-size to smallest or manual).
The resize-window command can be used to resize a window manually. If
it is used, the window-size option is automatically set to manual for
the window (undo this with "setw -u window-size"). resize-window works
in a similar way to resize-pane (-U -D -L -R -x -y flags) but also has
-a and -A flags. -a sets the window to the size of the smallest client
(what it would be if window-size was smallest) and -A the largest.
For the same behaviour as force-width or force-height, use
resize-width -x or -y.
If the global window-size option is set to manual, the default-size
option is used for new windows. If -x or -y is used with new-session,
that sets the default-size option for the new session.
The maximum size of a window is 10000x10000. But expect applications
to complain and higher memory use if you make a window that big. The
minimum size is the size required for the current layout including
borders.
This change allows some code improvements, most notably that since
windows can now never be cropped, that code can be removed from the
layout code, and since panes can now never be outside the size of the
window, window_pane_visible can be removed.
2018-08-20 14:22:14 +00:00
|
|
|
|
2019-06-26 13:03:47 +00:00
|
|
|
/* Pane border status option. */
|
|
|
|
#define PANE_STATUS_OFF 0
|
|
|
|
#define PANE_STATUS_TOP 1
|
|
|
|
#define PANE_STATUS_BOTTOM 2
|
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
2009-08-09 17:48:55 +00:00
|
|
|
/* Environment variable. */
|
|
|
|
struct environ_entry {
|
|
|
|
char *name;
|
|
|
|
char *value;
|
|
|
|
|
|
|
|
RB_ENTRY(environ_entry) entry;
|
|
|
|
};
|
|
|
|
|
2007-07-09 19:04:12 +00:00
|
|
|
/* Client session. */
|
2009-10-11 23:38:16 +00:00
|
|
|
struct session_group {
|
2017-02-09 15:04:53 +00:00
|
|
|
const char *name;
|
|
|
|
TAILQ_HEAD(, session) sessions;
|
2009-10-11 23:38:16 +00:00
|
|
|
|
2017-02-09 15:04:53 +00:00
|
|
|
RB_ENTRY(session_group) entry;
|
2009-10-11 23:38:16 +00:00
|
|
|
};
|
2017-02-09 15:04:53 +00:00
|
|
|
RB_HEAD(session_groups, session_group);
|
2009-10-11 23:38:16 +00:00
|
|
|
|
2007-07-09 19:04:12 +00:00
|
|
|
struct session {
|
2013-03-07 10:07:22 +00:00
|
|
|
u_int id;
|
2010-12-22 15:36:44 +00:00
|
|
|
|
2007-10-03 21:31:07 +00:00
|
|
|
char *name;
|
2015-10-31 08:13:58 +00:00
|
|
|
const char *cwd;
|
2009-11-04 22:42:31 +00:00
|
|
|
|
|
|
|
struct timeval creation_time;
|
2015-09-10 08:58:14 +00:00
|
|
|
struct timeval last_attached_time;
|
2009-11-04 22:42:31 +00:00
|
|
|
struct timeval activity_time;
|
2013-01-15 22:55:29 +00:00
|
|
|
struct timeval last_activity_time;
|
2007-07-09 19:04:12 +00:00
|
|
|
|
2015-08-28 13:12:20 +00:00
|
|
|
struct event lock_timer;
|
|
|
|
|
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
|
|
|
|
2017-02-03 21:01:02 +00:00
|
|
|
int statusat;
|
2019-03-18 20:53:33 +00:00
|
|
|
u_int statuslines;
|
2017-02-03 21:01:02 +00:00
|
|
|
|
2015-10-27 15:58:42 +00:00
|
|
|
struct options *options;
|
2008-06-03 21:42:37 +00:00
|
|
|
|
2018-08-18 20:08:52 +00:00
|
|
|
#define SESSION_PASTING 0x1
|
|
|
|
#define SESSION_ALERTED 0x2
|
2007-10-05 18:25:05 +00:00
|
|
|
int flags;
|
2009-08-09 17:48:55 +00:00
|
|
|
|
2015-05-08 16:48:12 +00:00
|
|
|
u_int attached;
|
2014-03-06 11:25:27 +00:00
|
|
|
|
2009-09-16 12:36:28 +00:00
|
|
|
struct termios *tio;
|
2009-08-16 18:59:12 +00:00
|
|
|
|
2015-10-28 09:51:55 +00:00
|
|
|
struct environ *environ;
|
2009-09-07 23:59:19 +00:00
|
|
|
|
|
|
|
int references;
|
2009-10-11 23:38:16 +00:00
|
|
|
|
|
|
|
TAILQ_ENTRY(session) gentry;
|
2010-12-22 15:36:44 +00:00
|
|
|
RB_ENTRY(session) entry;
|
2007-07-09 19:04:12 +00:00
|
|
|
};
|
2010-12-22 15:36:44 +00:00
|
|
|
RB_HEAD(sessions, session);
|
2007-07-09 19:04:12 +00:00
|
|
|
|
2014-03-06 12:00:30 +00:00
|
|
|
/* Mouse button masks. */
|
|
|
|
#define MOUSE_MASK_BUTTONS 3
|
|
|
|
#define MOUSE_MASK_SHIFT 4
|
|
|
|
#define MOUSE_MASK_META 8
|
|
|
|
#define MOUSE_MASK_CTRL 16
|
|
|
|
#define MOUSE_MASK_DRAG 32
|
|
|
|
#define MOUSE_MASK_WHEEL 64
|
|
|
|
|
2012-10-26 14:35:42 +00:00
|
|
|
/* Mouse wheel states. */
|
|
|
|
#define MOUSE_WHEEL_UP 0
|
2018-10-03 15:27:55 +00:00
|
|
|
#define MOUSE_WHEEL_DOWN 1
|
2012-10-26 14:35:42 +00:00
|
|
|
|
2015-04-19 21:34:21 +00:00
|
|
|
/* Mouse helpers. */
|
|
|
|
#define MOUSE_BUTTONS(b) ((b) & MOUSE_MASK_BUTTONS)
|
|
|
|
#define MOUSE_WHEEL(b) ((b) & MOUSE_MASK_WHEEL)
|
|
|
|
#define MOUSE_DRAG(b) ((b) & MOUSE_MASK_DRAG)
|
|
|
|
#define MOUSE_RELEASE(b) (((b) & MOUSE_MASK_BUTTONS) == 3)
|
2014-05-08 07:54:47 +00:00
|
|
|
|
2015-04-19 21:34:21 +00:00
|
|
|
/* Mouse input. */
|
2012-10-26 14:35:42 +00:00
|
|
|
struct mouse_event {
|
2015-11-12 11:05:34 +00:00
|
|
|
int valid;
|
2012-10-26 14:35:42 +00:00
|
|
|
|
2015-11-12 11:05:34 +00:00
|
|
|
key_code key;
|
2019-03-18 20:53:33 +00:00
|
|
|
|
2015-11-12 11:05:34 +00:00
|
|
|
int statusat;
|
2019-03-18 20:53:33 +00:00
|
|
|
u_int statuslines;
|
2012-10-26 14:35:42 +00:00
|
|
|
|
2015-11-12 11:05:34 +00:00
|
|
|
u_int x;
|
|
|
|
u_int y;
|
|
|
|
u_int b;
|
2012-10-26 14:35:42 +00:00
|
|
|
|
2015-11-12 11:05:34 +00:00
|
|
|
u_int lx;
|
|
|
|
u_int ly;
|
|
|
|
u_int lb;
|
2013-02-18 14:52:27 +00:00
|
|
|
|
Support for windows larger than the client.
This adds two new options, window-size and default-size, and a new
command, resize-window.
The force-width and force-height options, and the session_width and
session_height formats have been removed.
The new window-size option tells tmux how to work out the size of
windows: largest means it picks the size of the largest session,
smallest the smallest session (similar to the old behaviour) and
manual means that it does not automatically resize
windows. aggressive-resize modifies the choice of session for largest
and smallest as it did before.
If a window is in a session attached to a client that is too small,
only part of the window is shown. tmux attempts to keep the cursor
visible, so the part of the window displayed is changed as the cursor
moves (with a small delay, to try and avoid excess redrawing when
applications redraw status lines or similar that are not currently
visible).
Drawing windows which are larger than the client is not as efficient
as those which fit, particularly when the cursor moves, so it is
recommended to avoid using this on slow machines or networks (set
window-size to smallest or manual).
The resize-window command can be used to resize a window manually. If
it is used, the window-size option is automatically set to manual for
the window (undo this with "setw -u window-size"). resize-window works
in a similar way to resize-pane (-U -D -L -R -x -y flags) but also has
-a and -A flags. -a sets the window to the size of the smallest client
(what it would be if window-size was smallest) and -A the largest.
For the same behaviour as force-width or force-height, use
resize-width -x or -y.
If the global window-size option is set to manual, the default-size
option is used for new windows. If -x or -y is used with new-session,
that sets the default-size option for the new session.
The maximum size of a window is 10000x10000. But expect applications
to complain and higher memory use if you make a window that big. The
minimum size is the size required for the current layout including
borders.
This change allows some code improvements, most notably that since
windows can now never be cropped, that code can be removed from the
layout code, and since panes can now never be outside the size of the
window, window_pane_visible can be removed.
2018-08-20 14:22:14 +00:00
|
|
|
u_int ox;
|
|
|
|
u_int oy;
|
|
|
|
|
2015-11-12 11:05:34 +00:00
|
|
|
int s;
|
|
|
|
int w;
|
|
|
|
int wp;
|
2012-10-26 14:35:42 +00:00
|
|
|
|
2015-11-12 11:05:34 +00:00
|
|
|
u_int sgr_type;
|
|
|
|
u_int sgr_b;
|
2012-10-26 14:35:42 +00:00
|
|
|
};
|
|
|
|
|
2019-05-03 14:51:30 +00:00
|
|
|
/* Key event. */
|
|
|
|
struct key_event {
|
|
|
|
key_code key;
|
|
|
|
struct mouse_event m;
|
|
|
|
};
|
|
|
|
|
2015-05-08 16:48:12 +00:00
|
|
|
/* TTY information. */
|
|
|
|
struct tty_key {
|
|
|
|
char ch;
|
2015-11-12 11:05:34 +00:00
|
|
|
key_code key;
|
2015-05-08 16:48:12 +00:00
|
|
|
|
|
|
|
struct tty_key *left;
|
|
|
|
struct tty_key *right;
|
|
|
|
|
|
|
|
struct tty_key *next;
|
|
|
|
};
|
|
|
|
|
2015-07-28 15:18:10 +00:00
|
|
|
struct tty_code;
|
2015-05-08 16:48:12 +00:00
|
|
|
struct tty_term {
|
|
|
|
char *name;
|
|
|
|
u_int references;
|
|
|
|
|
|
|
|
char acs[UCHAR_MAX + 1][2];
|
|
|
|
|
2015-07-28 15:18:10 +00:00
|
|
|
struct tty_code *codes;
|
2015-05-08 16:48:12 +00:00
|
|
|
|
|
|
|
#define TERM_256COLOURS 0x1
|
|
|
|
#define TERM_EARLYWRAP 0x2
|
|
|
|
int flags;
|
|
|
|
|
|
|
|
LIST_ENTRY(tty_term) entry;
|
|
|
|
};
|
|
|
|
LIST_HEAD(tty_terms, tty_term);
|
|
|
|
|
2007-11-27 19:23:34 +00:00
|
|
|
struct tty {
|
2012-05-22 21:05:30 +00:00
|
|
|
struct client *client;
|
2007-11-27 19:23:34 +00:00
|
|
|
|
2009-12-04 22:14:47 +00:00
|
|
|
u_int sx;
|
|
|
|
u_int sy;
|
2019-11-28 09:05:34 +00:00
|
|
|
u_int xpixel;
|
|
|
|
u_int ypixel;
|
2009-02-11 17:50:36 +00:00
|
|
|
|
2009-01-11 23:31:46 +00:00
|
|
|
u_int cx;
|
|
|
|
u_int cy;
|
2011-05-22 16:26:09 +00:00
|
|
|
u_int cstyle;
|
2011-05-22 16:25:02 +00:00
|
|
|
char *ccolour;
|
2009-01-11 23:31:46 +00:00
|
|
|
|
Support for windows larger than the client.
This adds two new options, window-size and default-size, and a new
command, resize-window.
The force-width and force-height options, and the session_width and
session_height formats have been removed.
The new window-size option tells tmux how to work out the size of
windows: largest means it picks the size of the largest session,
smallest the smallest session (similar to the old behaviour) and
manual means that it does not automatically resize
windows. aggressive-resize modifies the choice of session for largest
and smallest as it did before.
If a window is in a session attached to a client that is too small,
only part of the window is shown. tmux attempts to keep the cursor
visible, so the part of the window displayed is changed as the cursor
moves (with a small delay, to try and avoid excess redrawing when
applications redraw status lines or similar that are not currently
visible).
Drawing windows which are larger than the client is not as efficient
as those which fit, particularly when the cursor moves, so it is
recommended to avoid using this on slow machines or networks (set
window-size to smallest or manual).
The resize-window command can be used to resize a window manually. If
it is used, the window-size option is automatically set to manual for
the window (undo this with "setw -u window-size"). resize-window works
in a similar way to resize-pane (-U -D -L -R -x -y flags) but also has
-a and -A flags. -a sets the window to the size of the smallest client
(what it would be if window-size was smallest) and -A the largest.
For the same behaviour as force-width or force-height, use
resize-width -x or -y.
If the global window-size option is set to manual, the default-size
option is used for new windows. If -x or -y is used with new-session,
that sets the default-size option for the new session.
The maximum size of a window is 10000x10000. But expect applications
to complain and higher memory use if you make a window that big. The
minimum size is the size required for the current layout including
borders.
This change allows some code improvements, most notably that since
windows can now never be cropped, that code can be removed from the
layout code, and since panes can now never be outside the size of the
window, window_pane_visible can be removed.
2018-08-20 14:22:14 +00:00
|
|
|
int oflag;
|
|
|
|
u_int oox;
|
|
|
|
u_int ooy;
|
|
|
|
u_int osx;
|
|
|
|
u_int osy;
|
|
|
|
|
2009-01-28 19:52:21 +00:00
|
|
|
int mode;
|
2009-01-11 23:31:46 +00:00
|
|
|
|
|
|
|
u_int rlower;
|
|
|
|
u_int rupper;
|
|
|
|
|
2016-11-15 14:02:32 +00:00
|
|
|
u_int rleft;
|
|
|
|
u_int rright;
|
|
|
|
|
2007-11-27 19:23:34 +00:00
|
|
|
int fd;
|
2017-02-10 12:59:18 +00:00
|
|
|
struct event event_in;
|
|
|
|
struct evbuffer *in;
|
|
|
|
struct event event_out;
|
|
|
|
struct evbuffer *out;
|
2017-04-19 06:52:27 +00:00
|
|
|
struct event timer;
|
|
|
|
size_t discarded;
|
2007-11-27 19:23:34 +00:00
|
|
|
|
2009-12-04 22:14:47 +00:00
|
|
|
struct termios tio;
|
2007-11-27 19:23:34 +00:00
|
|
|
|
2008-09-25 20:08:57 +00:00
|
|
|
struct grid_cell cell;
|
2007-11-27 19:23:34 +00:00
|
|
|
|
2017-02-08 16:45:18 +00:00
|
|
|
int last_wp;
|
2017-02-06 19:45:23 +00:00
|
|
|
struct grid_cell last_cell;
|
|
|
|
|
2008-06-19 23:07:11 +00:00
|
|
|
#define TTY_NOCURSOR 0x1
|
2008-06-20 06:36:01 +00:00
|
|
|
#define TTY_FREEZE 0x2
|
2013-02-16 13:21:14 +00:00
|
|
|
#define TTY_TIMER 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
|
2013-06-23 13:10:46 +00:00
|
|
|
#define TTY_FOCUS 0x40
|
2017-04-19 06:52:27 +00:00
|
|
|
#define TTY_BLOCK 0x80
|
2009-12-04 22:14:47 +00:00
|
|
|
int flags;
|
2008-06-19 23:07:11 +00:00
|
|
|
|
2017-01-11 16:09:57 +00:00
|
|
|
struct tty_term *term;
|
|
|
|
char *term_name;
|
2008-09-25 20:08:57 +00:00
|
|
|
int term_flags;
|
2016-11-15 14:02:32 +00:00
|
|
|
enum {
|
|
|
|
TTY_VT100,
|
|
|
|
TTY_VT101,
|
|
|
|
TTY_VT102,
|
|
|
|
TTY_VT220,
|
|
|
|
TTY_VT320,
|
|
|
|
TTY_VT420,
|
2019-11-14 15:37:19 +00:00
|
|
|
TTY_VT520,
|
2016-11-15 14:02:32 +00:00
|
|
|
TTY_UNKNOWN
|
|
|
|
} term_type;
|
2008-09-25 20:08:57 +00:00
|
|
|
|
2019-05-03 14:51:30 +00:00
|
|
|
u_int mouse_last_x;
|
|
|
|
u_int mouse_last_y;
|
2019-05-09 14:09:32 +00:00
|
|
|
u_int mouse_last_b;
|
2015-04-19 21:34:21 +00:00
|
|
|
int mouse_drag_flag;
|
|
|
|
void (*mouse_drag_update)(struct client *,
|
|
|
|
struct mouse_event *);
|
|
|
|
void (*mouse_drag_release)(struct client *,
|
2015-05-08 16:48:12 +00:00
|
|
|
struct mouse_event *);
|
2012-05-22 21:05:30 +00:00
|
|
|
|
2009-11-08 23:26:56 +00:00
|
|
|
struct event key_timer;
|
2009-11-08 23:32:39 +00:00
|
|
|
struct tty_key *key_tree;
|
2007-11-27 19:23:34 +00:00
|
|
|
};
|
2017-01-11 16:05:46 +00:00
|
|
|
#define TTY_TYPES \
|
2019-11-14 15:37:19 +00:00
|
|
|
{ "VT100", \
|
|
|
|
"VT101", \
|
|
|
|
"VT102", \
|
|
|
|
"VT220", \
|
|
|
|
"VT320", \
|
|
|
|
"VT420", \
|
|
|
|
"VT520", \
|
|
|
|
"Unknown" }
|
2007-11-27 19:23:34 +00:00
|
|
|
|
2015-11-19 22:46:46 +00:00
|
|
|
/* TTY command context. */
|
2009-07-23 12:38:01 +00:00
|
|
|
struct tty_ctx {
|
2017-02-08 23:53:03 +00:00
|
|
|
struct window_pane *wp;
|
2009-07-23 12:38:01 +00:00
|
|
|
|
2017-02-08 23:53:03 +00:00
|
|
|
const struct grid_cell *cell;
|
2017-04-25 18:30:29 +00:00
|
|
|
int wrapped;
|
2009-07-23 12:38:01 +00:00
|
|
|
|
2019-11-28 09:56:25 +00:00
|
|
|
u_int num;
|
|
|
|
void *ptr;
|
2009-07-23 12:48:18 +00:00
|
|
|
|
2009-12-18 18:57:00 +00:00
|
|
|
/*
|
2009-07-23 12:48:18 +00:00
|
|
|
* 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-10-23 17:06:23 +00:00
|
|
|
|
Support for windows larger than the client.
This adds two new options, window-size and default-size, and a new
command, resize-window.
The force-width and force-height options, and the session_width and
session_height formats have been removed.
The new window-size option tells tmux how to work out the size of
windows: largest means it picks the size of the largest session,
smallest the smallest session (similar to the old behaviour) and
manual means that it does not automatically resize
windows. aggressive-resize modifies the choice of session for largest
and smallest as it did before.
If a window is in a session attached to a client that is too small,
only part of the window is shown. tmux attempts to keep the cursor
visible, so the part of the window displayed is changed as the cursor
moves (with a small delay, to try and avoid excess redrawing when
applications redraw status lines or similar that are not currently
visible).
Drawing windows which are larger than the client is not as efficient
as those which fit, particularly when the cursor moves, so it is
recommended to avoid using this on slow machines or networks (set
window-size to smallest or manual).
The resize-window command can be used to resize a window manually. If
it is used, the window-size option is automatically set to manual for
the window (undo this with "setw -u window-size"). resize-window works
in a similar way to resize-pane (-U -D -L -R -x -y flags) but also has
-a and -A flags. -a sets the window to the size of the smallest client
(what it would be if window-size was smallest) and -A the largest.
For the same behaviour as force-width or force-height, use
resize-width -x or -y.
If the global window-size option is set to manual, the default-size
option is used for new windows. If -x or -y is used with new-session,
that sets the default-size option for the new session.
The maximum size of a window is 10000x10000. But expect applications
to complain and higher memory use if you make a window that big. The
minimum size is the size required for the current layout including
borders.
This change allows some code improvements, most notably that since
windows can now never be cropped, that code can be removed from the
layout code, and since panes can now never be outside the size of the
window, window_pane_visible can be removed.
2018-08-20 14:22:14 +00:00
|
|
|
/* Pane offset. */
|
2012-01-29 12:57:01 +00:00
|
|
|
u_int xoff;
|
|
|
|
u_int yoff;
|
|
|
|
|
2016-10-13 20:27:27 +00:00
|
|
|
/* The background colour used for clearing (erasing). */
|
|
|
|
u_int bg;
|
Support for windows larger than the client.
This adds two new options, window-size and default-size, and a new
command, resize-window.
The force-width and force-height options, and the session_width and
session_height formats have been removed.
The new window-size option tells tmux how to work out the size of
windows: largest means it picks the size of the largest session,
smallest the smallest session (similar to the old behaviour) and
manual means that it does not automatically resize
windows. aggressive-resize modifies the choice of session for largest
and smallest as it did before.
If a window is in a session attached to a client that is too small,
only part of the window is shown. tmux attempts to keep the cursor
visible, so the part of the window displayed is changed as the cursor
moves (with a small delay, to try and avoid excess redrawing when
applications redraw status lines or similar that are not currently
visible).
Drawing windows which are larger than the client is not as efficient
as those which fit, particularly when the cursor moves, so it is
recommended to avoid using this on slow machines or networks (set
window-size to smallest or manual).
The resize-window command can be used to resize a window manually. If
it is used, the window-size option is automatically set to manual for
the window (undo this with "setw -u window-size"). resize-window works
in a similar way to resize-pane (-U -D -L -R -x -y flags) but also has
-a and -A flags. -a sets the window to the size of the smallest client
(what it would be if window-size was smallest) and -A the largest.
For the same behaviour as force-width or force-height, use
resize-width -x or -y.
If the global window-size option is set to manual, the default-size
option is used for new windows. If -x or -y is used with new-session,
that sets the default-size option for the new session.
The maximum size of a window is 10000x10000. But expect applications
to complain and higher memory use if you make a window that big. The
minimum size is the size required for the current layout including
borders.
This change allows some code improvements, most notably that since
windows can now never be cropped, that code can be removed from the
layout code, and since panes can now never be outside the size of the
window, window_pane_visible can be removed.
2018-08-20 14:22:14 +00:00
|
|
|
|
|
|
|
/* Window offset and size. */
|
|
|
|
int bigger;
|
|
|
|
u_int ox;
|
|
|
|
u_int oy;
|
|
|
|
u_int sx;
|
|
|
|
u_int sy;
|
2009-07-23 12:38:01 +00:00
|
|
|
};
|
|
|
|
|
2009-11-19 22:20:04 +00:00
|
|
|
/* Saved message entry. */
|
|
|
|
struct message_entry {
|
2015-05-08 16:33:29 +00:00
|
|
|
char *msg;
|
|
|
|
u_int msg_num;
|
|
|
|
time_t msg_time;
|
2015-04-25 18:33:59 +00:00
|
|
|
TAILQ_ENTRY(message_entry) entry;
|
2009-11-19 22:20:04 +00:00
|
|
|
};
|
|
|
|
|
2013-05-31 12:19:34 +00:00
|
|
|
/* Parsed arguments structures. */
|
2015-08-29 23:19:52 +00:00
|
|
|
struct args_entry;
|
2013-05-31 12:19:34 +00:00
|
|
|
RB_HEAD(args_tree, args_entry);
|
|
|
|
struct args {
|
|
|
|
struct args_tree tree;
|
2015-05-08 16:48:12 +00:00
|
|
|
int argc;
|
|
|
|
char **argv;
|
2011-01-07 14:45:34 +00:00
|
|
|
};
|
|
|
|
|
2015-12-13 17:55:14 +00:00
|
|
|
/* Command find structures. */
|
|
|
|
enum cmd_find_type {
|
|
|
|
CMD_FIND_PANE,
|
|
|
|
CMD_FIND_WINDOW,
|
|
|
|
CMD_FIND_SESSION,
|
|
|
|
};
|
|
|
|
struct cmd_find_state {
|
|
|
|
int flags;
|
|
|
|
struct cmd_find_state *current;
|
2015-12-13 14:32:38 +00:00
|
|
|
|
2016-10-13 20:27:27 +00:00
|
|
|
struct session *s;
|
|
|
|
struct winlink *wl;
|
2015-12-13 17:55:14 +00:00
|
|
|
struct window *w;
|
2016-10-13 20:27:27 +00:00
|
|
|
struct window_pane *wp;
|
2015-12-13 17:55:14 +00:00
|
|
|
int idx;
|
2015-12-13 14:32:38 +00:00
|
|
|
};
|
2015-12-13 17:55:14 +00:00
|
|
|
|
|
|
|
/* Command find flags. */
|
|
|
|
#define CMD_FIND_PREFER_UNATTACHED 0x1
|
|
|
|
#define CMD_FIND_QUIET 0x2
|
|
|
|
#define CMD_FIND_WINDOW_INDEX 0x4
|
|
|
|
#define CMD_FIND_DEFAULT_MARKED 0x8
|
|
|
|
#define CMD_FIND_EXACT_SESSION 0x10
|
|
|
|
#define CMD_FIND_EXACT_WINDOW 0x20
|
2017-04-22 10:22:39 +00:00
|
|
|
#define CMD_FIND_CANFAIL 0x40
|
2015-12-13 14:32:38 +00:00
|
|
|
|
2013-02-23 22:25:58 +00:00
|
|
|
/* Command and list of commands. */
|
2008-06-02 18:08:17 +00:00
|
|
|
struct cmd {
|
2019-05-23 11:13:30 +00:00
|
|
|
const struct cmd_entry *entry;
|
|
|
|
struct args *args;
|
|
|
|
u_int group;
|
2009-01-18 14:40:48 +00:00
|
|
|
|
2019-05-23 11:13:30 +00:00
|
|
|
char *file;
|
|
|
|
u_int line;
|
|
|
|
|
|
|
|
char *alias;
|
|
|
|
int argc;
|
|
|
|
char **argv;
|
2013-02-23 22:25:58 +00:00
|
|
|
|
2019-05-23 11:13:30 +00:00
|
|
|
TAILQ_ENTRY(cmd) qentry;
|
2008-06-02 18:08:17 +00:00
|
|
|
};
|
2019-05-23 11:13:30 +00:00
|
|
|
TAILQ_HEAD(cmds, cmd);
|
2015-05-08 16:33:29 +00:00
|
|
|
|
2010-07-02 02:43:01 +00:00
|
|
|
struct cmd_list {
|
2019-05-23 11:13:30 +00:00
|
|
|
int references;
|
|
|
|
u_int group;
|
|
|
|
struct cmds list;
|
2010-07-02 02:43:01 +00:00
|
|
|
};
|
2008-06-02 18:08:17 +00:00
|
|
|
|
2013-02-23 22:25:58 +00:00
|
|
|
/* Command return values. */
|
2012-07-11 19:37:32 +00:00
|
|
|
enum cmd_retval {
|
|
|
|
CMD_RETURN_ERROR = -1,
|
|
|
|
CMD_RETURN_NORMAL = 0,
|
2013-02-23 22:25:58 +00:00
|
|
|
CMD_RETURN_WAIT,
|
|
|
|
CMD_RETURN_STOP
|
|
|
|
};
|
|
|
|
|
2019-05-23 11:13:30 +00:00
|
|
|
/* Command parse result. */
|
|
|
|
enum cmd_parse_status {
|
|
|
|
CMD_PARSE_EMPTY,
|
|
|
|
CMD_PARSE_ERROR,
|
|
|
|
CMD_PARSE_SUCCESS
|
|
|
|
};
|
|
|
|
struct cmd_parse_result {
|
|
|
|
enum cmd_parse_status status;
|
|
|
|
struct cmd_list *cmdlist;
|
|
|
|
char *error;
|
|
|
|
};
|
|
|
|
struct cmd_parse_input {
|
|
|
|
int flags;
|
|
|
|
#define CMD_PARSE_QUIET 0x1
|
|
|
|
#define CMD_PARSE_PARSEONLY 0x2
|
|
|
|
#define CMD_PARSE_NOALIAS 0x4
|
2019-06-05 20:00:53 +00:00
|
|
|
#define CMD_PARSE_VERBOSE 0x8
|
2019-05-23 11:13:30 +00:00
|
|
|
|
|
|
|
const char *file;
|
|
|
|
u_int line;
|
|
|
|
|
|
|
|
struct cmdq_item *item;
|
|
|
|
struct client *c;
|
|
|
|
struct cmd_find_state fs;
|
|
|
|
};
|
|
|
|
|
2016-10-16 17:55:14 +00:00
|
|
|
/* Command queue item type. */
|
2016-10-16 19:04:05 +00:00
|
|
|
enum cmdq_type {
|
|
|
|
CMDQ_COMMAND,
|
|
|
|
CMDQ_CALLBACK,
|
2013-02-23 22:25:58 +00:00
|
|
|
};
|
|
|
|
|
2017-04-21 14:01:19 +00:00
|
|
|
/* Command queue item shared state. */
|
|
|
|
struct cmdq_shared {
|
|
|
|
int references;
|
|
|
|
|
|
|
|
int flags;
|
|
|
|
#define CMDQ_SHARED_REPEAT 0x1
|
2019-05-18 21:14:10 +00:00
|
|
|
#define CMDQ_SHARED_CONTROL 0x2
|
2017-04-21 14:01:19 +00:00
|
|
|
|
|
|
|
struct format_tree *formats;
|
|
|
|
|
|
|
|
struct mouse_event mouse;
|
|
|
|
struct cmd_find_state current;
|
|
|
|
};
|
|
|
|
|
2016-10-16 17:55:14 +00:00
|
|
|
/* Command queue item. */
|
2016-10-16 19:04:05 +00:00
|
|
|
typedef enum cmd_retval (*cmdq_cb) (struct cmdq_item *, void *);
|
|
|
|
struct cmdq_item {
|
2019-05-03 15:43:01 +00:00
|
|
|
char *name;
|
2016-10-16 19:04:05 +00:00
|
|
|
struct cmdq_list *queue;
|
|
|
|
struct cmdq_item *next;
|
2013-02-23 22:25:58 +00:00
|
|
|
|
|
|
|
struct client *client;
|
|
|
|
|
2016-10-16 19:04:05 +00:00
|
|
|
enum cmdq_type type;
|
2016-10-16 17:55:14 +00:00
|
|
|
u_int group;
|
|
|
|
|
|
|
|
u_int number;
|
|
|
|
time_t time;
|
|
|
|
|
|
|
|
int flags;
|
2016-10-16 19:04:05 +00:00
|
|
|
#define CMDQ_FIRED 0x1
|
|
|
|
#define CMDQ_WAITING 0x2
|
|
|
|
#define CMDQ_NOHOOKS 0x4
|
2016-10-16 17:55:14 +00:00
|
|
|
|
2017-04-21 14:01:19 +00:00
|
|
|
struct cmdq_shared *shared;
|
2017-04-22 10:22:39 +00:00
|
|
|
struct cmd_find_state source;
|
|
|
|
struct cmd_find_state target;
|
|
|
|
|
2016-10-16 17:55:14 +00:00
|
|
|
struct cmd_list *cmdlist;
|
2013-02-23 22:25:58 +00:00
|
|
|
struct cmd *cmd;
|
2016-10-16 17:55:14 +00:00
|
|
|
|
2016-10-16 19:04:05 +00:00
|
|
|
cmdq_cb cb;
|
2016-10-16 17:55:14 +00:00
|
|
|
void *data;
|
2013-02-23 22:25:58 +00:00
|
|
|
|
2016-10-16 19:04:05 +00:00
|
|
|
TAILQ_ENTRY(cmdq_item) entry;
|
2012-07-11 19:37:32 +00:00
|
|
|
};
|
2016-10-16 19:04:05 +00:00
|
|
|
TAILQ_HEAD(cmdq_list, cmdq_item);
|
2012-07-11 19:37:32 +00:00
|
|
|
|
2017-04-22 10:22:39 +00:00
|
|
|
/* Command definition flag. */
|
|
|
|
struct cmd_entry_flag {
|
|
|
|
char flag;
|
|
|
|
enum cmd_find_type type;
|
|
|
|
int flags;
|
2015-12-14 00:31:54 +00:00
|
|
|
};
|
|
|
|
|
2013-02-23 22:25:58 +00:00
|
|
|
/* Command definition. */
|
2007-10-03 21:31:07 +00:00
|
|
|
struct cmd_entry {
|
2015-12-13 21:53:57 +00:00
|
|
|
const char *name;
|
|
|
|
const char *alias;
|
2011-01-07 14:45:34 +00:00
|
|
|
|
2015-12-13 21:53:57 +00:00
|
|
|
struct {
|
|
|
|
const char *template;
|
|
|
|
int lower;
|
|
|
|
int upper;
|
|
|
|
} args;
|
|
|
|
const char *usage;
|
2007-10-03 21:31:07 +00:00
|
|
|
|
2017-04-22 10:22:39 +00:00
|
|
|
struct cmd_entry_flag source;
|
|
|
|
struct cmd_entry_flag target;
|
2015-12-14 00:31:54 +00:00
|
|
|
|
2007-10-03 21:31:07 +00:00
|
|
|
#define CMD_STARTSERVER 0x1
|
2015-06-04 23:27:51 +00:00
|
|
|
#define CMD_READONLY 0x2
|
2016-10-13 22:48:51 +00:00
|
|
|
#define CMD_AFTERHOOK 0x4
|
2015-12-14 00:31:54 +00:00
|
|
|
int flags;
|
2007-10-03 21:31:07 +00:00
|
|
|
|
2017-04-22 10:22:39 +00:00
|
|
|
enum cmd_retval (*exec)(struct cmd *, struct cmdq_item *);
|
2008-12-08 16:19:51 +00:00
|
|
|
};
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2018-02-05 08:21:54 +00:00
|
|
|
/* Status line. */
|
2019-03-18 20:53:33 +00:00
|
|
|
#define STATUS_LINES_LIMIT 5
|
|
|
|
struct status_line_entry {
|
|
|
|
char *expanded;
|
|
|
|
struct style_ranges ranges;
|
|
|
|
};
|
2018-02-05 08:21:54 +00:00
|
|
|
struct status_line {
|
2019-03-18 20:53:33 +00:00
|
|
|
struct event timer;
|
2018-08-20 20:41:58 +00:00
|
|
|
|
2019-03-18 20:53:33 +00:00
|
|
|
struct screen screen;
|
|
|
|
struct screen *active;
|
|
|
|
int references;
|
2018-08-22 20:06:14 +00:00
|
|
|
|
2019-03-18 20:53:33 +00:00
|
|
|
struct grid_cell style;
|
|
|
|
struct status_line_entry entries[STATUS_LINES_LIMIT];
|
2018-02-05 08:21:54 +00:00
|
|
|
};
|
|
|
|
|
2016-10-16 17:55:14 +00:00
|
|
|
/* Client connection. */
|
2017-05-17 15:20:23 +00:00
|
|
|
typedef int (*prompt_input_cb)(struct client *, void *, const char *, int);
|
|
|
|
typedef void (*prompt_free_cb)(void *);
|
2019-05-07 20:01:41 +00:00
|
|
|
typedef void (*overlay_draw_cb)(struct client *, struct screen_redraw_ctx *);
|
|
|
|
typedef int (*overlay_key_cb)(struct client *, struct key_event *);
|
|
|
|
typedef void (*overlay_free_cb)(struct client *);
|
2016-10-16 17:55:14 +00:00
|
|
|
struct client {
|
2017-04-05 10:49:46 +00:00
|
|
|
const char *name;
|
2016-10-16 17:55:14 +00:00
|
|
|
struct tmuxpeer *peer;
|
2016-10-16 19:04:05 +00:00
|
|
|
struct cmdq_list queue;
|
2016-10-16 17:55:14 +00:00
|
|
|
|
|
|
|
pid_t pid;
|
|
|
|
int fd;
|
|
|
|
struct event event;
|
|
|
|
int retval;
|
|
|
|
|
|
|
|
struct timeval creation_time;
|
|
|
|
struct timeval activity_time;
|
|
|
|
|
|
|
|
struct environ *environ;
|
2017-05-01 12:20:55 +00:00
|
|
|
struct format_job_tree *jobs;
|
2016-10-16 17:55:14 +00:00
|
|
|
|
|
|
|
char *title;
|
|
|
|
const char *cwd;
|
|
|
|
|
|
|
|
char *term;
|
|
|
|
char *ttyname;
|
|
|
|
struct tty tty;
|
|
|
|
|
2017-04-19 06:52:27 +00:00
|
|
|
size_t written;
|
|
|
|
size_t discarded;
|
2017-05-09 13:04:36 +00:00
|
|
|
size_t redraw;
|
2017-04-19 06:52:27 +00:00
|
|
|
|
2016-10-16 17:55:14 +00:00
|
|
|
void (*stdin_callback)(struct client *, int, void *);
|
|
|
|
void *stdin_callback_data;
|
|
|
|
struct evbuffer *stdin_data;
|
|
|
|
int stdin_closed;
|
|
|
|
struct evbuffer *stdout_data;
|
|
|
|
struct evbuffer *stderr_data;
|
|
|
|
|
|
|
|
struct event repeat_timer;
|
|
|
|
|
|
|
|
struct event click_timer;
|
|
|
|
u_int click_button;
|
|
|
|
|
2018-02-05 08:21:54 +00:00
|
|
|
struct status_line status;
|
2017-05-29 20:42:53 +00:00
|
|
|
|
2016-10-16 17:55:14 +00:00
|
|
|
#define CLIENT_TERMINAL 0x1
|
|
|
|
#define CLIENT_LOGIN 0x2
|
|
|
|
#define CLIENT_EXIT 0x4
|
2018-08-19 16:45:03 +00:00
|
|
|
#define CLIENT_REDRAWWINDOW 0x8
|
|
|
|
#define CLIENT_REDRAWSTATUS 0x10
|
2016-10-16 17:55:14 +00:00
|
|
|
#define CLIENT_REPEAT 0x20
|
|
|
|
#define CLIENT_SUSPENDED 0x40
|
|
|
|
#define CLIENT_ATTACHED 0x80
|
2019-06-07 20:09:17 +00:00
|
|
|
#define CLIENT_EXITED 0x100
|
2016-10-16 17:55:14 +00:00
|
|
|
#define CLIENT_DEAD 0x200
|
2018-08-19 16:45:03 +00:00
|
|
|
#define CLIENT_REDRAWBORDERS 0x400
|
2016-10-16 17:55:14 +00:00
|
|
|
#define CLIENT_READONLY 0x800
|
2017-04-19 14:00:28 +00:00
|
|
|
#define CLIENT_DETACHING 0x1000
|
2016-10-16 17:55:14 +00:00
|
|
|
#define CLIENT_CONTROL 0x2000
|
|
|
|
#define CLIENT_CONTROLCONTROL 0x4000
|
|
|
|
#define CLIENT_FOCUSED 0x8000
|
|
|
|
#define CLIENT_UTF8 0x10000
|
|
|
|
#define CLIENT_256COLOURS 0x20000
|
|
|
|
#define CLIENT_IDENTIFIED 0x40000
|
|
|
|
#define CLIENT_STATUSFORCE 0x80000
|
|
|
|
#define CLIENT_DOUBLECLICK 0x100000
|
|
|
|
#define CLIENT_TRIPLECLICK 0x200000
|
2017-05-10 16:48:36 +00:00
|
|
|
#define CLIENT_SIZECHANGED 0x400000
|
2017-10-16 19:30:53 +00:00
|
|
|
#define CLIENT_STATUSOFF 0x800000
|
2018-08-19 20:13:07 +00:00
|
|
|
#define CLIENT_REDRAWSTATUSALWAYS 0x1000000
|
2019-05-08 18:07:12 +00:00
|
|
|
#define CLIENT_REDRAWOVERLAY 0x2000000
|
2019-07-10 11:20:10 +00:00
|
|
|
#define CLIENT_CONTROL_NOOUTPUT 0x4000000
|
2018-09-25 08:48:48 +00:00
|
|
|
#define CLIENT_ALLREDRAWFLAGS \
|
|
|
|
(CLIENT_REDRAWWINDOW| \
|
|
|
|
CLIENT_REDRAWSTATUS| \
|
|
|
|
CLIENT_REDRAWSTATUSALWAYS| \
|
2019-05-08 18:07:12 +00:00
|
|
|
CLIENT_REDRAWBORDERS| \
|
|
|
|
CLIENT_REDRAWOVERLAY)
|
2018-09-25 08:48:48 +00:00
|
|
|
#define CLIENT_NOSIZEFLAGS \
|
2019-03-12 13:56:30 +00:00
|
|
|
(CLIENT_DEAD| \
|
2018-09-25 08:48:48 +00:00
|
|
|
CLIENT_SUSPENDED| \
|
|
|
|
CLIENT_DETACHING)
|
2016-10-16 17:55:14 +00:00
|
|
|
int flags;
|
|
|
|
struct key_table *keytable;
|
|
|
|
|
|
|
|
char *message_string;
|
|
|
|
struct event message_timer;
|
|
|
|
u_int message_next;
|
|
|
|
TAILQ_HEAD(, message_entry) message_log;
|
|
|
|
|
|
|
|
char *prompt_string;
|
|
|
|
struct utf8_data *prompt_buffer;
|
|
|
|
size_t prompt_index;
|
2017-05-17 15:20:23 +00:00
|
|
|
prompt_input_cb prompt_inputcb;
|
|
|
|
prompt_free_cb prompt_freecb;
|
2016-10-16 17:55:14 +00:00
|
|
|
void *prompt_data;
|
|
|
|
u_int prompt_hindex;
|
|
|
|
enum { PROMPT_ENTRY, PROMPT_COMMAND } prompt_mode;
|
2018-08-29 09:50:32 +00:00
|
|
|
struct utf8_data *prompt_saved;
|
2016-10-16 17:55:14 +00:00
|
|
|
|
|
|
|
#define PROMPT_SINGLE 0x1
|
|
|
|
#define PROMPT_NUMERIC 0x2
|
2017-01-06 11:57:03 +00:00
|
|
|
#define PROMPT_INCREMENTAL 0x4
|
2017-05-29 20:42:53 +00:00
|
|
|
#define PROMPT_NOFORMAT 0x8
|
2016-10-16 17:55:14 +00:00
|
|
|
int prompt_flags;
|
|
|
|
|
|
|
|
struct session *session;
|
|
|
|
struct session *last_session;
|
|
|
|
|
|
|
|
int references;
|
|
|
|
|
2018-08-21 08:27:19 +00:00
|
|
|
void *pan_window;
|
|
|
|
u_int pan_ox;
|
|
|
|
u_int pan_oy;
|
|
|
|
|
2019-05-07 20:01:41 +00:00
|
|
|
overlay_draw_cb overlay_draw;
|
|
|
|
overlay_key_cb overlay_key;
|
|
|
|
overlay_free_cb overlay_free;
|
|
|
|
void *overlay_data;
|
|
|
|
struct event overlay_timer;
|
|
|
|
|
2016-10-16 17:55:14 +00:00
|
|
|
TAILQ_ENTRY(client) entry;
|
|
|
|
};
|
|
|
|
TAILQ_HEAD(clients, client);
|
|
|
|
|
2015-04-20 15:34:56 +00:00
|
|
|
/* Key binding and key table. */
|
2009-01-06 14:10:32 +00:00
|
|
|
struct key_binding {
|
2015-11-12 11:05:34 +00:00
|
|
|
key_code key;
|
2015-04-20 15:34:56 +00:00
|
|
|
struct cmd_list *cmdlist;
|
2017-04-21 14:01:19 +00:00
|
|
|
|
|
|
|
int flags;
|
|
|
|
#define KEY_BINDING_REPEAT 0x1
|
2009-01-06 14:10:32 +00:00
|
|
|
|
2015-04-20 15:34:56 +00:00
|
|
|
RB_ENTRY(key_binding) entry;
|
2007-10-03 11:26:34 +00:00
|
|
|
};
|
2012-01-21 19:38:26 +00:00
|
|
|
RB_HEAD(key_bindings, key_binding);
|
2015-05-08 16:33:29 +00:00
|
|
|
|
2015-04-20 15:34:56 +00:00
|
|
|
struct key_table {
|
2018-08-02 11:18:34 +00:00
|
|
|
const char *name;
|
2015-04-20 15:34:56 +00:00
|
|
|
struct key_bindings key_bindings;
|
|
|
|
|
|
|
|
u_int references;
|
|
|
|
|
|
|
|
RB_ENTRY(key_table) entry;
|
|
|
|
};
|
|
|
|
RB_HEAD(key_tables, key_table);
|
2007-10-03 11:26:34 +00:00
|
|
|
|
2019-04-23 20:36:55 +00:00
|
|
|
/* Option data. */
|
|
|
|
RB_HEAD(options_array, options_array_item);
|
|
|
|
union options_value {
|
|
|
|
char *string;
|
|
|
|
long long number;
|
|
|
|
struct style style;
|
|
|
|
struct options_array array;
|
2019-04-26 11:38:51 +00:00
|
|
|
struct cmd_list *cmdlist;
|
2019-04-23 20:36:55 +00:00
|
|
|
};
|
|
|
|
|
2017-01-16 14:49:14 +00:00
|
|
|
/* Option table entries. */
|
2011-01-03 23:52:38 +00:00
|
|
|
enum options_table_type {
|
|
|
|
OPTIONS_TABLE_STRING,
|
|
|
|
OPTIONS_TABLE_NUMBER,
|
2012-01-21 19:36:40 +00:00
|
|
|
OPTIONS_TABLE_KEY,
|
2011-01-03 23:52:38 +00:00
|
|
|
OPTIONS_TABLE_COLOUR,
|
|
|
|
OPTIONS_TABLE_FLAG,
|
2014-01-28 23:07:09 +00:00
|
|
|
OPTIONS_TABLE_CHOICE,
|
2019-04-26 11:38:51 +00:00
|
|
|
OPTIONS_TABLE_STYLE,
|
|
|
|
OPTIONS_TABLE_COMMAND
|
2011-01-03 23:52:38 +00:00
|
|
|
};
|
2018-08-02 11:18:34 +00:00
|
|
|
|
2019-06-20 11:59:59 +00:00
|
|
|
#define OPTIONS_TABLE_NONE 0
|
|
|
|
#define OPTIONS_TABLE_SERVER 0x1
|
|
|
|
#define OPTIONS_TABLE_SESSION 0x2
|
|
|
|
#define OPTIONS_TABLE_WINDOW 0x4
|
|
|
|
#define OPTIONS_TABLE_PANE 0x8
|
2011-01-03 23:52:38 +00:00
|
|
|
|
2019-04-23 20:36:55 +00:00
|
|
|
#define OPTIONS_TABLE_IS_ARRAY 0x1
|
2019-04-26 11:38:51 +00:00
|
|
|
#define OPTIONS_TABLE_IS_HOOK 0x2
|
2019-04-23 20:36:55 +00:00
|
|
|
|
2011-01-03 23:52:38 +00:00
|
|
|
struct options_table_entry {
|
2015-11-20 12:01:19 +00:00
|
|
|
const char *name;
|
|
|
|
enum options_table_type type;
|
2019-06-20 11:59:59 +00:00
|
|
|
int scope;
|
2019-04-23 20:36:55 +00:00
|
|
|
int flags;
|
2008-06-23 22:12:29 +00:00
|
|
|
|
2015-11-20 12:01:19 +00:00
|
|
|
u_int minimum;
|
|
|
|
u_int maximum;
|
|
|
|
const char **choices;
|
2008-09-26 06:45:28 +00:00
|
|
|
|
2015-11-20 12:01:19 +00:00
|
|
|
const char *default_str;
|
|
|
|
long long default_num;
|
2019-03-15 21:54:47 +00:00
|
|
|
const char **default_arr;
|
2014-01-28 23:07:09 +00:00
|
|
|
|
2017-01-24 19:11:46 +00:00
|
|
|
const char *separator;
|
Support for windows larger than the client.
This adds two new options, window-size and default-size, and a new
command, resize-window.
The force-width and force-height options, and the session_width and
session_height formats have been removed.
The new window-size option tells tmux how to work out the size of
windows: largest means it picks the size of the largest session,
smallest the smallest session (similar to the old behaviour) and
manual means that it does not automatically resize
windows. aggressive-resize modifies the choice of session for largest
and smallest as it did before.
If a window is in a session attached to a client that is too small,
only part of the window is shown. tmux attempts to keep the cursor
visible, so the part of the window displayed is changed as the cursor
moves (with a small delay, to try and avoid excess redrawing when
applications redraw status lines or similar that are not currently
visible).
Drawing windows which are larger than the client is not as efficient
as those which fit, particularly when the cursor moves, so it is
recommended to avoid using this on slow machines or networks (set
window-size to smallest or manual).
The resize-window command can be used to resize a window manually. If
it is used, the window-size option is automatically set to manual for
the window (undo this with "setw -u window-size"). resize-window works
in a similar way to resize-pane (-U -D -L -R -x -y flags) but also has
-a and -A flags. -a sets the window to the size of the smallest client
(what it would be if window-size was smallest) and -A the largest.
For the same behaviour as force-width or force-height, use
resize-width -x or -y.
If the global window-size option is set to manual, the default-size
option is used for new windows. If -x or -y is used with new-session,
that sets the default-size option for the new session.
The maximum size of a window is 10000x10000. But expect applications
to complain and higher memory use if you make a window that big. The
minimum size is the size required for the current layout including
borders.
This change allows some code improvements, most notably that since
windows can now never be cropped, that code can be removed from the
layout code, and since panes can now never be outside the size of the
window, window_pane_visible can be removed.
2018-08-20 14:22:14 +00:00
|
|
|
const char *pattern;
|
2008-06-23 07:41:21 +00:00
|
|
|
};
|
2008-07-02 21:22:57 +00:00
|
|
|
|
2011-01-07 14:45:34 +00:00
|
|
|
/* Common command usages. */
|
|
|
|
#define CMD_TARGET_PANE_USAGE "[-t target-pane]"
|
|
|
|
#define CMD_TARGET_WINDOW_USAGE "[-t target-window]"
|
|
|
|
#define CMD_TARGET_SESSION_USAGE "[-t target-session]"
|
|
|
|
#define CMD_TARGET_CLIENT_USAGE "[-t target-client]"
|
|
|
|
#define CMD_SRCDST_PANE_USAGE "[-s src-pane] [-t dst-pane]"
|
|
|
|
#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]"
|
2014-05-13 07:34:35 +00:00
|
|
|
#define CMD_BUFFER_USAGE "[-b buffer-name]"
|
2011-01-07 14:45:34 +00:00
|
|
|
|
2019-04-07 12:01:03 +00:00
|
|
|
/* Spawn common context. */
|
|
|
|
struct spawn_context {
|
|
|
|
struct cmdq_item *item;
|
|
|
|
|
|
|
|
struct session *s;
|
|
|
|
struct winlink *wl;
|
2019-09-19 09:02:30 +00:00
|
|
|
struct client *c;
|
2019-04-07 12:01:03 +00:00
|
|
|
|
|
|
|
struct window_pane *wp0;
|
|
|
|
struct layout_cell *lc;
|
|
|
|
|
|
|
|
const char *name;
|
|
|
|
char **argv;
|
|
|
|
int argc;
|
2019-04-28 20:05:50 +00:00
|
|
|
struct environ *environ;
|
2019-04-07 12:01:03 +00:00
|
|
|
|
|
|
|
int idx;
|
|
|
|
const char *cwd;
|
|
|
|
|
|
|
|
int flags;
|
|
|
|
#define SPAWN_KILL 0x1
|
|
|
|
#define SPAWN_DETACHED 0x2
|
|
|
|
#define SPAWN_RESPAWN 0x4
|
|
|
|
#define SPAWN_BEFORE 0x8
|
|
|
|
#define SPAWN_NONOTIFY 0x10
|
|
|
|
#define SPAWN_FULLSIZE 0x20
|
2019-05-03 20:44:24 +00:00
|
|
|
#define SPAWN_EMPTY 0x40
|
2019-04-07 12:01:03 +00:00
|
|
|
};
|
|
|
|
|
2019-08-16 11:49:12 +00:00
|
|
|
/* Mode tree sort order. */
|
|
|
|
struct mode_tree_sort_criteria {
|
|
|
|
u_int field;
|
|
|
|
int reversed;
|
|
|
|
};
|
|
|
|
|
2007-07-09 19:04:12 +00:00
|
|
|
/* tmux.c */
|
2015-12-08 01:10:31 +00:00
|
|
|
extern struct options *global_options;
|
|
|
|
extern struct options *global_s_options;
|
|
|
|
extern struct options *global_w_options;
|
|
|
|
extern struct environ *global_environ;
|
2015-11-24 21:52:06 +00:00
|
|
|
extern struct timeval start_time;
|
2015-11-24 22:27:22 +00:00
|
|
|
extern const char *socket_path;
|
2017-07-12 09:24:17 +00:00
|
|
|
extern const char *shell_command;
|
2017-01-23 10:09:43 +00:00
|
|
|
extern int ptm_fd;
|
2017-07-12 09:21:25 +00:00
|
|
|
extern const char *shell_command;
|
2009-09-02 01:02:44 +00:00
|
|
|
int areshell(const char *);
|
2011-01-21 23:44:13 +00:00
|
|
|
void setblocking(int, int);
|
2018-11-22 10:36:40 +00:00
|
|
|
const char *find_cwd(void);
|
2015-07-20 15:50:04 +00:00
|
|
|
const char *find_home(void);
|
2007-09-26 13:43:15 +00:00
|
|
|
|
2015-10-27 13:23:24 +00:00
|
|
|
/* proc.c */
|
|
|
|
struct imsg;
|
|
|
|
int proc_send(struct tmuxpeer *, enum msgtype, int, const void *, size_t);
|
2017-07-12 09:24:17 +00:00
|
|
|
struct tmuxproc *proc_start(const char *);
|
2015-10-27 13:23:24 +00:00
|
|
|
void proc_loop(struct tmuxproc *, int (*)(void));
|
|
|
|
void proc_exit(struct tmuxproc *);
|
2017-07-12 09:24:17 +00:00
|
|
|
void proc_set_signals(struct tmuxproc *, void(*)(int));
|
2017-07-14 18:49:07 +00:00
|
|
|
void proc_clear_signals(struct tmuxproc *, int);
|
2015-10-27 13:23:24 +00:00
|
|
|
struct tmuxpeer *proc_add_peer(struct tmuxproc *, int,
|
|
|
|
void (*)(struct imsg *, void *), void *);
|
|
|
|
void proc_remove_peer(struct tmuxpeer *);
|
|
|
|
void proc_kill_peer(struct tmuxpeer *);
|
2017-06-04 08:25:57 +00:00
|
|
|
void proc_toggle_log(struct tmuxproc *);
|
2015-10-27 13:23:24 +00:00
|
|
|
|
2008-06-02 18:08:17 +00:00
|
|
|
/* cfg.c */
|
2013-02-23 22:25:58 +00:00
|
|
|
extern int cfg_finished;
|
2019-02-16 11:42:08 +00:00
|
|
|
extern struct client *cfg_client;
|
2016-10-16 19:04:05 +00:00
|
|
|
void start_cfg(void);
|
2019-05-20 13:23:32 +00:00
|
|
|
int load_cfg(const char *, struct client *, struct cmdq_item *, int,
|
|
|
|
struct cmdq_item **);
|
2016-10-16 19:04:05 +00:00
|
|
|
void set_cfg_file(const char *);
|
2016-01-15 11:31:47 +00:00
|
|
|
void printflike(1, 2) cfg_add_cause(const char *, ...);
|
2016-10-16 19:04:05 +00:00
|
|
|
void cfg_print_causes(struct cmdq_item *);
|
|
|
|
void cfg_show_causes(struct session *);
|
2008-06-02 18:08:17 +00:00
|
|
|
|
2015-08-29 09:25:00 +00:00
|
|
|
/* paste.c */
|
|
|
|
struct paste_buffer;
|
|
|
|
const char *paste_buffer_name(struct paste_buffer *);
|
2016-10-05 12:34:05 +00:00
|
|
|
u_int paste_buffer_order(struct paste_buffer *);
|
|
|
|
time_t paste_buffer_created(struct paste_buffer *);
|
2015-08-29 09:25:00 +00:00
|
|
|
const char *paste_buffer_data(struct paste_buffer *, size_t *);
|
|
|
|
struct paste_buffer *paste_walk(struct paste_buffer *);
|
|
|
|
struct paste_buffer *paste_get_top(const char **);
|
|
|
|
struct paste_buffer *paste_get_name(const char *);
|
2015-09-11 14:41:50 +00:00
|
|
|
void paste_free(struct paste_buffer *);
|
2019-04-02 09:03:39 +00:00
|
|
|
void paste_add(const char *, char *, size_t);
|
2015-08-29 09:25:00 +00:00
|
|
|
int paste_rename(const char *, const char *, char **);
|
|
|
|
int paste_set(char *, size_t, const char *, char **);
|
2015-11-12 11:09:11 +00:00
|
|
|
char *paste_make_sample(struct paste_buffer *);
|
2015-08-29 09:25:00 +00:00
|
|
|
|
2011-09-21 16:31:15 +00:00
|
|
|
/* format.c */
|
2015-09-14 10:25:52 +00:00
|
|
|
#define FORMAT_STATUS 0x1
|
|
|
|
#define FORMAT_FORCE 0x2
|
2017-01-09 21:03:25 +00:00
|
|
|
#define FORMAT_NOJOBS 0x4
|
2019-03-15 10:04:13 +00:00
|
|
|
#define FORMAT_VERBOSE 0x8
|
2017-02-03 11:57:27 +00:00
|
|
|
#define FORMAT_NONE 0
|
|
|
|
#define FORMAT_PANE 0x80000000U
|
|
|
|
#define FORMAT_WINDOW 0x40000000U
|
2014-12-02 23:19:45 +00:00
|
|
|
struct format_tree;
|
2019-05-10 14:12:47 +00:00
|
|
|
const char *format_skip(const char *, const char *);
|
Rewrite of choose mode, both to simplify and tidy the code and to add
some modern features.
Now the common code is in mode-tree.c, which provides an API used by the
three modes now separated into window-{buffer,client,tree}.c. Buffer
mode shows buffers, client mode clients and tree mode a tree of
sessions, windows and panes.
Each mode has a common set of key bindings plus a few that are specific
to the mode. Other changes are:
- each mode has a preview pane: for buffers this is the buffer content
(very useful), for others it is a preview of the pane;
- items may be sorted in different ways ('O' key);
- multiple items may be tagged and an operation applied to all of them
(for example, to delete multiple buffers at once);
- in tree mode a command may be run on the selected item (session,
window, pane) or on tagged items (key ':');
- displayed items may be filtered in tree mode by using a format (this
is used to implement find-window) (key 'f');
- the custom format (-F) for the display is no longer available;
- shortcut keys change from 0-9, a-z, A-Z which was always a bit weird
with keys used for other uses to 0-9, M-a to M-z.
Now that the code is simpler, other improvements will come later.
Primary key bindings for each mode are documented under the commands in
the man page (choose-buffer, choose-client, choose-tree).
Parts written by Thomas Adam.
2017-05-30 21:44:59 +00:00
|
|
|
int format_true(const char *);
|
2017-05-01 12:20:55 +00:00
|
|
|
struct format_tree *format_create(struct client *, struct cmdq_item *, int,
|
|
|
|
int);
|
2011-09-21 16:31:15 +00:00
|
|
|
void format_free(struct format_tree *);
|
2014-10-20 23:57:13 +00:00
|
|
|
void printflike(3, 4) format_add(struct format_tree *, const char *,
|
|
|
|
const char *, ...);
|
2019-03-18 14:10:25 +00:00
|
|
|
void format_each(struct format_tree *, void (*)(const char *,
|
|
|
|
const char *, void *), void *);
|
2019-03-14 23:14:27 +00:00
|
|
|
char *format_expand_time(struct format_tree *, const char *);
|
2011-09-21 16:31:15 +00:00
|
|
|
char *format_expand(struct format_tree *, const char *);
|
2017-03-08 13:36:12 +00:00
|
|
|
char *format_single(struct cmdq_item *, const char *,
|
|
|
|
struct client *, struct session *, struct winlink *,
|
|
|
|
struct window_pane *);
|
2015-02-05 10:29:43 +00:00
|
|
|
void format_defaults(struct format_tree *, struct client *,
|
|
|
|
struct session *, struct winlink *, struct window_pane *);
|
|
|
|
void format_defaults_window(struct format_tree *, struct window *);
|
|
|
|
void format_defaults_pane(struct format_tree *,
|
2013-08-19 21:16:11 +00:00
|
|
|
struct window_pane *);
|
2015-02-05 10:29:43 +00:00
|
|
|
void format_defaults_paste_buffer(struct format_tree *,
|
2015-11-12 11:09:11 +00:00
|
|
|
struct paste_buffer *);
|
2017-05-01 12:20:55 +00:00
|
|
|
void format_lost_client(struct client *);
|
2019-10-23 07:42:05 +00:00
|
|
|
char *format_grid_word(struct grid *, u_int, u_int);
|
|
|
|
char *format_grid_line(struct grid *, u_int);
|
2011-09-21 16:31:15 +00:00
|
|
|
|
2019-03-18 20:53:33 +00:00
|
|
|
/* format-draw.c */
|
|
|
|
void format_draw(struct screen_write_ctx *,
|
|
|
|
const struct grid_cell *, u_int, const char *,
|
|
|
|
struct style_ranges *);
|
|
|
|
u_int format_width(const char *);
|
|
|
|
char *format_trim_left(const char *, u_int);
|
|
|
|
char *format_trim_right(const char *, u_int);
|
|
|
|
|
2012-03-18 02:22:09 +00:00
|
|
|
/* notify.c */
|
2018-07-04 12:30:52 +00:00
|
|
|
void notify_hook(struct cmdq_item *, const char *);
|
2019-05-07 10:25:15 +00:00
|
|
|
void notify_input(struct window_pane *, const u_char *, size_t);
|
2016-10-16 22:06:40 +00:00
|
|
|
void notify_client(const char *, struct client *);
|
|
|
|
void notify_session(const char *, struct session *);
|
2017-04-21 14:09:44 +00:00
|
|
|
void notify_winlink(const char *, struct winlink *);
|
2016-10-16 22:06:40 +00:00
|
|
|
void notify_session_window(const char *, struct session *, struct window *);
|
|
|
|
void notify_window(const char *, struct window *);
|
|
|
|
void notify_pane(const char *, struct window_pane *);
|
2012-03-18 02:22:09 +00:00
|
|
|
|
2008-06-03 21:42:37 +00:00
|
|
|
/* options.c */
|
2017-01-15 20:48:41 +00:00
|
|
|
struct options *options_create(struct options *);
|
|
|
|
void options_free(struct options *);
|
2019-06-20 11:59:59 +00:00
|
|
|
void options_set_parent(struct options *, struct options *);
|
2017-01-16 14:49:14 +00:00
|
|
|
struct options_entry *options_first(struct options *);
|
|
|
|
struct options_entry *options_next(struct options_entry *);
|
|
|
|
struct options_entry *options_empty(struct options *,
|
2017-01-15 20:48:41 +00:00
|
|
|
const struct options_table_entry *);
|
2017-01-16 14:49:14 +00:00
|
|
|
struct options_entry *options_default(struct options *,
|
2017-01-15 20:48:41 +00:00
|
|
|
const struct options_table_entry *);
|
2017-01-16 14:49:14 +00:00
|
|
|
const char *options_name(struct options_entry *);
|
|
|
|
const struct options_table_entry *options_table_entry(struct options_entry *);
|
|
|
|
struct options_entry *options_get_only(struct options *, const char *);
|
|
|
|
struct options_entry *options_get(struct options *, const char *);
|
|
|
|
void options_remove(struct options_entry *);
|
2017-01-24 19:11:46 +00:00
|
|
|
void options_array_clear(struct options_entry *);
|
2019-04-23 20:36:55 +00:00
|
|
|
union options_value *options_array_get(struct options_entry *, u_int);
|
2017-01-24 19:11:46 +00:00
|
|
|
int options_array_set(struct options_entry *, u_int, const char *,
|
2019-04-26 11:38:51 +00:00
|
|
|
int, char **);
|
|
|
|
int options_array_assign(struct options_entry *, const char *,
|
|
|
|
char **);
|
2019-03-18 11:58:40 +00:00
|
|
|
struct options_array_item *options_array_first(struct options_entry *);
|
|
|
|
struct options_array_item *options_array_next(struct options_array_item *);
|
|
|
|
u_int options_array_item_index(struct options_array_item *);
|
2019-04-23 20:36:55 +00:00
|
|
|
union options_value *options_array_item_value(struct options_array_item *);
|
2019-03-18 11:58:40 +00:00
|
|
|
int options_isarray(struct options_entry *);
|
2017-01-16 14:49:14 +00:00
|
|
|
int options_isstring(struct options_entry *);
|
2019-04-25 18:18:55 +00:00
|
|
|
char *options_tostring(struct options_entry *, int, int);
|
2017-01-15 20:48:41 +00:00
|
|
|
char *options_parse(const char *, int *);
|
2017-01-16 14:49:14 +00:00
|
|
|
struct options_entry *options_parse_get(struct options *, const char *, int *,
|
2017-01-24 19:11:46 +00:00
|
|
|
int);
|
2017-01-15 20:48:41 +00:00
|
|
|
char *options_match(const char *, int *, int *);
|
2017-01-16 14:49:14 +00:00
|
|
|
struct options_entry *options_match_get(struct options *, const char *, int *,
|
2017-01-24 19:11:46 +00:00
|
|
|
int, int *);
|
2017-01-15 20:48:41 +00:00
|
|
|
const char *options_get_string(struct options *, const char *);
|
|
|
|
long long options_get_number(struct options *, const char *);
|
2019-03-14 09:53:52 +00:00
|
|
|
struct style *options_get_style(struct options *, const char *);
|
2017-01-16 14:49:14 +00:00
|
|
|
struct options_entry * printflike(4, 5) options_set_string(struct options *,
|
2017-01-15 20:48:41 +00:00
|
|
|
const char *, int, const char *, ...);
|
2017-01-16 14:49:14 +00:00
|
|
|
struct options_entry *options_set_number(struct options *, const char *,
|
|
|
|
long long);
|
|
|
|
struct options_entry *options_set_style(struct options *, const char *, int,
|
2017-01-15 20:48:41 +00:00
|
|
|
const char *);
|
2019-06-20 11:59:59 +00:00
|
|
|
int options_scope_from_name(struct args *, int,
|
2019-06-20 07:41:29 +00:00
|
|
|
const char *, struct cmd_find_state *, struct options **,
|
|
|
|
char **);
|
2019-06-20 11:59:59 +00:00
|
|
|
int options_scope_from_flags(struct args *, int,
|
2017-01-15 20:48:41 +00:00
|
|
|
struct cmd_find_state *, struct options **, char **);
|
2008-06-03 21:42:37 +00:00
|
|
|
|
2011-01-03 23:52:38 +00:00
|
|
|
/* options-table.c */
|
2015-11-20 12:01:19 +00:00
|
|
|
extern const struct options_table_entry options_table[];
|
2011-01-03 23:52:38 +00:00
|
|
|
|
2009-10-11 23:55:26 +00:00
|
|
|
/* job.c */
|
2018-08-23 15:45:05 +00:00
|
|
|
typedef void (*job_update_cb) (struct job *);
|
|
|
|
typedef void (*job_complete_cb) (struct job *);
|
|
|
|
typedef void (*job_free_cb) (void *);
|
|
|
|
#define JOB_NOWAIT 0x1
|
2017-04-20 09:20:22 +00:00
|
|
|
struct job *job_run(const char *, struct session *, const char *,
|
2018-03-08 08:09:10 +00:00
|
|
|
job_update_cb, job_complete_cb, job_free_cb, void *, int);
|
2017-04-20 09:20:22 +00:00
|
|
|
void job_free(struct job *);
|
2018-08-23 15:45:05 +00:00
|
|
|
void job_check_died(pid_t, int);
|
|
|
|
int job_get_status(struct job *);
|
|
|
|
void *job_get_data(struct job *);
|
|
|
|
struct bufferevent *job_get_event(struct job *);
|
|
|
|
void job_kill_all(void);
|
|
|
|
int job_still_running(void);
|
|
|
|
void job_print_summary(struct cmdq_item *, int);
|
2009-10-11 23:55:26 +00:00
|
|
|
|
2009-08-09 17:48:55 +00:00
|
|
|
/* environ.c */
|
2015-10-28 09:51:55 +00:00
|
|
|
struct environ *environ_create(void);
|
2009-08-09 17:48:55 +00:00
|
|
|
void environ_free(struct environ *);
|
2015-10-28 09:51:55 +00:00
|
|
|
struct environ_entry *environ_first(struct environ *);
|
|
|
|
struct environ_entry *environ_next(struct environ_entry *);
|
2009-08-09 17:48:55 +00:00
|
|
|
void environ_copy(struct environ *, struct environ *);
|
|
|
|
struct environ_entry *environ_find(struct environ *, const char *);
|
2015-11-24 23:46:15 +00:00
|
|
|
void printflike(3, 4) environ_set(struct environ *, const char *, const char *,
|
|
|
|
...);
|
|
|
|
void environ_clear(struct environ *, const char *);
|
2009-08-09 17:48:55 +00:00
|
|
|
void environ_put(struct environ *, const char *);
|
|
|
|
void environ_unset(struct environ *, const char *);
|
2017-01-24 20:15:32 +00:00
|
|
|
void environ_update(struct options *, struct environ *, struct environ *);
|
2010-04-06 21:59:19 +00:00
|
|
|
void environ_push(struct environ *);
|
2017-05-11 07:34:54 +00:00
|
|
|
void printflike(2, 3) environ_log(struct environ *, const char *, ...);
|
2017-04-25 15:35:10 +00:00
|
|
|
struct environ *environ_for_session(struct session *, int);
|
2009-08-09 17:48:55 +00:00
|
|
|
|
2007-11-27 19:23:34 +00:00
|
|
|
/* tty.c */
|
2015-10-31 13:12:03 +00:00
|
|
|
void tty_create_log(void);
|
2018-09-26 15:42:29 +00:00
|
|
|
int tty_window_bigger(struct tty *);
|
Support for windows larger than the client.
This adds two new options, window-size and default-size, and a new
command, resize-window.
The force-width and force-height options, and the session_width and
session_height formats have been removed.
The new window-size option tells tmux how to work out the size of
windows: largest means it picks the size of the largest session,
smallest the smallest session (similar to the old behaviour) and
manual means that it does not automatically resize
windows. aggressive-resize modifies the choice of session for largest
and smallest as it did before.
If a window is in a session attached to a client that is too small,
only part of the window is shown. tmux attempts to keep the cursor
visible, so the part of the window displayed is changed as the cursor
moves (with a small delay, to try and avoid excess redrawing when
applications redraw status lines or similar that are not currently
visible).
Drawing windows which are larger than the client is not as efficient
as those which fit, particularly when the cursor moves, so it is
recommended to avoid using this on slow machines or networks (set
window-size to smallest or manual).
The resize-window command can be used to resize a window manually. If
it is used, the window-size option is automatically set to manual for
the window (undo this with "setw -u window-size"). resize-window works
in a similar way to resize-pane (-U -D -L -R -x -y flags) but also has
-a and -A flags. -a sets the window to the size of the smallest client
(what it would be if window-size was smallest) and -A the largest.
For the same behaviour as force-width or force-height, use
resize-width -x or -y.
If the global window-size option is set to manual, the default-size
option is used for new windows. If -x or -y is used with new-session,
that sets the default-size option for the new session.
The maximum size of a window is 10000x10000. But expect applications
to complain and higher memory use if you make a window that big. The
minimum size is the size required for the current layout including
borders.
This change allows some code improvements, most notably that since
windows can now never be cropped, that code can be removed from the
layout code, and since panes can now never be outside the size of the
window, window_pane_visible can be removed.
2018-08-20 14:22:14 +00:00
|
|
|
int tty_window_offset(struct tty *, u_int *, u_int *, u_int *, u_int *);
|
|
|
|
void tty_update_window_offset(struct window *);
|
|
|
|
void tty_update_client_offset(struct client *);
|
2009-09-23 15:00:09 +00:00
|
|
|
void tty_raw(struct tty *, const char *);
|
2015-04-19 21:05:27 +00:00
|
|
|
void tty_attributes(struct tty *, const struct grid_cell *,
|
2019-03-14 09:53:52 +00:00
|
|
|
struct window_pane *);
|
2009-07-23 12:38:01 +00:00
|
|
|
void tty_reset(struct tty *);
|
2016-11-15 15:17:28 +00:00
|
|
|
void tty_region_off(struct tty *);
|
|
|
|
void tty_margin_off(struct tty *);
|
2009-10-15 01:30:00 +00:00
|
|
|
void tty_cursor(struct tty *, u_int, u_int);
|
2009-07-23 12:38:01 +00:00
|
|
|
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);
|
2017-05-31 08:43:44 +00:00
|
|
|
void tty_putcode3(struct tty *, enum tty_code_code, int, int, int);
|
2011-05-22 16:25:02 +00:00
|
|
|
void tty_putcode_ptr1(struct tty *, enum tty_code_code, const void *);
|
2013-01-18 02:16:21 +00:00
|
|
|
void tty_putcode_ptr2(struct tty *, enum tty_code_code, const void *,
|
|
|
|
const void *);
|
2009-07-23 12:38:01 +00:00
|
|
|
void tty_puts(struct tty *, const char *);
|
|
|
|
void tty_putc(struct tty *, u_char);
|
2013-01-18 02:16:21 +00:00
|
|
|
void tty_putn(struct tty *, const void *, size_t, u_int);
|
2015-07-13 15:51:31 +00:00
|
|
|
int tty_init(struct tty *, struct client *, int, char *);
|
2017-05-31 10:29:15 +00:00
|
|
|
void tty_resize(struct tty *);
|
2019-11-28 09:05:34 +00:00
|
|
|
void tty_set_size(struct tty *, u_int, u_int, u_int, u_int);
|
2009-07-23 12:38:01 +00:00
|
|
|
void tty_start_tty(struct tty *);
|
|
|
|
void tty_stop_tty(struct tty *);
|
|
|
|
void tty_set_title(struct tty *, const char *);
|
2011-05-22 16:25:02 +00:00
|
|
|
void tty_update_mode(struct tty *, int, struct screen *);
|
2019-03-14 09:53:52 +00:00
|
|
|
void tty_draw_line(struct tty *, struct window_pane *, struct screen *,
|
Support for windows larger than the client.
This adds two new options, window-size and default-size, and a new
command, resize-window.
The force-width and force-height options, and the session_width and
session_height formats have been removed.
The new window-size option tells tmux how to work out the size of
windows: largest means it picks the size of the largest session,
smallest the smallest session (similar to the old behaviour) and
manual means that it does not automatically resize
windows. aggressive-resize modifies the choice of session for largest
and smallest as it did before.
If a window is in a session attached to a client that is too small,
only part of the window is shown. tmux attempts to keep the cursor
visible, so the part of the window displayed is changed as the cursor
moves (with a small delay, to try and avoid excess redrawing when
applications redraw status lines or similar that are not currently
visible).
Drawing windows which are larger than the client is not as efficient
as those which fit, particularly when the cursor moves, so it is
recommended to avoid using this on slow machines or networks (set
window-size to smallest or manual).
The resize-window command can be used to resize a window manually. If
it is used, the window-size option is automatically set to manual for
the window (undo this with "setw -u window-size"). resize-window works
in a similar way to resize-pane (-U -D -L -R -x -y flags) but also has
-a and -A flags. -a sets the window to the size of the smallest client
(what it would be if window-size was smallest) and -A the largest.
For the same behaviour as force-width or force-height, use
resize-width -x or -y.
If the global window-size option is set to manual, the default-size
option is used for new windows. If -x or -y is used with new-session,
that sets the default-size option for the new session.
The maximum size of a window is 10000x10000. But expect applications
to complain and higher memory use if you make a window that big. The
minimum size is the size required for the current layout including
borders.
This change allows some code improvements, most notably that since
windows can now never be cropped, that code can be removed from the
layout code, and since panes can now never be outside the size of the
window, window_pane_visible can be removed.
2018-08-20 14:22:14 +00:00
|
|
|
u_int, u_int, u_int, u_int, u_int);
|
2014-02-23 00:53:06 +00:00
|
|
|
int tty_open(struct tty *, char **);
|
2009-08-14 21:17:54 +00:00
|
|
|
void tty_close(struct tty *);
|
|
|
|
void tty_free(struct tty *);
|
2016-11-15 14:02:32 +00:00
|
|
|
void tty_set_type(struct tty *, int);
|
2015-05-12 22:40:38 +00:00
|
|
|
void tty_write(void (*)(struct tty *, const struct tty_ctx *),
|
|
|
|
struct tty_ctx *);
|
2009-08-14 21:30:24 +00:00
|
|
|
void tty_cmd_alignmenttest(struct tty *, const struct tty_ctx *);
|
|
|
|
void tty_cmd_cell(struct tty *, const struct tty_ctx *);
|
2017-02-08 16:45:18 +00:00
|
|
|
void tty_cmd_cells(struct tty *, const struct tty_ctx *);
|
2009-08-14 21:30:24 +00:00
|
|
|
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 *);
|
2013-01-15 23:18:55 +00:00
|
|
|
void tty_cmd_clearcharacter(struct tty *, const struct tty_ctx *);
|
2009-08-14 21:30:24 +00:00
|
|
|
void tty_cmd_deleteline(struct tty *, const struct tty_ctx *);
|
2011-04-25 20:33:42 +00:00
|
|
|
void tty_cmd_erasecharacter(struct tty *, const struct tty_ctx *);
|
2009-08-14 21:30:24 +00:00
|
|
|
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 *);
|
2017-02-08 17:31:09 +00:00
|
|
|
void tty_cmd_scrollup(struct tty *, const struct tty_ctx *);
|
2019-08-05 06:42:02 +00:00
|
|
|
void tty_cmd_scrolldown(struct tty *, const struct tty_ctx *);
|
2009-08-14 21:30:24 +00:00
|
|
|
void tty_cmd_reverseindex(struct tty *, const struct tty_ctx *);
|
2011-05-22 16:23:07 +00:00
|
|
|
void tty_cmd_setselection(struct tty *, const struct tty_ctx *);
|
2011-03-19 23:30:37 +00:00
|
|
|
void tty_cmd_rawstring(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;
|
2015-07-28 15:18:10 +00:00
|
|
|
u_int tty_term_ncodes(void);
|
2014-02-23 00:53:06 +00:00
|
|
|
struct tty_term *tty_term_find(char *, int, char **);
|
2009-12-04 22:14:47 +00:00
|
|
|
void tty_term_free(struct tty_term *);
|
2009-01-09 23:57:42 +00:00
|
|
|
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);
|
2015-12-11 16:37:21 +00:00
|
|
|
const char *tty_term_string2(struct tty_term *, enum tty_code_code, int,
|
|
|
|
int);
|
2017-05-31 08:43:44 +00:00
|
|
|
const char *tty_term_string3(struct tty_term *, enum tty_code_code, int,
|
|
|
|
int, int);
|
2015-12-11 16:37:21 +00:00
|
|
|
const char *tty_term_ptr1(struct tty_term *, enum tty_code_code,
|
|
|
|
const void *);
|
2012-11-27 20:22:12 +00:00
|
|
|
const char *tty_term_ptr2(struct tty_term *, enum tty_code_code,
|
|
|
|
const void *, const void *);
|
2009-01-09 23:57:42 +00:00
|
|
|
int tty_term_number(struct tty_term *, enum tty_code_code);
|
|
|
|
int tty_term_flag(struct tty_term *, enum tty_code_code);
|
2015-07-28 15:18:10 +00:00
|
|
|
const char *tty_term_describe(struct tty_term *, enum tty_code_code);
|
2007-11-27 19:23:34 +00:00
|
|
|
|
2010-09-18 15:43:53 +00:00
|
|
|
/* tty-acs.c */
|
2017-05-15 16:44:04 +00:00
|
|
|
int tty_acs_needed(struct tty *);
|
2010-09-18 15:43:53 +00:00
|
|
|
const char *tty_acs_get(struct tty *, u_char);
|
|
|
|
|
2007-11-27 19:23:34 +00:00
|
|
|
/* tty-keys.c */
|
2015-11-12 11:05:34 +00:00
|
|
|
void tty_keys_build(struct tty *);
|
|
|
|
void tty_keys_free(struct tty *);
|
2019-05-03 14:51:30 +00:00
|
|
|
int tty_keys_next(struct tty *);
|
2007-11-27 19:23:34 +00:00
|
|
|
|
2011-01-07 14:45:34 +00:00
|
|
|
/* arguments.c */
|
Rewrite of choose mode, both to simplify and tidy the code and to add
some modern features.
Now the common code is in mode-tree.c, which provides an API used by the
three modes now separated into window-{buffer,client,tree}.c. Buffer
mode shows buffers, client mode clients and tree mode a tree of
sessions, windows and panes.
Each mode has a common set of key bindings plus a few that are specific
to the mode. Other changes are:
- each mode has a preview pane: for buffers this is the buffer content
(very useful), for others it is a preview of the pane;
- items may be sorted in different ways ('O' key);
- multiple items may be tagged and an operation applied to all of them
(for example, to delete multiple buffers at once);
- in tree mode a command may be run on the selected item (session,
window, pane) or on tagged items (key ':');
- displayed items may be filtered in tree mode by using a format (this
is used to implement find-window) (key 'f');
- the custom format (-F) for the display is no longer available;
- shortcut keys change from 0-9, a-z, A-Z which was always a bit weird
with keys used for other uses to 0-9, M-a to M-z.
Now that the code is simpler, other improvements will come later.
Primary key bindings for each mode are documented under the commands in
the man page (choose-buffer, choose-client, choose-tree).
Parts written by Thomas Adam.
2017-05-30 21:44:59 +00:00
|
|
|
void args_set(struct args *, u_char, const char *);
|
2011-01-07 14:45:34 +00:00
|
|
|
struct args *args_parse(const char *, int, char **);
|
|
|
|
void args_free(struct args *);
|
2015-11-27 15:06:43 +00:00
|
|
|
char *args_print(struct args *);
|
2019-05-23 14:03:44 +00:00
|
|
|
char *args_escape(const char *);
|
2011-01-07 14:45:34 +00:00
|
|
|
int args_has(struct args *, u_char);
|
|
|
|
const char *args_get(struct args *, u_char);
|
2019-04-28 20:05:50 +00:00
|
|
|
const char *args_first_value(struct args *, u_char, struct args_value **);
|
|
|
|
const char *args_next_value(struct args_value **);
|
2015-04-27 16:25:57 +00:00
|
|
|
long long args_strtonum(struct args *, u_char, long long, long long,
|
|
|
|
char **);
|
|
|
|
|
|
|
|
/* cmd-find.c */
|
2017-04-21 20:26:34 +00:00
|
|
|
int cmd_find_target(struct cmd_find_state *, struct cmdq_item *,
|
|
|
|
const char *, enum cmd_find_type, int);
|
2018-04-18 14:35:37 +00:00
|
|
|
struct client *cmd_find_best_client(struct session *);
|
2016-10-16 19:04:05 +00:00
|
|
|
struct client *cmd_find_client(struct cmdq_item *, const char *, int);
|
2017-04-21 20:26:34 +00:00
|
|
|
void cmd_find_clear_state(struct cmd_find_state *, int);
|
2016-10-13 10:01:49 +00:00
|
|
|
int cmd_find_empty_state(struct cmd_find_state *);
|
2015-12-15 00:00:01 +00:00
|
|
|
int cmd_find_valid_state(struct cmd_find_state *);
|
|
|
|
void cmd_find_copy_state(struct cmd_find_state *,
|
|
|
|
struct cmd_find_state *);
|
2017-04-21 17:22:20 +00:00
|
|
|
void cmd_find_from_session(struct cmd_find_state *,
|
2017-08-30 10:33:57 +00:00
|
|
|
struct session *, int);
|
2017-04-21 17:22:20 +00:00
|
|
|
void cmd_find_from_winlink(struct cmd_find_state *,
|
2017-08-30 10:33:57 +00:00
|
|
|
struct winlink *, int);
|
2016-10-15 00:09:30 +00:00
|
|
|
int cmd_find_from_session_window(struct cmd_find_state *,
|
2017-08-30 10:33:57 +00:00
|
|
|
struct session *, struct window *, int);
|
|
|
|
int cmd_find_from_window(struct cmd_find_state *, struct window *,
|
|
|
|
int);
|
2017-04-21 17:22:20 +00:00
|
|
|
void cmd_find_from_winlink_pane(struct cmd_find_state *,
|
2017-08-30 10:33:57 +00:00
|
|
|
struct winlink *, struct window_pane *, int);
|
2017-04-21 20:26:34 +00:00
|
|
|
int cmd_find_from_pane(struct cmd_find_state *,
|
2017-08-30 10:33:57 +00:00
|
|
|
struct window_pane *, int);
|
|
|
|
int cmd_find_from_client(struct cmd_find_state *, struct client *,
|
|
|
|
int);
|
2017-04-21 20:26:34 +00:00
|
|
|
int cmd_find_from_mouse(struct cmd_find_state *,
|
2017-08-30 10:33:57 +00:00
|
|
|
struct mouse_event *, int);
|
|
|
|
int cmd_find_from_nothing(struct cmd_find_state *, int);
|
2011-01-07 14:45:34 +00:00
|
|
|
|
2007-10-03 21:31:07 +00:00
|
|
|
/* cmd.c */
|
2019-05-25 06:58:10 +00:00
|
|
|
void printflike(3, 4) cmd_log_argv(int, char **, const char *, ...);
|
2019-05-23 11:13:30 +00:00
|
|
|
void cmd_prepend_argv(int *, char ***, char *);
|
|
|
|
void cmd_append_argv(int *, char ***, char *);
|
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 ***);
|
2014-05-09 09:11:24 +00:00
|
|
|
char **cmd_copy_argv(int, char **);
|
2009-07-28 22:12:16 +00:00
|
|
|
void cmd_free_argv(int, char **);
|
2014-05-13 08:08:32 +00:00
|
|
|
char *cmd_stringify_argv(int, char **);
|
2019-05-23 11:13:30 +00:00
|
|
|
char *cmd_get_alias(const char *);
|
2013-02-23 22:25:58 +00:00
|
|
|
struct cmd *cmd_parse(int, char **, const char *, u_int, char **);
|
2019-05-23 11:13:30 +00:00
|
|
|
void cmd_free(struct cmd *);
|
2015-11-27 15:06:43 +00:00
|
|
|
char *cmd_print(struct cmd *);
|
2015-04-19 21:34:21 +00:00
|
|
|
int cmd_mouse_at(struct window_pane *, struct mouse_event *,
|
|
|
|
u_int *, u_int *, int);
|
|
|
|
struct winlink *cmd_mouse_window(struct mouse_event *, struct session **);
|
|
|
|
struct window_pane *cmd_mouse_pane(struct mouse_event *, struct session **,
|
|
|
|
struct winlink **);
|
2013-02-13 10:19:43 +00:00
|
|
|
char *cmd_template_replace(const char *, const char *, int);
|
2008-06-23 22:24:16 +00:00
|
|
|
extern const struct cmd_entry *cmd_table[];
|
2007-09-26 18:32:17 +00:00
|
|
|
|
2013-02-24 00:43:28 +00:00
|
|
|
/* cmd-attach-session.c */
|
2017-04-22 10:22:39 +00:00
|
|
|
enum cmd_retval cmd_attach_session(struct cmdq_item *, const char *, int, int,
|
2019-06-03 18:28:37 +00:00
|
|
|
int, const char *, int);
|
2013-02-24 00:43:28 +00:00
|
|
|
|
2019-05-23 11:13:30 +00:00
|
|
|
/* cmd-parse.c */
|
|
|
|
void cmd_parse_empty(struct cmd_parse_input *);
|
|
|
|
struct cmd_parse_result *cmd_parse_from_file(FILE *, struct cmd_parse_input *);
|
|
|
|
struct cmd_parse_result *cmd_parse_from_string(const char *,
|
|
|
|
struct cmd_parse_input *);
|
2019-05-25 07:18:20 +00:00
|
|
|
struct cmd_parse_result *cmd_parse_from_arguments(int, char **,
|
|
|
|
struct cmd_parse_input *);
|
2019-05-23 11:13:30 +00:00
|
|
|
|
2009-01-18 14:40:48 +00:00
|
|
|
/* cmd-list.c */
|
2019-05-23 11:13:30 +00:00
|
|
|
struct cmd_list *cmd_list_new(void);
|
|
|
|
void cmd_list_append(struct cmd_list *, struct cmd *);
|
|
|
|
void cmd_list_move(struct cmd_list *, struct cmd_list *);
|
2009-01-18 14:40:48 +00:00
|
|
|
void cmd_list_free(struct cmd_list *);
|
2019-05-23 14:03:44 +00:00
|
|
|
char *cmd_list_print(struct cmd_list *, int);
|
2009-01-18 14:40:48 +00:00
|
|
|
|
2013-02-23 22:25:58 +00:00
|
|
|
/* cmd-queue.c */
|
2016-10-16 19:04:05 +00:00
|
|
|
struct cmdq_item *cmdq_get_command(struct cmd_list *, struct cmd_find_state *,
|
2016-10-16 17:55:14 +00:00
|
|
|
struct mouse_event *, int);
|
2016-10-18 08:46:43 +00:00
|
|
|
#define cmdq_get_callback(cb, data) cmdq_get_callback1(#cb, cb, data)
|
|
|
|
struct cmdq_item *cmdq_get_callback1(const char *, cmdq_cb, void *);
|
2019-05-20 11:46:06 +00:00
|
|
|
struct cmdq_item *cmdq_get_error(const char *);
|
2016-10-16 19:04:05 +00:00
|
|
|
void cmdq_insert_after(struct cmdq_item *, struct cmdq_item *);
|
|
|
|
void cmdq_append(struct client *, struct cmdq_item *);
|
2019-04-26 11:38:51 +00:00
|
|
|
void cmdq_insert_hook(struct session *, struct cmdq_item *,
|
|
|
|
struct cmd_find_state *, const char *, ...);
|
2019-06-18 11:08:42 +00:00
|
|
|
void cmdq_continue(struct cmdq_item *);
|
2016-10-16 19:36:37 +00:00
|
|
|
void printflike(3, 4) cmdq_format(struct cmdq_item *, const char *,
|
|
|
|
const char *, ...);
|
2016-10-16 17:55:14 +00:00
|
|
|
u_int cmdq_next(struct client *);
|
2016-10-16 19:04:05 +00:00
|
|
|
void cmdq_guard(struct cmdq_item *, const char *, int);
|
|
|
|
void printflike(2, 3) cmdq_print(struct cmdq_item *, const char *, ...);
|
|
|
|
void printflike(2, 3) cmdq_error(struct cmdq_item *, const char *, ...);
|
2013-02-23 22:25:58 +00:00
|
|
|
|
2014-09-01 21:58:41 +00:00
|
|
|
/* cmd-wait-for.c */
|
|
|
|
void cmd_wait_for_flush(void);
|
|
|
|
|
2007-09-26 13:43:15 +00:00
|
|
|
/* client.c */
|
2017-07-12 09:21:25 +00:00
|
|
|
int client_main(struct event_base *, int, char **, int);
|
2007-10-03 10:18:32 +00:00
|
|
|
|
2007-10-03 21:31:07 +00:00
|
|
|
/* key-bindings.c */
|
2015-11-24 23:46:15 +00:00
|
|
|
struct key_table *key_bindings_get_table(const char *, int);
|
2018-08-02 11:56:12 +00:00
|
|
|
struct key_table *key_bindings_first_table(void);
|
|
|
|
struct key_table *key_bindings_next_table(struct key_table *);
|
2015-05-08 16:48:12 +00:00
|
|
|
void key_bindings_unref_table(struct key_table *);
|
2018-08-02 11:56:12 +00:00
|
|
|
struct key_binding *key_bindings_get(struct key_table *, key_code);
|
|
|
|
struct key_binding *key_bindings_first(struct key_table *);
|
|
|
|
struct key_binding *key_bindings_next(struct key_table *, struct key_binding *);
|
2015-11-12 11:05:34 +00:00
|
|
|
void key_bindings_add(const char *, key_code, int, struct cmd_list *);
|
|
|
|
void key_bindings_remove(const char *, key_code);
|
2015-04-20 15:34:56 +00:00
|
|
|
void key_bindings_remove_table(const char *);
|
2007-10-03 21:31:07 +00:00
|
|
|
void key_bindings_init(void);
|
2019-05-09 13:12:59 +00:00
|
|
|
struct cmdq_item *key_bindings_dispatch(struct key_binding *,
|
|
|
|
struct cmdq_item *, struct client *, struct mouse_event *,
|
|
|
|
struct cmd_find_state *);
|
2007-07-09 19:04:12 +00:00
|
|
|
|
2007-10-03 11:26:34 +00:00
|
|
|
/* key-string.c */
|
2015-11-12 11:05:34 +00:00
|
|
|
key_code key_string_lookup_string(const char *);
|
|
|
|
const char *key_string_lookup_key(key_code);
|
2007-10-03 11:26:34 +00:00
|
|
|
|
2015-08-29 08:30:54 +00:00
|
|
|
/* alerts.c */
|
|
|
|
void alerts_reset_all(void);
|
|
|
|
void alerts_queue(struct window *, int);
|
2015-12-07 09:47:41 +00:00
|
|
|
void alerts_check_session(struct session *);
|
2015-08-29 08:30:54 +00:00
|
|
|
|
2007-07-09 19:04:12 +00:00
|
|
|
/* server.c */
|
2015-10-27 13:23:24 +00:00
|
|
|
extern struct tmuxproc *server_proc;
|
2007-09-26 10:35:24 +00:00
|
|
|
extern struct clients clients;
|
2015-12-15 00:00:01 +00:00
|
|
|
extern struct cmd_find_state marked_pane;
|
2015-06-04 11:43:51 +00:00
|
|
|
void server_set_marked(struct session *, struct winlink *,
|
|
|
|
struct window_pane *);
|
|
|
|
void server_clear_marked(void);
|
|
|
|
int server_is_marked(struct session *, struct winlink *,
|
|
|
|
struct window_pane *);
|
|
|
|
int server_check_marked(void);
|
2017-07-12 09:24:17 +00:00
|
|
|
int server_start(struct tmuxproc *, struct event_base *, int, char *);
|
2009-11-13 16:51:49 +00:00
|
|
|
void server_update_socket(void);
|
2012-04-12 12:43:40 +00:00
|
|
|
void server_add_accept(int);
|
2007-07-09 19:04:12 +00:00
|
|
|
|
2009-10-23 17:49:47 +00:00
|
|
|
/* server-client.c */
|
2017-05-29 20:37:30 +00:00
|
|
|
u_int server_client_how_many(void);
|
2019-05-07 20:01:41 +00:00
|
|
|
void server_client_set_overlay(struct client *, u_int, overlay_draw_cb,
|
|
|
|
overlay_key_cb, overlay_free_cb, void *);
|
2015-12-12 18:32:24 +00:00
|
|
|
void server_client_set_key_table(struct client *, const char *);
|
|
|
|
const char *server_client_get_key_table(struct client *);
|
2015-06-04 23:27:51 +00:00
|
|
|
int server_client_check_nested(struct client *);
|
2019-05-07 11:24:03 +00:00
|
|
|
int server_client_handle_key(struct client *, struct key_event *);
|
2017-12-19 15:00:39 +00:00
|
|
|
struct client *server_client_create(int);
|
2015-05-08 16:48:12 +00:00
|
|
|
int server_client_open(struct client *, char **);
|
2015-06-05 18:06:30 +00:00
|
|
|
void server_client_unref(struct client *);
|
2009-10-23 17:49:47 +00:00
|
|
|
void server_client_lost(struct client *);
|
2017-04-19 14:00:28 +00:00
|
|
|
void server_client_suspend(struct client *);
|
2015-12-08 01:10:31 +00:00
|
|
|
void server_client_detach(struct client *, enum msgtype);
|
2017-01-13 10:12:12 +00:00
|
|
|
void server_client_exec(struct client *, const char *);
|
2009-10-23 17:49:47 +00:00
|
|
|
void server_client_loop(void);
|
2015-11-14 09:41:06 +00:00
|
|
|
void server_client_push_stdout(struct client *);
|
|
|
|
void server_client_push_stderr(struct client *);
|
2017-02-09 12:09:33 +00:00
|
|
|
void printflike(2, 3) server_client_add_message(struct client *, const char *,
|
|
|
|
...);
|
2017-02-14 18:13:05 +00:00
|
|
|
char *server_client_get_path(struct client *, const char *);
|
2018-05-24 09:42:49 +00:00
|
|
|
const char *server_client_get_cwd(struct client *, struct session *);
|
2009-10-23 17:49:47 +00:00
|
|
|
|
2007-09-26 10:35:24 +00:00
|
|
|
/* server-fn.c */
|
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 *);
|
2009-10-11 23:38:16 +00:00
|
|
|
void server_redraw_session_group(struct session *);
|
2007-11-27 19:23:34 +00:00
|
|
|
void server_status_session(struct session *);
|
2009-10-11 23:38:16 +00:00
|
|
|
void server_status_session_group(struct session *);
|
2007-11-27 19:23:34 +00:00
|
|
|
void server_redraw_window(struct window *);
|
2010-01-05 23:52:37 +00:00
|
|
|
void server_redraw_window_borders(struct window *);
|
2007-11-27 19:23:34 +00:00
|
|
|
void server_status_window(struct window *);
|
2009-01-11 00:48:42 +00:00
|
|
|
void server_lock(void);
|
2009-09-25 17:51:39 +00:00
|
|
|
void server_lock_session(struct session *);
|
|
|
|
void server_lock_client(struct client *);
|
2018-04-10 10:48:44 +00:00
|
|
|
void server_kill_pane(struct window_pane *);
|
2009-07-18 11:07:14 +00:00
|
|
|
void server_kill_window(struct window *);
|
2009-10-11 23:38:16 +00:00
|
|
|
int server_link_window(struct session *,
|
2009-09-20 22:15:32 +00:00
|
|
|
struct winlink *, struct session *, int, int, int, char **);
|
|
|
|
void server_unlink_window(struct session *, struct winlink *);
|
2015-12-16 22:05:35 +00:00
|
|
|
void server_destroy_pane(struct window_pane *, int);
|
2009-09-13 20:37:37 +00:00
|
|
|
void server_destroy_session(struct session *);
|
2012-11-27 20:22:12 +00:00
|
|
|
void server_check_unattached(void);
|
2012-05-22 20:56:35 +00:00
|
|
|
int server_set_stdin_callback(struct client *, void (*)(struct client *,
|
|
|
|
int, void *), void *, char **);
|
2013-02-24 00:25:03 +00:00
|
|
|
void server_unzoom_window(struct window *);
|
2007-09-26 10:35:24 +00:00
|
|
|
|
2007-10-01 14:53:29 +00:00
|
|
|
/* status.c */
|
2015-08-28 12:16:28 +00:00
|
|
|
void status_timer_start(struct client *);
|
|
|
|
void status_timer_start_all(void);
|
2019-03-16 17:14:07 +00:00
|
|
|
void status_update_cache(struct session *);
|
2012-01-29 12:57:01 +00:00
|
|
|
int status_at_line(struct client *);
|
2018-08-20 19:05:34 +00:00
|
|
|
u_int status_line_size(struct client *);
|
2019-03-18 20:53:33 +00:00
|
|
|
struct style_range *status_get_range(struct client *, u_int, u_int);
|
2019-03-16 17:14:07 +00:00
|
|
|
void status_init(struct client *);
|
2019-03-15 14:46:58 +00:00
|
|
|
void status_free(struct client *);
|
2009-02-10 00:18:06 +00:00
|
|
|
int status_redraw(struct client *);
|
2014-10-20 23:57:13 +00:00
|
|
|
void printflike(2, 3) 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 *);
|
2011-07-03 21:52:50 +00:00
|
|
|
void status_prompt_set(struct client *, const char *, const char *,
|
2017-05-17 15:20:23 +00:00
|
|
|
prompt_input_cb, prompt_free_cb, 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 *);
|
2016-10-12 13:03:27 +00:00
|
|
|
int status_prompt_key(struct client *, key_code);
|
2011-07-03 21:52:50 +00:00
|
|
|
void status_prompt_update(struct client *, const char *, const char *);
|
2015-07-20 15:50:04 +00:00
|
|
|
void status_prompt_load_history(void);
|
|
|
|
void status_prompt_save_history(void);
|
2007-10-01 14:53:29 +00:00
|
|
|
|
2007-10-04 19:03:52 +00:00
|
|
|
/* resize.c */
|
2019-11-28 09:45:15 +00:00
|
|
|
void resize_window(struct window *, u_int, u_int, int, int);
|
2019-09-23 15:41:11 +00:00
|
|
|
void default_window_size(struct client *, struct session *, struct window *,
|
2019-11-28 09:45:15 +00:00
|
|
|
u_int *, u_int *, u_int *, u_int *, int);
|
2019-09-19 09:02:30 +00:00
|
|
|
void recalculate_size(struct window *);
|
2007-10-04 19:03:52 +00:00
|
|
|
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 *);
|
2015-12-16 22:05:35 +00:00
|
|
|
void input_reset(struct window_pane *, int);
|
2015-05-08 16:18:04 +00:00
|
|
|
struct evbuffer *input_pending(struct window_pane *);
|
2009-01-11 23:31:46 +00:00
|
|
|
void input_parse(struct window_pane *);
|
2019-05-07 10:25:15 +00:00
|
|
|
void input_parse_buffer(struct window_pane *, u_char *, size_t);
|
2007-07-09 19:04:12 +00:00
|
|
|
|
2007-09-28 22:47:22 +00:00
|
|
|
/* input-key.c */
|
2015-11-12 11:05:34 +00:00
|
|
|
void input_key(struct window_pane *, key_code, struct mouse_event *);
|
2007-09-28 22:47:22 +00:00
|
|
|
|
2009-10-28 23:03:51 +00:00
|
|
|
/* xterm-keys.c */
|
2015-11-12 11:05:34 +00:00
|
|
|
char *xterm_keys_lookup(key_code);
|
|
|
|
int xterm_keys_find(const char *, size_t, size_t *, key_code *);
|
2009-10-28 23:03:51 +00:00
|
|
|
|
2008-09-10 18:59:29 +00:00
|
|
|
/* colour.c */
|
2015-06-05 22:33:39 +00:00
|
|
|
int colour_find_rgb(u_char, u_char, u_char);
|
2016-07-15 00:49:08 +00:00
|
|
|
int colour_join_rgb(u_char, u_char, u_char);
|
|
|
|
void colour_split_rgb(int, u_char *, u_char *, u_char *);
|
2009-09-11 14:13:52 +00:00
|
|
|
const char *colour_tostring(int);
|
2016-07-15 00:49:08 +00:00
|
|
|
int colour_fromstring(const char *s);
|
2019-06-27 15:17:41 +00:00
|
|
|
int colour_256toRGB(int);
|
|
|
|
int colour_256to16(int);
|
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 */
|
2017-03-22 07:16:54 +00:00
|
|
|
const char *attributes_tostring(int);
|
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 attributes_fromstring(const char *);
|
|
|
|
|
2008-09-25 20:08:57 +00:00
|
|
|
/* grid.c */
|
|
|
|
extern const struct grid_cell grid_default_cell;
|
2016-07-15 00:49:08 +00:00
|
|
|
int grid_cells_equal(const struct grid_cell *, const struct grid_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 *);
|
2017-08-30 18:13:47 +00:00
|
|
|
void grid_collect_history(struct grid *);
|
2016-10-13 20:27:27 +00:00
|
|
|
void grid_scroll_history(struct grid *, u_int);
|
2017-05-12 13:00:56 +00:00
|
|
|
void grid_scroll_history_region(struct grid *, u_int, u_int, u_int);
|
2015-09-25 15:53:07 +00:00
|
|
|
void grid_clear_history(struct grid *);
|
2013-02-21 09:35:01 +00:00
|
|
|
const struct grid_line *grid_peek_line(struct grid *, u_int);
|
2015-11-13 08:09:28 +00:00
|
|
|
void grid_get_cell(struct grid *, u_int, u_int, struct grid_cell *);
|
2009-03-28 16:30:05 +00:00
|
|
|
void grid_set_cell(struct grid *, u_int, u_int, const struct grid_cell *);
|
2017-02-08 16:45:18 +00:00
|
|
|
void grid_set_cells(struct grid *, u_int, u_int, const struct grid_cell *,
|
|
|
|
const char *, size_t);
|
2019-03-20 19:19:11 +00:00
|
|
|
struct grid_line *grid_get_line(struct grid *, u_int);
|
|
|
|
void grid_adjust_lines(struct grid *, u_int);
|
2016-10-13 20:27:27 +00:00
|
|
|
void grid_clear(struct grid *, u_int, u_int, u_int, u_int, u_int);
|
|
|
|
void grid_clear_lines(struct grid *, u_int, u_int, u_int);
|
|
|
|
void grid_move_lines(struct grid *, u_int, u_int, u_int, u_int);
|
|
|
|
void grid_move_cells(struct grid *, u_int, u_int, u_int, u_int, u_int);
|
2013-02-19 09:55:02 +00:00
|
|
|
char *grid_string_cells(struct grid *, u_int, u_int, u_int,
|
2013-03-04 11:03:03 +00:00
|
|
|
struct grid_cell **, int, int, int);
|
2015-12-11 16:37:21 +00:00
|
|
|
void grid_duplicate_lines(struct grid *, u_int, struct grid *, u_int,
|
|
|
|
u_int);
|
2019-03-20 19:19:11 +00:00
|
|
|
void grid_reflow(struct grid *, u_int);
|
2019-04-02 08:45:32 +00:00
|
|
|
void grid_wrap_position(struct grid *, u_int, u_int, u_int *, u_int *);
|
|
|
|
void grid_unwrap_position(struct grid *, u_int *, u_int *, u_int, u_int);
|
2019-05-26 17:34:45 +00:00
|
|
|
u_int grid_line_length(struct grid *, u_int);
|
2008-09-25 20:08:57 +00:00
|
|
|
|
|
|
|
/* grid-view.c */
|
2015-11-13 08:09:28 +00:00
|
|
|
void grid_view_get_cell(struct grid *, u_int, u_int, struct grid_cell *);
|
|
|
|
void grid_view_set_cell(struct grid *, u_int, u_int,
|
|
|
|
const struct grid_cell *);
|
2017-02-08 16:45:18 +00:00
|
|
|
void grid_view_set_cells(struct grid *, u_int, u_int,
|
|
|
|
const struct grid_cell *, const char *, size_t);
|
2016-10-13 20:27:27 +00:00
|
|
|
void grid_view_clear_history(struct grid *, u_int);
|
|
|
|
void grid_view_clear(struct grid *, u_int, u_int, u_int, u_int, u_int);
|
2017-05-12 13:00:56 +00:00
|
|
|
void grid_view_scroll_region_up(struct grid *, u_int, u_int, u_int);
|
|
|
|
void grid_view_scroll_region_down(struct grid *, u_int, u_int, u_int);
|
2016-10-13 20:27:27 +00:00
|
|
|
void grid_view_insert_lines(struct grid *, u_int, u_int, u_int);
|
|
|
|
void grid_view_insert_lines_region(struct grid *, u_int, u_int, u_int,
|
2018-08-25 12:55:50 +00:00
|
|
|
u_int);
|
2016-10-13 20:27:27 +00:00
|
|
|
void grid_view_delete_lines(struct grid *, u_int, u_int, u_int);
|
|
|
|
void grid_view_delete_lines_region(struct grid *, u_int, u_int, u_int,
|
2018-08-25 12:55:50 +00:00
|
|
|
u_int);
|
2016-10-13 20:27:27 +00:00
|
|
|
void grid_view_insert_cells(struct grid *, u_int, u_int, u_int, u_int);
|
|
|
|
void grid_view_delete_cells(struct grid *, u_int, 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 */
|
2015-11-12 11:09:11 +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 *);
|
2012-01-21 19:31:59 +00:00
|
|
|
void screen_write_reset(struct screen_write_ctx *);
|
2015-11-12 11:09:11 +00:00
|
|
|
size_t printflike(1, 2) screen_write_strlen(const char *, ...);
|
2014-10-20 23:57:13 +00:00
|
|
|
void printflike(3, 4) screen_write_puts(struct screen_write_ctx *,
|
2016-04-29 13:21:33 +00:00
|
|
|
const struct grid_cell *, const char *, ...);
|
2015-11-12 11:09:11 +00:00
|
|
|
void printflike(4, 5) screen_write_nputs(struct screen_write_ctx *,
|
2016-04-29 13:21:33 +00:00
|
|
|
ssize_t, const struct grid_cell *, const char *, ...);
|
2015-11-12 11:09:11 +00:00
|
|
|
void screen_write_vnputs(struct screen_write_ctx *, ssize_t,
|
2016-04-29 13:21:33 +00:00
|
|
|
const struct grid_cell *, const char *, va_list);
|
|
|
|
void screen_write_putc(struct screen_write_ctx *, const struct grid_cell *,
|
2015-11-12 11:09:11 +00:00
|
|
|
u_char);
|
|
|
|
void screen_write_copy(struct screen_write_ctx *, struct screen *, u_int,
|
2017-01-05 09:07:15 +00:00
|
|
|
u_int, u_int, u_int, bitstr_t *, const struct grid_cell *);
|
2017-11-02 21:29:17 +00:00
|
|
|
void screen_write_fast_copy(struct screen_write_ctx *, struct screen *,
|
|
|
|
u_int, u_int, u_int, u_int);
|
2017-06-30 22:24:08 +00:00
|
|
|
void screen_write_hline(struct screen_write_ctx *, u_int, int, int);
|
|
|
|
void screen_write_vline(struct screen_write_ctx *, u_int, int, int);
|
2019-05-10 14:12:47 +00:00
|
|
|
void screen_write_menu(struct screen_write_ctx *, struct menu *, int);
|
Rewrite of choose mode, both to simplify and tidy the code and to add
some modern features.
Now the common code is in mode-tree.c, which provides an API used by the
three modes now separated into window-{buffer,client,tree}.c. Buffer
mode shows buffers, client mode clients and tree mode a tree of
sessions, windows and panes.
Each mode has a common set of key bindings plus a few that are specific
to the mode. Other changes are:
- each mode has a preview pane: for buffers this is the buffer content
(very useful), for others it is a preview of the pane;
- items may be sorted in different ways ('O' key);
- multiple items may be tagged and an operation applied to all of them
(for example, to delete multiple buffers at once);
- in tree mode a command may be run on the selected item (session,
window, pane) or on tagged items (key ':');
- displayed items may be filtered in tree mode by using a format (this
is used to implement find-window) (key 'f');
- the custom format (-F) for the display is no longer available;
- shortcut keys change from 0-9, a-z, A-Z which was always a bit weird
with keys used for other uses to 0-9, M-a to M-z.
Now that the code is simpler, other improvements will come later.
Primary key bindings for each mode are documented under the commands in
the man page (choose-buffer, choose-client, choose-tree).
Parts written by Thomas Adam.
2017-05-30 21:44:59 +00:00
|
|
|
void screen_write_box(struct screen_write_ctx *, u_int, u_int);
|
|
|
|
void screen_write_preview(struct screen_write_ctx *, struct screen *, u_int,
|
|
|
|
u_int);
|
2009-10-15 01:39:30 +00:00
|
|
|
void screen_write_backspace(struct screen_write_ctx *);
|
2013-02-17 10:43:35 +00:00
|
|
|
void screen_write_mode_set(struct screen_write_ctx *, int);
|
|
|
|
void screen_write_mode_clear(struct screen_write_ctx *, int);
|
2008-09-25 20:08:57 +00:00
|
|
|
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 *);
|
2016-10-13 20:27:27 +00:00
|
|
|
void screen_write_insertcharacter(struct screen_write_ctx *, u_int, u_int);
|
|
|
|
void screen_write_deletecharacter(struct screen_write_ctx *, u_int, u_int);
|
2017-05-12 10:50:11 +00:00
|
|
|
void screen_write_clearcharacter(struct screen_write_ctx *, u_int, u_int);
|
2016-10-13 20:27:27 +00:00
|
|
|
void screen_write_insertline(struct screen_write_ctx *, u_int, u_int);
|
|
|
|
void screen_write_deleteline(struct screen_write_ctx *, u_int, u_int);
|
|
|
|
void screen_write_clearline(struct screen_write_ctx *, u_int);
|
|
|
|
void screen_write_clearendofline(struct screen_write_ctx *, u_int);
|
|
|
|
void screen_write_clearstartofline(struct screen_write_ctx *, u_int);
|
2019-03-12 20:02:47 +00:00
|
|
|
void screen_write_cursormove(struct screen_write_ctx *, int, int, int);
|
2017-05-12 13:00:56 +00:00
|
|
|
void screen_write_reverseindex(struct screen_write_ctx *, u_int);
|
2008-09-25 20:08:57 +00:00
|
|
|
void screen_write_scrollregion(struct screen_write_ctx *, u_int, u_int);
|
2017-05-12 13:00:56 +00:00
|
|
|
void screen_write_linefeed(struct screen_write_ctx *, int, u_int);
|
|
|
|
void screen_write_scrollup(struct screen_write_ctx *, u_int, u_int);
|
2019-08-05 06:42:02 +00:00
|
|
|
void screen_write_scrolldown(struct screen_write_ctx *, u_int, u_int);
|
2008-09-25 20:08:57 +00:00
|
|
|
void screen_write_carriagereturn(struct screen_write_ctx *);
|
2016-10-13 20:27:27 +00:00
|
|
|
void screen_write_clearendofscreen(struct screen_write_ctx *, u_int);
|
2017-02-06 19:26:49 +00:00
|
|
|
void screen_write_clearstartofscreen(struct screen_write_ctx *, u_int);
|
2016-10-13 20:27:27 +00:00
|
|
|
void screen_write_clearscreen(struct screen_write_ctx *, u_int);
|
2011-10-23 15:10:22 +00:00
|
|
|
void screen_write_clearhistory(struct screen_write_ctx *);
|
2017-02-08 16:45:18 +00:00
|
|
|
void screen_write_collect_end(struct screen_write_ctx *);
|
|
|
|
void screen_write_collect_add(struct screen_write_ctx *,
|
|
|
|
const struct grid_cell *);
|
2013-01-18 02:16:21 +00:00
|
|
|
void screen_write_cell(struct screen_write_ctx *, const struct grid_cell *);
|
2011-05-22 16:23:07 +00:00
|
|
|
void screen_write_setselection(struct screen_write_ctx *, u_char *, u_int);
|
2011-03-19 23:30:37 +00:00
|
|
|
void screen_write_rawstring(struct screen_write_ctx *, u_char *, u_int);
|
2007-12-06 09:46:23 +00:00
|
|
|
|
|
|
|
/* screen-redraw.c */
|
2018-08-19 16:45:03 +00:00
|
|
|
void screen_redraw_screen(struct client *);
|
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 *);
|
2011-05-22 16:26:09 +00:00
|
|
|
void screen_set_cursor_style(struct screen *, u_int);
|
2011-05-22 16:25:02 +00:00
|
|
|
void screen_set_cursor_colour(struct screen *, const char *);
|
2008-09-25 20:08:57 +00:00
|
|
|
void screen_set_title(struct screen *, const char *);
|
2019-11-15 11:16:53 +00:00
|
|
|
void screen_set_path(struct screen *, const char *);
|
2017-10-05 13:29:18 +00:00
|
|
|
void screen_push_title(struct screen *);
|
|
|
|
void screen_pop_title(struct screen *);
|
2013-02-05 11:08:59 +00:00
|
|
|
void screen_resize(struct screen *, u_int, u_int, int);
|
2018-07-31 11:49:26 +00:00
|
|
|
void screen_set_selection(struct screen *, u_int, u_int, u_int, u_int,
|
|
|
|
u_int, int, struct grid_cell *);
|
2007-12-06 09:46:23 +00:00
|
|
|
void screen_clear_selection(struct screen *);
|
2016-11-24 13:38:44 +00:00
|
|
|
void screen_hide_selection(struct screen *);
|
2007-12-06 09:46:23 +00:00
|
|
|
int screen_check_selection(struct screen *, u_int, u_int);
|
2016-10-12 13:24:07 +00:00
|
|
|
void screen_select_cell(struct screen *, struct grid_cell *,
|
|
|
|
const struct grid_cell *);
|
2007-07-09 19:04:12 +00:00
|
|
|
|
|
|
|
/* window.c */
|
|
|
|
extern struct windows windows;
|
2011-04-06 22:16:33 +00:00
|
|
|
extern struct window_pane_tree all_window_panes;
|
2019-03-18 14:10:25 +00:00
|
|
|
extern const struct window_mode *all_window_modes[];
|
2015-04-22 15:30:11 +00:00
|
|
|
int window_cmp(struct window *, struct window *);
|
|
|
|
RB_PROTOTYPE(windows, window, entry, window_cmp);
|
2007-10-26 12:29:07 +00:00
|
|
|
int winlink_cmp(struct winlink *, struct winlink *);
|
|
|
|
RB_PROTOTYPE(winlinks, winlink, entry, winlink_cmp);
|
2011-04-06 22:16:33 +00:00
|
|
|
int window_pane_cmp(struct window_pane *, struct window_pane *);
|
|
|
|
RB_PROTOTYPE(window_pane_tree, window_pane, tree_entry, window_pane_cmp);
|
2007-10-26 12:29:07 +00:00
|
|
|
struct winlink *winlink_find_by_index(struct winlinks *, int);
|
2009-12-04 22:14:47 +00:00
|
|
|
struct winlink *winlink_find_by_window(struct winlinks *, struct window *);
|
2012-01-31 12:01:43 +00:00
|
|
|
struct winlink *winlink_find_by_window_id(struct winlinks *, u_int);
|
2009-01-10 14:43:43 +00:00
|
|
|
u_int winlink_count(struct winlinks *);
|
2011-02-15 15:09:52 +00:00
|
|
|
struct winlink *winlink_add(struct winlinks *, int);
|
|
|
|
void winlink_set_window(struct winlink *, struct window *);
|
2007-10-26 12:29:07 +00:00
|
|
|
void winlink_remove(struct winlinks *, struct winlink *);
|
2009-11-28 14:50:37 +00:00
|
|
|
struct winlink *winlink_next(struct winlink *);
|
|
|
|
struct winlink *winlink_previous(struct winlink *);
|
2010-07-17 14:38:13 +00:00
|
|
|
struct winlink *winlink_next_by_number(struct winlink *, struct session *,
|
|
|
|
int);
|
|
|
|
struct winlink *winlink_previous_by_number(struct winlink *, struct session *,
|
|
|
|
int);
|
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 *);
|
2015-04-25 18:09:28 +00:00
|
|
|
struct window *window_find_by_id_str(const char *);
|
2012-01-31 12:01:43 +00:00
|
|
|
struct window *window_find_by_id(u_int);
|
2015-08-29 08:30:54 +00:00
|
|
|
void window_update_activity(struct window *);
|
2019-11-28 09:45:15 +00:00
|
|
|
struct window *window_create(u_int, u_int, u_int, u_int);
|
2019-04-07 12:01:03 +00:00
|
|
|
void window_pane_set_event(struct window_pane *);
|
2011-06-23 19:21:26 +00:00
|
|
|
struct window_pane *window_get_active_at(struct window *, u_int, u_int);
|
|
|
|
struct window_pane *window_find_string(struct window *, const char *);
|
2015-04-19 21:34:21 +00:00
|
|
|
int window_has_pane(struct window *, struct window_pane *);
|
2019-04-07 12:01:03 +00:00
|
|
|
int window_set_active_pane(struct window *, struct window_pane *,
|
|
|
|
int);
|
2015-09-14 11:34:50 +00:00
|
|
|
void window_redraw_active_switch(struct window *,
|
|
|
|
struct window_pane *);
|
2019-04-07 12:01:03 +00:00
|
|
|
struct window_pane *window_add_pane(struct window *, struct window_pane *,
|
|
|
|
u_int, int);
|
2019-11-28 09:45:15 +00:00
|
|
|
void window_resize(struct window *, u_int, u_int, int, int);
|
|
|
|
void window_pane_send_resize(struct window_pane *, int);
|
2013-02-24 00:25:03 +00:00
|
|
|
int window_zoom(struct window_pane *);
|
|
|
|
int window_unzoom(struct window *);
|
2019-08-14 09:58:31 +00:00
|
|
|
int window_push_zoom(struct window *, int);
|
|
|
|
int window_pop_zoom(struct window *);
|
2014-04-17 09:13:13 +00:00
|
|
|
void window_lost_pane(struct window *, struct window_pane *);
|
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);
|
2010-07-17 14:38:13 +00:00
|
|
|
struct window_pane *window_pane_next_by_number(struct window *,
|
2015-05-08 16:48:12 +00:00
|
|
|
struct window_pane *, u_int);
|
2010-07-17 14:38:13 +00:00
|
|
|
struct window_pane *window_pane_previous_by_number(struct window *,
|
2015-05-08 16:48:12 +00:00
|
|
|
struct window_pane *, u_int);
|
2011-11-25 13:30:45 +00:00
|
|
|
int window_pane_index(struct window_pane *, u_int *);
|
2009-01-14 19:29:32 +00:00
|
|
|
u_int window_count_panes(struct window *);
|
|
|
|
void window_destroy_panes(struct window *);
|
2015-04-25 18:09:28 +00:00
|
|
|
struct window_pane *window_pane_find_by_id_str(const char *);
|
2011-04-06 22:16:33 +00:00
|
|
|
struct window_pane *window_pane_find_by_id(u_int);
|
2017-07-03 08:16:03 +00:00
|
|
|
int window_pane_destroy_ready(struct window_pane *);
|
2009-07-22 17:46:53 +00:00
|
|
|
void window_pane_resize(struct window_pane *, u_int, u_int);
|
2012-11-27 20:08:42 +00:00
|
|
|
void window_pane_alternate_on(struct window_pane *,
|
|
|
|
struct grid_cell *, int);
|
|
|
|
void window_pane_alternate_off(struct window_pane *,
|
|
|
|
struct grid_cell *, int);
|
2017-01-07 15:28:13 +00:00
|
|
|
void window_pane_set_palette(struct window_pane *, u_int, int);
|
|
|
|
void window_pane_unset_palette(struct window_pane *, u_int);
|
|
|
|
void window_pane_reset_palette(struct window_pane *);
|
2019-03-14 09:53:52 +00:00
|
|
|
int window_pane_get_palette(struct window_pane *, int);
|
2015-12-11 16:37:21 +00:00
|
|
|
int window_pane_set_mode(struct window_pane *,
|
Rewrite of choose mode, both to simplify and tidy the code and to add
some modern features.
Now the common code is in mode-tree.c, which provides an API used by the
three modes now separated into window-{buffer,client,tree}.c. Buffer
mode shows buffers, client mode clients and tree mode a tree of
sessions, windows and panes.
Each mode has a common set of key bindings plus a few that are specific
to the mode. Other changes are:
- each mode has a preview pane: for buffers this is the buffer content
(very useful), for others it is a preview of the pane;
- items may be sorted in different ways ('O' key);
- multiple items may be tagged and an operation applied to all of them
(for example, to delete multiple buffers at once);
- in tree mode a command may be run on the selected item (session,
window, pane) or on tagged items (key ':');
- displayed items may be filtered in tree mode by using a format (this
is used to implement find-window) (key 'f');
- the custom format (-F) for the display is no longer available;
- shortcut keys change from 0-9, a-z, A-Z which was always a bit weird
with keys used for other uses to 0-9, M-a to M-z.
Now that the code is simpler, other improvements will come later.
Primary key bindings for each mode are documented under the commands in
the man page (choose-buffer, choose-client, choose-tree).
Parts written by Thomas Adam.
2017-05-30 21:44:59 +00:00
|
|
|
const struct window_mode *, struct cmd_find_state *,
|
|
|
|
struct args *);
|
2009-01-11 23:31:46 +00:00
|
|
|
void window_pane_reset_mode(struct window_pane *);
|
2019-03-12 11:16:49 +00:00
|
|
|
void window_pane_reset_mode_all(struct window_pane *);
|
2015-04-19 21:34:21 +00:00
|
|
|
void window_pane_key(struct window_pane *, struct client *,
|
2018-12-18 13:20:44 +00:00
|
|
|
struct session *, struct winlink *, key_code,
|
|
|
|
struct mouse_event *);
|
2018-09-10 06:19:17 +00:00
|
|
|
int window_pane_visible(struct window_pane *);
|
2019-06-13 19:46:00 +00:00
|
|
|
u_int window_pane_search(struct window_pane *, const char *, int,
|
|
|
|
int);
|
2018-09-26 15:42:29 +00:00
|
|
|
const char *window_printable_flags(struct winlink *);
|
2010-03-15 22:03:38 +00:00
|
|
|
struct window_pane *window_pane_find_up(struct window_pane *);
|
|
|
|
struct window_pane *window_pane_find_down(struct window_pane *);
|
|
|
|
struct window_pane *window_pane_find_left(struct window_pane *);
|
|
|
|
struct window_pane *window_pane_find_right(struct window_pane *);
|
2012-02-02 02:00:12 +00:00
|
|
|
void window_set_name(struct window *, const char *);
|
2017-04-28 19:13:55 +00:00
|
|
|
void window_add_ref(struct window *, const char *);
|
|
|
|
void window_remove_ref(struct window *, const char *);
|
2012-07-11 17:06:11 +00:00
|
|
|
void winlink_clear_flags(struct winlink *);
|
2015-06-17 16:50:28 +00:00
|
|
|
int winlink_shuffle_up(struct session *, struct winlink *);
|
2019-05-03 20:44:24 +00:00
|
|
|
int window_pane_start_input(struct window_pane *,
|
|
|
|
struct cmdq_item *, char **);
|
2007-11-21 13:11:41 +00:00
|
|
|
|
2009-04-01 18:21:42 +00:00
|
|
|
/* layout.c */
|
2010-07-02 02:54:52 +00:00
|
|
|
u_int layout_count_cells(struct layout_cell *);
|
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);
|
2016-08-03 09:07:02 +00:00
|
|
|
void layout_destroy_cell(struct window *, struct layout_cell *,
|
2015-12-11 16:37:21 +00:00
|
|
|
struct layout_cell **);
|
2018-06-08 20:54:22 +00:00
|
|
|
void layout_resize_layout(struct window *, struct layout_cell *,
|
|
|
|
enum layout_type, int, int);
|
|
|
|
struct layout_cell *layout_search_by_border(struct layout_cell *, u_int, u_int);
|
2015-12-11 16:37:21 +00:00
|
|
|
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 *);
|
2009-07-20 15:42:05 +00:00
|
|
|
void layout_make_node(struct layout_cell *, enum layout_type);
|
2019-07-15 18:25:07 +00:00
|
|
|
void layout_fix_offsets(struct window *);
|
Support for windows larger than the client.
This adds two new options, window-size and default-size, and a new
command, resize-window.
The force-width and force-height options, and the session_width and
session_height formats have been removed.
The new window-size option tells tmux how to work out the size of
windows: largest means it picks the size of the largest session,
smallest the smallest session (similar to the old behaviour) and
manual means that it does not automatically resize
windows. aggressive-resize modifies the choice of session for largest
and smallest as it did before.
If a window is in a session attached to a client that is too small,
only part of the window is shown. tmux attempts to keep the cursor
visible, so the part of the window displayed is changed as the cursor
moves (with a small delay, to try and avoid excess redrawing when
applications redraw status lines or similar that are not currently
visible).
Drawing windows which are larger than the client is not as efficient
as those which fit, particularly when the cursor moves, so it is
recommended to avoid using this on slow machines or networks (set
window-size to smallest or manual).
The resize-window command can be used to resize a window manually. If
it is used, the window-size option is automatically set to manual for
the window (undo this with "setw -u window-size"). resize-window works
in a similar way to resize-pane (-U -D -L -R -x -y flags) but also has
-a and -A flags. -a sets the window to the size of the smallest client
(what it would be if window-size was smallest) and -A the largest.
For the same behaviour as force-width or force-height, use
resize-width -x or -y.
If the global window-size option is set to manual, the default-size
option is used for new windows. If -x or -y is used with new-session,
that sets the default-size option for the new session.
The maximum size of a window is 10000x10000. But expect applications
to complain and higher memory use if you make a window that big. The
minimum size is the size required for the current layout including
borders.
This change allows some code improvements, most notably that since
windows can now never be cropped, that code can be removed from the
layout code, and since panes can now never be outside the size of the
window, window_pane_visible can be removed.
2018-08-20 14:22:14 +00:00
|
|
|
void layout_fix_panes(struct window *);
|
2016-08-03 09:07:02 +00:00
|
|
|
void layout_resize_adjust(struct window *, struct layout_cell *,
|
|
|
|
enum layout_type, int);
|
2013-02-24 00:25:03 +00:00
|
|
|
void layout_init(struct window *, struct window_pane *);
|
2009-07-20 15:42:05 +00:00
|
|
|
void layout_free(struct window *);
|
|
|
|
void layout_resize(struct window *, u_int, u_int);
|
2013-02-18 17:00:35 +00:00
|
|
|
void layout_resize_pane(struct window_pane *, enum layout_type,
|
2016-10-10 17:28:30 +00:00
|
|
|
int, int);
|
2013-02-18 17:00:35 +00:00
|
|
|
void layout_resize_pane_to(struct window_pane *, enum layout_type,
|
|
|
|
u_int);
|
2010-01-08 16:31:35 +00:00
|
|
|
void layout_assign_pane(struct layout_cell *, struct window_pane *);
|
2015-12-11 16:37:21 +00:00
|
|
|
struct layout_cell *layout_split_pane(struct window_pane *, enum layout_type,
|
2019-04-07 12:01:03 +00:00
|
|
|
int, int);
|
2009-07-20 15:42:05 +00:00
|
|
|
void layout_close_pane(struct window_pane *);
|
2017-11-15 19:59:27 +00:00
|
|
|
int layout_spread_cell(struct window *, struct layout_cell *);
|
|
|
|
void layout_spread_out(struct window_pane *);
|
2009-07-20 15:42:05 +00:00
|
|
|
|
2010-07-02 02:54:52 +00:00
|
|
|
/* layout-custom.c */
|
2015-04-21 22:38:49 +00:00
|
|
|
char *layout_dump(struct layout_cell *);
|
2010-07-02 02:54:52 +00:00
|
|
|
int layout_parse(struct window *, const char *);
|
|
|
|
|
2009-07-20 15:42:05 +00:00
|
|
|
/* layout-set.c */
|
|
|
|
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 *);
|
2009-05-18 21:01:38 +00:00
|
|
|
|
Rewrite of choose mode, both to simplify and tidy the code and to add
some modern features.
Now the common code is in mode-tree.c, which provides an API used by the
three modes now separated into window-{buffer,client,tree}.c. Buffer
mode shows buffers, client mode clients and tree mode a tree of
sessions, windows and panes.
Each mode has a common set of key bindings plus a few that are specific
to the mode. Other changes are:
- each mode has a preview pane: for buffers this is the buffer content
(very useful), for others it is a preview of the pane;
- items may be sorted in different ways ('O' key);
- multiple items may be tagged and an operation applied to all of them
(for example, to delete multiple buffers at once);
- in tree mode a command may be run on the selected item (session,
window, pane) or on tagged items (key ':');
- displayed items may be filtered in tree mode by using a format (this
is used to implement find-window) (key 'f');
- the custom format (-F) for the display is no longer available;
- shortcut keys change from 0-9, a-z, A-Z which was always a bit weird
with keys used for other uses to 0-9, M-a to M-z.
Now that the code is simpler, other improvements will come later.
Primary key bindings for each mode are documented under the commands in
the man page (choose-buffer, choose-client, choose-tree).
Parts written by Thomas Adam.
2017-05-30 21:44:59 +00:00
|
|
|
/* mode-tree.c */
|
2019-08-16 11:49:12 +00:00
|
|
|
typedef void (*mode_tree_build_cb)(void *, struct mode_tree_sort_criteria *,
|
|
|
|
uint64_t *, const char *);
|
2017-11-02 22:00:42 +00:00
|
|
|
typedef void (*mode_tree_draw_cb)(void *, void *, struct screen_write_ctx *,
|
2019-05-12 08:58:09 +00:00
|
|
|
u_int, u_int);
|
2017-11-02 22:00:42 +00:00
|
|
|
typedef int (*mode_tree_search_cb)(void *, void *, const char *);
|
2019-05-12 08:58:09 +00:00
|
|
|
typedef void (*mode_tree_menu_cb)(void *, struct client *, key_code);
|
2017-11-02 22:00:42 +00:00
|
|
|
typedef void (*mode_tree_each_cb)(void *, void *, struct client *, key_code);
|
Rewrite of choose mode, both to simplify and tidy the code and to add
some modern features.
Now the common code is in mode-tree.c, which provides an API used by the
three modes now separated into window-{buffer,client,tree}.c. Buffer
mode shows buffers, client mode clients and tree mode a tree of
sessions, windows and panes.
Each mode has a common set of key bindings plus a few that are specific
to the mode. Other changes are:
- each mode has a preview pane: for buffers this is the buffer content
(very useful), for others it is a preview of the pane;
- items may be sorted in different ways ('O' key);
- multiple items may be tagged and an operation applied to all of them
(for example, to delete multiple buffers at once);
- in tree mode a command may be run on the selected item (session,
window, pane) or on tagged items (key ':');
- displayed items may be filtered in tree mode by using a format (this
is used to implement find-window) (key 'f');
- the custom format (-F) for the display is no longer available;
- shortcut keys change from 0-9, a-z, A-Z which was always a bit weird
with keys used for other uses to 0-9, M-a to M-z.
Now that the code is simpler, other improvements will come later.
Primary key bindings for each mode are documented under the commands in
the man page (choose-buffer, choose-client, choose-tree).
Parts written by Thomas Adam.
2017-05-30 21:44:59 +00:00
|
|
|
u_int mode_tree_count_tagged(struct mode_tree_data *);
|
|
|
|
void *mode_tree_get_current(struct mode_tree_data *);
|
2017-11-03 17:02:33 +00:00
|
|
|
void mode_tree_expand_current(struct mode_tree_data *);
|
|
|
|
void mode_tree_set_current(struct mode_tree_data *, uint64_t);
|
2017-11-02 22:00:42 +00:00
|
|
|
void mode_tree_each_tagged(struct mode_tree_data *, mode_tree_each_cb,
|
|
|
|
struct client *, key_code, int);
|
Rewrite of choose mode, both to simplify and tidy the code and to add
some modern features.
Now the common code is in mode-tree.c, which provides an API used by the
three modes now separated into window-{buffer,client,tree}.c. Buffer
mode shows buffers, client mode clients and tree mode a tree of
sessions, windows and panes.
Each mode has a common set of key bindings plus a few that are specific
to the mode. Other changes are:
- each mode has a preview pane: for buffers this is the buffer content
(very useful), for others it is a preview of the pane;
- items may be sorted in different ways ('O' key);
- multiple items may be tagged and an operation applied to all of them
(for example, to delete multiple buffers at once);
- in tree mode a command may be run on the selected item (session,
window, pane) or on tagged items (key ':');
- displayed items may be filtered in tree mode by using a format (this
is used to implement find-window) (key 'f');
- the custom format (-F) for the display is no longer available;
- shortcut keys change from 0-9, a-z, A-Z which was always a bit weird
with keys used for other uses to 0-9, M-a to M-z.
Now that the code is simpler, other improvements will come later.
Primary key bindings for each mode are documented under the commands in
the man page (choose-buffer, choose-client, choose-tree).
Parts written by Thomas Adam.
2017-05-30 21:44:59 +00:00
|
|
|
void mode_tree_down(struct mode_tree_data *, int);
|
2017-06-09 15:29:15 +00:00
|
|
|
struct mode_tree_data *mode_tree_start(struct window_pane *, struct args *,
|
2017-11-02 22:00:42 +00:00
|
|
|
mode_tree_build_cb, mode_tree_draw_cb, mode_tree_search_cb,
|
2019-05-28 07:18:42 +00:00
|
|
|
mode_tree_menu_cb, void *, const struct menu_item *, const char **,
|
|
|
|
u_int, struct screen **);
|
2018-02-28 08:55:44 +00:00
|
|
|
void mode_tree_zoom(struct mode_tree_data *, struct args *);
|
Rewrite of choose mode, both to simplify and tidy the code and to add
some modern features.
Now the common code is in mode-tree.c, which provides an API used by the
three modes now separated into window-{buffer,client,tree}.c. Buffer
mode shows buffers, client mode clients and tree mode a tree of
sessions, windows and panes.
Each mode has a common set of key bindings plus a few that are specific
to the mode. Other changes are:
- each mode has a preview pane: for buffers this is the buffer content
(very useful), for others it is a preview of the pane;
- items may be sorted in different ways ('O' key);
- multiple items may be tagged and an operation applied to all of them
(for example, to delete multiple buffers at once);
- in tree mode a command may be run on the selected item (session,
window, pane) or on tagged items (key ':');
- displayed items may be filtered in tree mode by using a format (this
is used to implement find-window) (key 'f');
- the custom format (-F) for the display is no longer available;
- shortcut keys change from 0-9, a-z, A-Z which was always a bit weird
with keys used for other uses to 0-9, M-a to M-z.
Now that the code is simpler, other improvements will come later.
Primary key bindings for each mode are documented under the commands in
the man page (choose-buffer, choose-client, choose-tree).
Parts written by Thomas Adam.
2017-05-30 21:44:59 +00:00
|
|
|
void mode_tree_build(struct mode_tree_data *);
|
|
|
|
void mode_tree_free(struct mode_tree_data *);
|
|
|
|
void mode_tree_resize(struct mode_tree_data *, u_int, u_int);
|
|
|
|
struct mode_tree_item *mode_tree_add(struct mode_tree_data *,
|
|
|
|
struct mode_tree_item *, void *, uint64_t, const char *,
|
|
|
|
const char *, int);
|
|
|
|
void mode_tree_remove(struct mode_tree_data *, struct mode_tree_item *);
|
|
|
|
void mode_tree_draw(struct mode_tree_data *);
|
2017-06-07 14:37:30 +00:00
|
|
|
int mode_tree_key(struct mode_tree_data *, struct client *, key_code *,
|
2017-11-03 17:02:33 +00:00
|
|
|
struct mouse_event *, u_int *, u_int *);
|
Rewrite of choose mode, both to simplify and tidy the code and to add
some modern features.
Now the common code is in mode-tree.c, which provides an API used by the
three modes now separated into window-{buffer,client,tree}.c. Buffer
mode shows buffers, client mode clients and tree mode a tree of
sessions, windows and panes.
Each mode has a common set of key bindings plus a few that are specific
to the mode. Other changes are:
- each mode has a preview pane: for buffers this is the buffer content
(very useful), for others it is a preview of the pane;
- items may be sorted in different ways ('O' key);
- multiple items may be tagged and an operation applied to all of them
(for example, to delete multiple buffers at once);
- in tree mode a command may be run on the selected item (session,
window, pane) or on tagged items (key ':');
- displayed items may be filtered in tree mode by using a format (this
is used to implement find-window) (key 'f');
- the custom format (-F) for the display is no longer available;
- shortcut keys change from 0-9, a-z, A-Z which was always a bit weird
with keys used for other uses to 0-9, M-a to M-z.
Now that the code is simpler, other improvements will come later.
Primary key bindings for each mode are documented under the commands in
the man page (choose-buffer, choose-client, choose-tree).
Parts written by Thomas Adam.
2017-05-30 21:44:59 +00:00
|
|
|
void mode_tree_run_command(struct client *, struct cmd_find_state *,
|
|
|
|
const char *, const char *);
|
|
|
|
|
|
|
|
/* window-buffer.c */
|
|
|
|
extern const struct window_mode window_buffer_mode;
|
|
|
|
|
|
|
|
/* window-tree.c */
|
|
|
|
extern const struct window_mode window_tree_mode;
|
|
|
|
|
2009-01-10 19:35:40 +00:00
|
|
|
/* window-clock.c */
|
|
|
|
extern const struct window_mode window_clock_mode;
|
2014-02-26 21:59:33 +00:00
|
|
|
extern const char window_clock_table[14][5][5];
|
2009-01-10 19:35:40 +00:00
|
|
|
|
Rewrite of choose mode, both to simplify and tidy the code and to add
some modern features.
Now the common code is in mode-tree.c, which provides an API used by the
three modes now separated into window-{buffer,client,tree}.c. Buffer
mode shows buffers, client mode clients and tree mode a tree of
sessions, windows and panes.
Each mode has a common set of key bindings plus a few that are specific
to the mode. Other changes are:
- each mode has a preview pane: for buffers this is the buffer content
(very useful), for others it is a preview of the pane;
- items may be sorted in different ways ('O' key);
- multiple items may be tagged and an operation applied to all of them
(for example, to delete multiple buffers at once);
- in tree mode a command may be run on the selected item (session,
window, pane) or on tagged items (key ':');
- displayed items may be filtered in tree mode by using a format (this
is used to implement find-window) (key 'f');
- the custom format (-F) for the display is no longer available;
- shortcut keys change from 0-9, a-z, A-Z which was always a bit weird
with keys used for other uses to 0-9, M-a to M-z.
Now that the code is simpler, other improvements will come later.
Primary key bindings for each mode are documented under the commands in
the man page (choose-buffer, choose-client, choose-tree).
Parts written by Thomas Adam.
2017-05-30 21:44:59 +00:00
|
|
|
/* window-client.c */
|
|
|
|
extern const struct window_mode window_client_mode;
|
|
|
|
|
2007-11-22 18:09:43 +00:00
|
|
|
/* window-copy.c */
|
|
|
|
extern const struct window_mode window_copy_mode;
|
2019-03-08 10:34:20 +00:00
|
|
|
extern const struct window_mode window_view_mode;
|
2014-10-20 23:57:13 +00:00
|
|
|
void printflike(2, 3) window_copy_add(struct window_pane *, const char *, ...);
|
2010-04-05 05:11:44 +00:00
|
|
|
void window_copy_vadd(struct window_pane *, const char *, va_list);
|
2016-05-01 13:39:05 +00:00
|
|
|
void window_copy_pageup(struct window_pane *, int);
|
2015-04-19 21:34:21 +00:00
|
|
|
void window_copy_start_drag(struct client *, struct mouse_event *);
|
2007-11-22 18:09:43 +00:00
|
|
|
|
2009-01-20 19:35:03 +00:00
|
|
|
/* names.c */
|
2015-08-29 00:29:15 +00:00
|
|
|
void check_window_name(struct window *);
|
2013-08-19 21:16:11 +00:00
|
|
|
char *default_window_name(struct window *);
|
|
|
|
char *parse_window_name(const char *);
|
2009-01-20 19:35:03 +00:00
|
|
|
|
2012-06-18 15:23:01 +00:00
|
|
|
/* control.c */
|
2014-09-01 21:50:18 +00:00
|
|
|
void control_callback(struct client *, int, void *);
|
2014-10-20 23:57:13 +00:00
|
|
|
void printflike(2, 3) control_write(struct client *, const char *, ...);
|
2012-09-24 13:39:10 +00:00
|
|
|
void control_write_buffer(struct client *, struct evbuffer *);
|
2012-09-03 09:32:38 +00:00
|
|
|
|
|
|
|
/* control-notify.c */
|
2012-09-25 07:41:22 +00:00
|
|
|
void control_notify_input(struct client *, struct window_pane *,
|
2019-05-07 10:25:15 +00:00
|
|
|
const u_char *, size_t);
|
2017-05-04 07:16:43 +00:00
|
|
|
void control_notify_pane_mode_changed(int);
|
2012-09-03 09:32:38 +00:00
|
|
|
void control_notify_window_layout_changed(struct window *);
|
2017-05-04 07:16:43 +00:00
|
|
|
void control_notify_window_pane_changed(struct window *);
|
2012-09-03 09:32:38 +00:00
|
|
|
void control_notify_window_unlinked(struct session *, struct window *);
|
|
|
|
void control_notify_window_linked(struct session *, struct window *);
|
|
|
|
void control_notify_window_renamed(struct window *);
|
2016-10-16 22:06:40 +00:00
|
|
|
void control_notify_client_session_changed(struct client *);
|
2012-09-03 09:32:38 +00:00
|
|
|
void control_notify_session_renamed(struct session *);
|
|
|
|
void control_notify_session_created(struct session *);
|
2016-10-15 00:12:58 +00:00
|
|
|
void control_notify_session_closed(struct session *);
|
2017-05-04 07:16:43 +00:00
|
|
|
void control_notify_session_window_changed(struct session *);
|
2012-06-18 15:23:01 +00:00
|
|
|
|
2007-07-09 19:04:12 +00:00
|
|
|
/* session.c */
|
|
|
|
extern struct sessions sessions;
|
2010-12-22 15:36:44 +00:00
|
|
|
int session_cmp(struct session *, struct session *);
|
|
|
|
RB_PROTOTYPE(sessions, session, entry, session_cmp);
|
2010-12-22 15:28:51 +00:00
|
|
|
int session_alive(struct session *);
|
2007-07-09 19:04:12 +00:00
|
|
|
struct session *session_find(const char *);
|
2015-04-25 18:09:28 +00:00
|
|
|
struct session *session_find_by_id_str(const char *);
|
2013-03-07 10:07:22 +00:00
|
|
|
struct session *session_find_by_id(u_int);
|
2019-04-07 12:01:03 +00:00
|
|
|
struct session *session_create(const char *, const char *, const char *,
|
|
|
|
struct environ *, struct options *, struct termios *);
|
|
|
|
void session_destroy(struct session *, int, const char *);
|
2017-04-28 19:13:55 +00:00
|
|
|
void session_add_ref(struct session *, const char *);
|
|
|
|
void session_remove_ref(struct session *, const char *);
|
2011-04-06 22:29:26 +00:00
|
|
|
int session_check_name(const char *);
|
2015-08-28 13:01:03 +00:00
|
|
|
void session_update_activity(struct session *, struct timeval *);
|
2010-09-10 13:36:17 +00:00
|
|
|
struct session *session_next_session(struct session *);
|
|
|
|
struct session *session_previous_session(struct session *);
|
2014-05-13 08:08:32 +00:00
|
|
|
struct winlink *session_new(struct session *, const char *, int, char **,
|
2015-10-31 08:13:58 +00:00
|
|
|
const char *, const char *, int, char **);
|
2014-05-13 08:08:32 +00:00
|
|
|
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 *);
|
2015-04-22 15:32:33 +00:00
|
|
|
int session_has(struct session *, struct window *);
|
2015-05-06 08:35:39 +00:00
|
|
|
int session_is_linked(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 *);
|
2013-02-21 16:54:13 +00:00
|
|
|
int session_set_current(struct session *, struct winlink *);
|
2017-02-09 15:04:53 +00:00
|
|
|
struct session_group *session_group_contains(struct session *);
|
|
|
|
struct session_group *session_group_find(const char *);
|
|
|
|
struct session_group *session_group_new(const char *);
|
|
|
|
void session_group_add(struct session_group *, struct session *);
|
2009-10-11 23:38:16 +00:00
|
|
|
void session_group_synchronize_to(struct session *);
|
|
|
|
void session_group_synchronize_from(struct session *);
|
2017-11-02 18:27:35 +00:00
|
|
|
u_int session_group_count(struct session_group *);
|
2012-05-03 17:51:04 +00:00
|
|
|
void session_renumber_windows(struct session *);
|
2007-07-09 19:04:12 +00:00
|
|
|
|
2008-09-09 22:16:37 +00:00
|
|
|
/* utf8.c */
|
2014-04-17 15:37:55 +00:00
|
|
|
void utf8_set(struct utf8_data *, u_char);
|
2015-11-13 08:09:28 +00:00
|
|
|
void utf8_copy(struct utf8_data *, const struct utf8_data *);
|
2015-11-14 11:45:43 +00:00
|
|
|
enum utf8_state utf8_open(struct utf8_data *, u_char);
|
|
|
|
enum utf8_state utf8_append(struct utf8_data *, u_char);
|
2016-03-02 15:36:02 +00:00
|
|
|
enum utf8_state utf8_combine(const struct utf8_data *, wchar_t *);
|
2016-03-01 12:02:08 +00:00
|
|
|
enum utf8_state utf8_split(wchar_t, struct utf8_data *);
|
2017-06-04 09:02:36 +00:00
|
|
|
int utf8_isvalid(const char *);
|
2014-04-17 15:37:55 +00:00
|
|
|
int utf8_strvis(char *, const char *, size_t, int);
|
2017-01-18 10:08:05 +00:00
|
|
|
int utf8_stravis(char **, const char *, int);
|
2015-11-12 11:10:50 +00:00
|
|
|
char *utf8_sanitize(const char *);
|
2016-10-11 07:11:40 +00:00
|
|
|
size_t utf8_strlen(const struct utf8_data *);
|
|
|
|
u_int utf8_strwidth(const struct utf8_data *, ssize_t);
|
2014-04-17 15:37:55 +00:00
|
|
|
struct utf8_data *utf8_fromcstr(const char *);
|
|
|
|
char *utf8_tocstr(struct utf8_data *);
|
|
|
|
u_int utf8_cstrwidth(const char *);
|
2015-11-12 12:43:36 +00:00
|
|
|
char *utf8_padcstr(const char *, u_int);
|
2019-11-25 15:04:15 +00:00
|
|
|
char *utf8_rpadcstr(const char *, u_int);
|
2019-05-26 17:34:45 +00:00
|
|
|
int utf8_cstrhas(const char *, const struct utf8_data *);
|
2008-09-09 22:16:37 +00:00
|
|
|
|
2009-01-20 19:35:03 +00:00
|
|
|
/* osdep-*.c */
|
2010-12-30 20:41:08 +00:00
|
|
|
char *osdep_get_name(int, char *);
|
2012-09-24 13:05:38 +00:00
|
|
|
char *osdep_get_cwd(int);
|
2010-12-30 20:41:08 +00:00
|
|
|
struct event_base *osdep_event_init(void);
|
2009-01-20 19:35:03 +00:00
|
|
|
|
2007-07-09 19:04:12 +00:00
|
|
|
/* log.c */
|
2015-11-24 21:19:46 +00:00
|
|
|
void log_add_level(void);
|
|
|
|
int log_get_level(void);
|
|
|
|
void log_open(const char *);
|
2017-06-04 08:25:57 +00:00
|
|
|
void log_toggle(const char *);
|
2015-11-24 21:19:46 +00:00
|
|
|
void log_close(void);
|
2014-10-20 23:57:13 +00:00
|
|
|
void printflike(1, 2) log_debug(const char *, ...);
|
2015-11-18 13:06:54 +00:00
|
|
|
__dead void printflike(1, 2) fatal(const char *, ...);
|
|
|
|
__dead void printflike(1, 2) fatalx(const char *, ...);
|
2007-07-09 19:04:12 +00:00
|
|
|
|
2019-05-10 18:04:06 +00:00
|
|
|
/* menu.c */
|
2019-05-28 07:18:42 +00:00
|
|
|
struct menu *menu_create(const char *);
|
|
|
|
void menu_add_items(struct menu *, const struct menu_item *,
|
|
|
|
struct cmdq_item *, struct client *,
|
|
|
|
struct cmd_find_state *);
|
|
|
|
void menu_add_item(struct menu *, const struct menu_item *,
|
|
|
|
struct cmdq_item *, struct client *,
|
|
|
|
struct cmd_find_state *);
|
|
|
|
|
2019-05-10 18:04:06 +00:00
|
|
|
void menu_free(struct menu *);
|
|
|
|
int menu_display(struct menu *, int, struct cmdq_item *, u_int,
|
|
|
|
u_int, struct client *, struct cmd_find_state *,
|
|
|
|
menu_choice_cb, void *);
|
|
|
|
|
2014-01-28 23:07:09 +00:00
|
|
|
/* style.c */
|
2019-03-14 09:53:52 +00:00
|
|
|
int style_parse(struct style *,const struct grid_cell *,
|
|
|
|
const char *);
|
|
|
|
const char *style_tostring(struct style *);
|
2014-04-16 21:16:19 +00:00
|
|
|
void style_apply(struct grid_cell *, struct options *,
|
|
|
|
const char *);
|
2019-03-14 09:53:52 +00:00
|
|
|
int style_equal(struct style *, struct style *);
|
|
|
|
void style_set(struct style *, const struct grid_cell *);
|
|
|
|
void style_copy(struct style *, struct style *);
|
|
|
|
int style_is_default(struct style *);
|
2014-01-28 23:07:09 +00:00
|
|
|
|
2019-04-07 12:01:03 +00:00
|
|
|
/* spawn.c */
|
|
|
|
struct winlink *spawn_window(struct spawn_context *, char **);
|
|
|
|
struct window_pane *spawn_pane(struct spawn_context *, char **);
|
|
|
|
|
2019-06-13 19:46:00 +00:00
|
|
|
/* regsub.c */
|
|
|
|
char *regsub(const char *, const char *, const char *, int);
|
|
|
|
|
2009-06-25 16:34:50 +00:00
|
|
|
#endif /* TMUX_H */
|