63 Commits
3.1 ... 3.1b

Author SHA1 Message Date
Nicholas Marriott
6a33a12798 Do not remove the automatic-rename option from the global set, only from
the window (it must stay in the global set or tmux will crash). GitHub
issue 2188.
2020-04-30 15:20:08 +01:00
Nicholas Marriott
d0fa520788 Update CHANGES. 2020-04-27 09:38:04 +01:00
Nicholas Marriott
646bfe403e Do not close stdout file descriptor in control mode since it will be needed for
printing the exit messages.
2020-04-27 09:36:30 +01:00
Nicholas Marriott
650d38962f tmux 3.1. 2020-04-24 09:57:49 +01:00
Nicholas Marriott
ccd7368cc5 Update CHANGES. 2020-04-22 12:59:50 +01:00
Nicholas Marriott
9077b212c3 job_run needs fewer arguments. 2020-04-06 16:14:09 +01:00
Nicholas Marriott
a4e19bcd80 Various fixes for copy mode from master. 2020-04-06 16:09:49 +01:00
nicm
bc36b473f1 Check previous line rather than an extra line, from Anindya Mukherjee. 2020-04-06 16:07:20 +01:00
nicm
10975961de Only search the visible part of the history when marking (highlighting)
search terms, much faster than searching the whole history.
2020-04-06 16:06:14 +01:00
nicm
8d2af4fb54 Add a 10 second timeout to prevent searches taking too much time, from
Anindya Mukherjee.
2020-04-06 16:04:51 +01:00
nicm
ac050b2583 Stop logging the entire command queue every time we add something,
spotted by tb & sthen.
2020-04-06 16:04:10 +01:00
nicm
3234017260 Add an argument to list-commands to show only a single command. 2020-04-06 16:03:39 +01:00
nicm
938ad5a98c Use new window and new pane as well for -P to new-session or new-window. 2020-04-06 16:03:33 +01:00
Nicholas Marriott
9f378a163f 3.1-rc4. 2020-04-01 10:09:49 +01:00
nicm
a5922546ac Do not go down the regex search path (which is expensive because we need
to convert the grid data into a string for regexec and reverse it to
find the grid position) if the search string does not contain any regex
special characters.
2020-04-01 10:09:03 +01:00
nicm
3476eccf48 Use a comparison to check for wrap and avoid an expensive modulus. 2020-04-01 10:08:54 +01:00
nicm
0dbf414578 Performance improvements for regex searching, most notably:
- Use the grid data directly instead of copying it.

- Special case the most typical one byte character cells and use memcmp
  for multiple bytes instead of a handrolled loop.

- Hoist regcomp out of the loop into the calling functions.

GitHub issue 2143.

Also a man page from from jmc@.
2020-04-01 10:08:39 +01:00
nicm
8dedccaa20 Add non-regex search variants to avoid the performance cost for people
with large histories or long lines.
2020-04-01 10:08:09 +01:00
Nicholas Marriott
e5fd85415d Update CHANGES. 2020-04-01 09:29:44 +01:00
Nicholas Marriott
af4b62d10b 3.1-rc3. 2020-03-18 07:55:33 +00:00
nicm
0c06409c9d getopt is not required to set optarg to NULL when there is no argument
and some do not, so set it explicitly each time.
2020-03-18 07:54:37 +00:00
nicm
617136c234 Turn off mouse mode 1003 as well as the rest when exiting. 2020-03-17 16:16:23 +00:00
nicm
f16085a362 Fix C-Space key string. 2020-03-17 16:16:09 +00:00
nicm
4ffbebedce Terminate the output buffer for control mode output - it is now used as
a string. GitHub issue 2114.
2020-03-17 16:14:51 +00:00
nicm
c0d74661b7 Do not attempt to close a NULL pane when failing to create a new one. 2020-03-17 16:14:25 +00:00
Nicholas Marriott
b21a9b1c4e getopt varies too much between platforms, and we already use compat/getopt.c
for Linux so just use it everywhere.
2020-03-17 16:14:12 +00:00
Nicholas Marriott
444e9f3c58 Bump 3.1-rc up to master. 2020-03-11 06:38:43 +00:00
Thomas Adam
59cb022c42 Merge branch 'obsd-master' 2020-03-07 12:01:25 +00:00
nicm
2991f4aad0 Use correct width of right marker so it doesn't draw over status right
when more than one character. Reported by Tyler Culp.
2020-03-07 10:58:32 +00:00
Thomas Adam
9e4d0b2b6d Merge branch 'obsd-master' 2020-03-06 18:01:26 +00:00
nicm
add75a06cd Update latest client for target session on switch-client. 2020-03-06 15:35:03 +00:00
Thomas Adam
ccd24c9cb2 Merge branch 'obsd-master' 2020-03-02 23:09:48 +00:00
nicm
8be179de46 Use current session for cwd of new sessions, not the new session which
doesn't have one yet. GitHub issue 2091.
2020-03-02 08:30:30 +00:00
nicm
f65b9c0d36 Change mouse selection so that after selecting a word, dragging selects
only words and similar for lines. From Anindya Mukherjee.
2020-02-24 09:53:59 +00:00
Nicholas Marriott
549b3599ef Update CHANGES. 2020-02-20 20:42:26 +00:00
Thomas Adam
4694afbed4 Merge branch 'obsd-master' 2020-02-20 10:01:29 +00:00
nicm
229be034fb Add selection_active format for when the selection is present but not
moving with the cursor, from Mark Kelly.
2020-02-20 07:34:57 +00:00
Thomas Adam
ba542e42b7 Merge branch 'obsd-master' 2020-02-19 16:01:27 +00:00
nicm
b20753f2a3 A few fixes to make modifier keys and dragging work - need to remove the
modifiers before checking for the dragging marker key, and apply them
before looking up the end key. Also fix key-to-string with modifiers for
special keys.
2020-02-19 14:25:00 +00:00
Nicholas Marriott
22e9cf04ca Add GitHub. 2020-02-19 06:01:54 +00:00
Nicholas Marriott
37919a6b6a This site is too stupid. 2020-02-17 12:20:53 +00:00
Nicholas Marriott
fdbc1116ef Add to FUNDING.yml. 2020-02-17 12:19:04 +00:00
Thomas Adam
0c6c8c4efc Merge branch 'obsd-master' 2020-02-15 16:01:25 +00:00
nicm
a1f6bd55b6 Add -a to list-keys to also list keys without notes with -N, suggested
by Shehu Dikko.
2020-02-15 15:08:08 +00:00
Thomas Adam
c391d50cbb Merge branch 'obsd-master' 2020-02-14 16:01:26 +00:00
nicm
58b47bf01b Fix top/bottom pane calculation with pane border status enabled,
reported by Stanislav Spassov.
2020-02-14 13:57:58 +00:00
Nicholas Marriott
9900ccd04e Change lock.yml options. 2020-02-14 11:43:12 +00:00
Nicholas Marriott
24cd726dae Add lock.yml file. 2020-02-14 11:40:32 +00:00
Thomas Adam
6c28d0dd06 Merge branch 'obsd-master' 2020-02-13 10:01:27 +00:00
nicm
f48b041cf2 Do not jump to next word end if already on a word end when selecting a
word. Fixes select-word with single character words and vi(1) keys. From
Mark Kelly.
2020-02-13 09:02:07 +00:00
Thomas Adam
a4d8437bc2 Merge branch 'obsd-master' 2020-02-11 08:01:30 +00:00
nicm
dc882adb2e Remove unused variables from Ben Boeckel, and a Pp from jmc. 2020-02-11 07:01:08 +00:00
Nicholas Marriott
470cba356d Merge branch '3.1-rc' 2020-02-07 16:43:41 +00:00
Nicholas Marriott
ae9ca620bd Remove duplicates, from Thomas Sattler. 2020-02-07 16:42:10 +00:00
Nicholas Marriott
400750bb26 Merge branch '3.1-rc' 2020-02-06 12:49:50 +00:00
nicm
096f0d35a6 Make list-keys description clearer in tmux.1 and remove an unused variable. 2020-02-06 12:49:02 +00:00
Thomas Adam
54553903de Merge branch 'obsd-master' 2020-02-05 14:01:26 +00:00
nicm
fb29242168 Make list-keys description clearer in tmux.1 and remove an unused variable. 2020-02-05 13:06:49 +00:00
Nicholas Marriott
c915cfc7e4 Merge branch '3.1-rc' 2020-02-04 07:46:59 +00:00
Nicholas Marriott
3ad4a7a571 Style nit in CHANGES. 2020-02-04 07:46:26 +00:00
Nicholas Marriott
47174f5130 Next is 3.2. 2020-02-04 07:45:29 +00:00
Nicholas Marriott
4822130b3c Merge branch '3.1-rc' 2020-02-04 07:44:49 +00:00
Nicholas Marriott
0bf153daa6 Update CONTRIBUTING.md 2020-02-04 07:43:34 +00:00
29 changed files with 965 additions and 423 deletions

View File

@@ -14,8 +14,8 @@ Before opening an issue, please ensure that:
- Your question or issue is not covered [in the
manual](https://man.openbsd.org/tmux.1) (run `man tmux`).
- Your problem is not mentioned in the [CHANGES
file](https://raw.githubusercontent.com/tmux/tmux/master/CHANGES) file.
- Your problem is not mentioned in [the CHANGES
file](https://raw.githubusercontent.com/tmux/tmux/master/CHANGES).
- Nobody else has opened the same issue recently.

1
.github/FUNDING.yml vendored
View File

@@ -1 +1,2 @@
github: nicm
liberapay: tmux

10
.github/lock.yml vendored Normal file
View File

@@ -0,0 +1,10 @@
daysUntilLock: 180
skipCreatedBefore: false
exemptLabels: []
lockLabel: false
lockComment: >
This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.
setLockReason: false
#only: issues

84
CHANGES
View File

@@ -1,4 +1,37 @@
CHANGES FROM 3.0 to 3.1
CHANGES FROM 3.1a TO 3.1b
* Fix crash when allow-rename is on and an empty name is set.
CHANGES FROM 3.1 TO 3.1a
* Do not close stdout prematurely in control mode since it is needed to print
exit messages. Prevents hanging when detaching with iTerm2.
CHANGES FROM 3.0a TO 3.1
* Only search the visible part of the history when marking (highlighting)
search terms. This is much faster than searching the whole history and solves
problems with large histories. The count of matches shown is now the visible
matches rather than all matches.
* Search using regular expressions in copy mode. search-forward and
search-backward use regular expressions by default; the incremental versions
do not.
* Turn off mouse mode 1003 as well as the rest when exiting.
* Add selection_active format for when the selection is present but not moving
with the cursor.
* Fix dragging with modifier keys, so binding keys such as C-MouseDrag1Pane and
C-MouseDragEnd1Pane now work.
* Add -a to list-keys to also list keys without notes with -N.
* Do not jump to next word end if already on a word end when selecting a word;
fixes select-word with single character words and vi(1) keys.
* Fix top and bottom pane calculation with pane border status enabled.
* Add support for adding a note to a key binding (with bind-key -N) and use
this to add descriptions to the default key bindings. A new -N flag to
@@ -10,7 +43,7 @@ CHANGES FROM 3.0 to 3.1
* Add support for the iTerm2 DSR 1337 sequence to get the terminal version.
* Treat plausible but invalid keys (like C-BSpace) as literal like any other
unrecognised string passed to send-keys
unrecognised string passed to send-keys.
* Detect iTerm2 and enable use of DECSLRM (much faster with horizontally split
windows).
@@ -42,11 +75,6 @@ CHANGES FROM 3.0 to 3.1
* Add push-default to status-left and status-right in status-format[0].
* Add -F flag to send-keys to expand formats in search-backward and forward
copy mode commands and copy_cursor_word and copy_cursor_line formats for word
and line at cursor in copy mode. Use for default # and * binding with vi(1)
keys.
* Do not clear search marks on cursor movement with vi(1) keys.
* Add p format modifier for padding to width and allow multiple substitutions
@@ -54,29 +82,9 @@ CHANGES FROM 3.0 to 3.1
* Add -f for full size to join-pane (like split-window).
* Handle OSC 7 (a VTE extension) and put the result in a new format (pane_path).
* Change new-session -A without a session name (that is, no -s option also) to
attach to the best existing session like attach-session rather than creating
a new one.
* Add an option to set the key sent by backspace for those whose system uses ^H
rather than ^?.
* Add formats for cursor and selection position in copy mode.
* Add support for percentage sizes for resize-pane ("-x 10%"). Also change
split-window and join-pane -l to accept similar percentages and no longer
document -p.
* Make select-pane -P set window-active-style also to match previous behaviour.
* Do not use bright when emulating 256 colours on an 8 colour terminal because
it is also bold on some terminals.
* Add a "latest" window-size option which tries to size windows based on the
most recently used client. This is now the default.
* Make select-pane -P set window-active-style also to match previous behaviour.
* Do not truncate list-keys output.
@@ -89,17 +97,18 @@ CHANGES FROM 3.0 to 3.1
-p flag.
* Add -F flag to send-keys to expand formats in search-backward and forward
copy mode commands, this makes it easier to use the cursor_word and
cursor_line formats.
copy mode commands and copy_cursor_word and copy_cursor_line formats for word
and line at cursor in copy mode. Use for default # and * binding with vi(1)
keys.
* Add formats for word and line at cursor position in copy mode.
* Add formats for cursor and selection position in copy mode
* Add formats for cursor and selection position in copy mode.
* Support all the forms of RGB colour strings in OSC sequences rather than
requiring two digits.
* Limit lazy resize to panes in attached sessions only
* Limit lazy resize to panes in attached sessions only.
* Add an option to set the key sent by backspace for those whose system uses ^H
rather than ^?.
@@ -108,7 +117,8 @@ CHANGES FROM 3.0 to 3.1
attach to the best existing session like attach-session rather than a new
one.
* Change window-size default from smallest to latest.
* Add a "latest" window-size option which tries to size windows based on the
most recently used client. This is now the default.
* Add simple support for OSC 7 (result is available in the pane_path format).
@@ -130,7 +140,7 @@ CHANGES FROM 3.0 to 3.1
* Add reverse sorting in tree, client and buffer modes.
CHANGES FROM 3.0 to 3.0a
CHANGES FROM 3.0 TO 3.0a
* Do not require REG_STARTEND.
@@ -144,7 +154,7 @@ CHANGES FROM 3.0 to 3.0a
* Do not crash when restoring a layout with only one pane.
CHANGES FROM 2.9 to 3.0
CHANGES FROM 2.9 TO 3.0
* Workaround invalid layout strings generated by older tmux versions and add
some additional sanity checks
@@ -269,11 +279,11 @@ CHANGES FROM 2.9 to 3.0
* Add the ability to infer an option type (server, session, window) from its
name to show-options (it was already present in set-option).
CHANGES FROM 2.9 to 2.9a
CHANGES FROM 2.9 TO 2.9a
* Fix bugs in select-pane and the main-horizontal and main-vertical layouts.
CHANGES FROM 2.8 to 2.9
CHANGES FROM 2.8 TO 2.9
* Attempt to preserve horizontal cursor position as well as vertical with
reflow.
@@ -398,7 +408,7 @@ CHANGES FROM 2.8 to 2.9
moves up, down, left or right and -c returns to automatic cursor
tracking. The position is reset when the current window is changed.
CHANGES FROM 2.7 to 2.8
CHANGES FROM 2.7 TO 2.8
* Make display-panes block the client until a pane is chosen or it
times out.

View File

@@ -74,6 +74,7 @@ args_parse(const char *template, int argc, char **argv)
optreset = 1;
optind = 1;
optarg = NULL;
while ((opt = getopt(argc, argv, template)) != -1) {
if (opt < 0)
@@ -83,6 +84,7 @@ args_parse(const char *template, int argc, char **argv)
return (NULL);
}
args_set(args, opt, optarg);
optarg = NULL;
}
argc -= optind;
argv += optind;

View File

@@ -523,7 +523,7 @@ client_write_open(void *data, size_t datalen)
errno = EBADF;
else {
cf->fd = dup(msg->fd);
if (client_flags & CLIENT_CONTROL)
if (~client_flags & CLIENT_CONTROL)
close(msg->fd); /* can only be used once */
}
}
@@ -678,7 +678,8 @@ client_read_open(void *data, size_t datalen)
errno = EBADF;
else {
cf->fd = dup(msg->fd);
close(msg->fd); /* can only be used once */
if (~client_flags & CLIENT_CONTROL)
close(msg->fd); /* can only be used once */
}
}
if (cf->fd == -1) {

View File

@@ -30,8 +30,8 @@ const struct cmd_entry cmd_copy_mode_entry = {
.name = "copy-mode",
.alias = NULL,
.args = { "Met:u", 0, 0 },
.usage = "[-Mu] " CMD_TARGET_PANE_USAGE,
.args = { "eHMt:uq", 0, 0 },
.usage = "[-eHMuq] " CMD_TARGET_PANE_USAGE,
.target = { 't', CMD_FIND_PANE, 0 },
@@ -61,6 +61,11 @@ cmd_copy_mode_exec(struct cmd *self, struct cmdq_item *item)
struct session *s;
struct window_pane *wp = item->target.wp;
if (args_has(args, 'q')) {
window_pane_reset_mode_all(wp);
return (CMD_RETURN_NORMAL);
}
if (args_has(args, 'M')) {
if ((wp = cmd_mouse_pane(&shared->mouse, &s, NULL)) == NULL)
return (CMD_RETURN_NORMAL);

View File

@@ -36,8 +36,8 @@ const struct cmd_entry cmd_list_keys_entry = {
.name = "list-keys",
.alias = "lsk",
.args = { "1NP:T:", 0, 1 },
.usage = "[-1N] [-P prefix-string] [-T key-table] [key]",
.args = { "1aNP:T:", 0, 1 },
.usage = "[-1aN] [-P prefix-string] [-T key-table] [key]",
.flags = CMD_STARTSERVER|CMD_AFTERHOOK,
.exec = cmd_list_keys_exec
@@ -47,8 +47,8 @@ const struct cmd_entry cmd_list_commands_entry = {
.name = "list-commands",
.alias = "lscm",
.args = { "F:", 0, 0 },
.usage = "[-F format]",
.args = { "F:", 0, 1 },
.usage = "[-F format] [command]",
.flags = CMD_STARTSERVER|CMD_AFTERHOOK,
.exec = cmd_list_keys_exec
@@ -89,7 +89,7 @@ cmd_list_keys_print_notes(struct cmdq_item *item, struct args *args,
struct key_table *table;
struct key_binding *bd;
const char *key;
char *tmp;
char *tmp, *note;
int found = 0;
table = key_bindings_get_table(tablename, 0);
@@ -99,19 +99,24 @@ cmd_list_keys_print_notes(struct cmdq_item *item, struct args *args,
while (bd != NULL) {
if ((only != KEYC_UNKNOWN && bd->key != only) ||
KEYC_IS_MOUSE(bd->key) ||
bd->note == NULL) {
(bd->note == NULL && !args_has(args, 'a'))) {
bd = key_bindings_next(table, bd);
continue;
}
found = 1;
key = key_string_lookup_key(bd->key);
if (bd->note == NULL)
note = cmd_list_print(bd->cmdlist, 1);
else
note = xstrdup(bd->note);
tmp = utf8_padcstr(key, keywidth + 1);
if (args_has(args, '1') && c != NULL)
status_message_set(c, "%s%s%s", prefix, tmp, bd->note);
status_message_set(c, "%s%s%s", prefix, tmp, note);
else
cmdq_print(item, "%s%s%s", prefix, tmp, bd->note);
cmdq_print(item, "%s%s%s", prefix, tmp, note);
free(tmp);
free(note);
if (args_has(args, '1'))
break;
@@ -312,9 +317,12 @@ cmd_list_keys_commands(struct cmd *self, struct cmdq_item *item)
const struct cmd_entry **entryp;
const struct cmd_entry *entry;
struct format_tree *ft;
const char *template, *s;
const char *template, *s, *command = NULL;
char *line;
if (args->argc != 0)
command = args->argv[0];
if ((template = args_get(args, 'F')) == NULL) {
template = "#{command_list_name}"
"#{?command_list_alias, (#{command_list_alias}),} "
@@ -326,6 +334,11 @@ cmd_list_keys_commands(struct cmd *self, struct cmdq_item *item)
for (entryp = cmd_table; *entryp != NULL; entryp++) {
entry = *entryp;
if (command != NULL &&
(strcmp(entry->name, command) != 0 &&
(entry->alias == NULL ||
strcmp(entry->alias, command) != 0)))
continue;
format_add(ft, "command_list_name", "%s", entry->name);
if (entry->alias != NULL)

View File

@@ -334,7 +334,7 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item)
if (args_has(args, 'P')) {
if ((template = args_get(args, 'F')) == NULL)
template = NEW_SESSION_TEMPLATE;
cp = format_single(item, template, c, s, NULL, NULL);
cp = format_single(item, template, c, s, s->curw, NULL);
cmdq_print(item, "%s", cp);
free(cp);
}

View File

@@ -108,7 +108,8 @@ cmd_new_window_exec(struct cmd *self, struct cmdq_item *item)
if (args_has(args, 'P')) {
if ((template = args_get(args, 'F')) == NULL)
template = NEW_WINDOW_TEMPLATE;
cp = format_single(item, template, c, s, new_wl, NULL);
cp = format_single(item, template, c, s, new_wl,
new_wl->window->active);
cmdq_print(item, "%s", cp);
free(cp);
}

View File

@@ -59,10 +59,6 @@ cmdq_append(struct client *c, struct cmdq_item *item)
struct cmdq_list *queue = cmdq_get(c);
struct cmdq_item *next;
TAILQ_FOREACH(next, queue, entry) {
log_debug("%s %s: queue %s (%u)", __func__, cmdq_name(c),
next->name, next->group);
}
do {
next = item->next;
item->next = NULL;
@@ -88,10 +84,6 @@ cmdq_insert_after(struct cmdq_item *after, struct cmdq_item *item)
struct cmdq_list *queue = after->queue;
struct cmdq_item *next;
TAILQ_FOREACH(next, queue, entry) {
log_debug("%s %s: queue %s (%u)", __func__, cmdq_name(c),
next->name, next->group);
}
do {
next = item->next;
item->next = after->next;

View File

@@ -153,7 +153,6 @@ cmd_split_window_exec(struct cmd *self, struct cmdq_item *item)
sc.flags |= SPAWN_DETACHED;
if ((new_wp = spawn_pane(&sc, &cause)) == NULL) {
layout_close_pane(new_wp);
cmdq_error(item, "create pane failed: %s", cause);
free(cause);
return (CMD_RETURN_ERROR);

View File

@@ -142,10 +142,11 @@ cmd_switch_client_exec(struct cmd *self, struct cmdq_item *item)
session_update_activity(s, NULL);
gettimeofday(&s->last_attached_time, NULL);
recalculate_sizes();
server_check_unattached();
server_redraw_client(c);
s->curw->flags &= ~WINLINK_ALERTFLAGS;
s->curw->window->latest = c;
recalculate_sizes();
alerts_check_session(s);
return (CMD_RETURN_NORMAL);

View File

@@ -370,7 +370,6 @@ int utf8proc_mbtowc(wchar_t *, const char *, size_t);
int utf8proc_wctomb(char *, wchar_t);
#endif
#ifndef HAVE_GETOPT
/* getopt.c */
extern int BSDopterr;
extern int BSDoptind;
@@ -384,6 +383,5 @@ int BSDgetopt(int, char *const *, const char *);
#define optopt BSDoptopt
#define optreset BSDoptreset
#define optarg BSDoptarg
#endif
#endif /* COMPAT_H */

View File

@@ -1,6 +1,6 @@
# configure.ac
AC_INIT([tmux], 3.1-rc)
AC_INIT([tmux], 3.1b)
AC_PREREQ([2.60])
AC_CONFIG_AUX_DIR(etc)
@@ -125,6 +125,12 @@ AC_FUNC_STRNLEN
# Look for clock_gettime. Must come before event_init.
AC_SEARCH_LIBS(clock_gettime, rt)
# Always use our getopt because 1) glibc's doesn't enforce argument order 2)
# musl does not set optarg to NULL for flags without arguments (although it is
# not required to, but it is helpful) 3) there are probably other weird
# implementations.
AC_LIBOBJ(getopt)
# Look for libevent.
PKG_CHECK_MODULES(
LIBEVENT,
@@ -424,40 +430,6 @@ else
AC_LIBOBJ(unvis)
fi
# Look for getopt. glibc's getopt does not enforce argument order and the ways
# of making it do so are stupid, so just use our own instead.
AC_CHECK_FUNC(getopt, found_getopt=yes, found_getopt=no)
if test "x$found_getopt" != xno; then
AC_MSG_CHECKING(if getopt is suitable)
AC_EGREP_CPP(
yes,
[
#include <features.h>
#ifdef __GLIBC__
yes
#endif
],
[
found_getopt=no
AC_MSG_RESULT(no)
],
AC_MSG_RESULT(yes))
fi
if test "x$found_getopt" != xno; then
AC_CHECK_DECLS(
[optarg, optind, optreset],
,
found_getopt=no,
[
#include <unistd.h>
])
fi
if test "x$found_getopt" != xno; then
AC_DEFINE(HAVE_GETOPT)
else
AC_LIBOBJ(getopt)
fi
# Look for fdforkpty and forkpty in libutil.
AC_SEARCH_LIBS(fdforkpty, util, found_fdforkpty=yes, found_fdforkpty=no)
if test "x$found_fdforkpty" = xyes; then

View File

@@ -54,6 +54,7 @@ control_notify_input(struct client *c, struct window_pane *wp,
else
evbuffer_add_printf(message, "%c", buf[i]);
}
evbuffer_add(message, "", 1);
control_write(c, "%s", EVBUFFER_DATA(message));
evbuffer_free(message);
}

View File

@@ -142,7 +142,8 @@ format_draw_put_list(struct screen_write_ctx *octx,
width -= list_left->cx;
}
if (start + width < list->cx && width > list_right->cx) {
screen_write_cursormove(octx, ocx + offset + width - 1, ocy, 0);
screen_write_cursormove(octx, ocx + offset + width -
list_right->cx, ocy, 0);
screen_write_fast_copy(octx, list_right, 0, 0, list_right->cx,
1);
width -= list_right->cx;

View File

@@ -895,6 +895,44 @@ format_cb_pane_in_mode(struct format_tree *ft, struct format_entry *fe)
xasprintf(&fe->value, "%u", n);
}
/* Callback for pane_at_top. */
static void
format_cb_pane_at_top(struct format_tree *ft, struct format_entry *fe)
{
struct window_pane *wp = ft->wp;
struct window *w = wp->window;
int status, flag;
if (wp == NULL)
return;
status = options_get_number(w->options, "pane-border-status");
if (status == PANE_STATUS_TOP)
flag = (wp->yoff == 1);
else
flag = (wp->yoff == 0);
xasprintf(&fe->value, "%d", flag);
}
/* Callback for pane_at_bottom. */
static void
format_cb_pane_at_bottom(struct format_tree *ft, struct format_entry *fe)
{
struct window_pane *wp = ft->wp;
struct window *w = wp->window;
int status, flag;
if (wp == NULL)
return;
status = options_get_number(w->options, "pane-border-status");
if (status == PANE_STATUS_BOTTOM)
flag = (wp->yoff + wp->sy == w->sy - 1);
else
flag = (wp->yoff + wp->sy == w->sy);
xasprintf(&fe->value, "%d", flag);
}
/* Callback for cursor_character. */
static void
format_cb_cursor_character(struct format_tree *ft, struct format_entry *fe)
@@ -2546,9 +2584,9 @@ format_defaults_pane(struct format_tree *ft, struct window_pane *wp)
format_add(ft, "pane_right", "%u", wp->xoff + wp->sx - 1);
format_add(ft, "pane_bottom", "%u", wp->yoff + wp->sy - 1);
format_add(ft, "pane_at_left", "%d", wp->xoff == 0);
format_add(ft, "pane_at_top", "%d", wp->yoff == 0);
format_add_cb(ft, "pane_at_top", format_cb_pane_at_top);
format_add(ft, "pane_at_right", "%d", wp->xoff + wp->sx == w->sx);
format_add(ft, "pane_at_bottom", "%d", wp->yoff + wp->sy == w->sy);
format_add_cb(ft, "pane_at_bottom", format_cb_pane_at_bottom);
wme = TAILQ_FIRST(&wp->modes);
if (wme != NULL) {

View File

@@ -2304,7 +2304,7 @@ input_exit_rename(struct input_ctx *ictx)
return;
if (ictx->input_len == 0) {
oe = options_get(wp->window->options, "automatic-rename");
oe = options_get_only(wp->window->options, "automatic-rename");
if (oe != NULL)
options_remove(oe);
return;

View File

@@ -242,64 +242,24 @@ key_string_lookup_string(const char *string)
const char *
key_string_lookup_key(key_code key)
{
static char out[32];
char tmp[8];
u_int i;
struct utf8_data ud;
size_t off;
static char out[32];
char tmp[8];
const char *s;
u_int i;
struct utf8_data ud;
size_t off;
*out = '\0';
/* Handle no key. */
if (key == KEYC_NONE)
return ("None");
/* Handle special keys. */
if (key == KEYC_UNKNOWN)
return ("Unknown");
if (key == KEYC_ANY)
return ("Any");
if (key == KEYC_FOCUS_IN)
return ("FocusIn");
if (key == KEYC_FOCUS_OUT)
return ("FocusOut");
if (key == KEYC_PASTE_START)
return ("PasteStart");
if (key == KEYC_PASTE_END)
return ("PasteEnd");
if (key == KEYC_MOUSE)
return ("Mouse");
if (key == KEYC_DRAGGING)
return ("Dragging");
if (key == KEYC_MOUSEMOVE_PANE)
return ("MouseMovePane");
if (key == KEYC_MOUSEMOVE_STATUS)
return ("MouseMoveStatus");
if (key == KEYC_MOUSEMOVE_STATUS_LEFT)
return ("MouseMoveStatusLeft");
if (key == KEYC_MOUSEMOVE_STATUS_RIGHT)
return ("MouseMoveStatusRight");
if (key == KEYC_MOUSEMOVE_BORDER)
return ("MouseMoveBorder");
if (key >= KEYC_USER && key < KEYC_USER + KEYC_NUSER) {
snprintf(out, sizeof out, "User%u", (u_int)(key - KEYC_USER));
return (out);
}
/* Literal keys are themselves. */
if (key & KEYC_LITERAL) {
snprintf(out, sizeof out, "%c", (int)(key & 0xff));
return (out);
}
/*
* Special case: display C-@ as C-Space. Could do this below in
* the (key >= 0 && key <= 32), but this way we let it be found
* in key_string_table, for the unlikely chance that we might
* change its name.
*/
/* Display C-@ as C-Space. */
if ((key & KEYC_MASK_KEY) == 0)
key = ' ' | KEYC_CTRL | (key & KEYC_MASK_MOD);
key = ' ' | KEYC_CTRL | (key & KEYC_MASK_MOD);
/* Fill in the modifiers. */
if (key & KEYC_CTRL)
@@ -310,6 +270,69 @@ key_string_lookup_key(key_code key)
strlcat(out, "S-", sizeof out);
key &= KEYC_MASK_KEY;
/* Handle no key. */
if (key == KEYC_NONE)
return ("None");
/* Handle special keys. */
if (key == KEYC_UNKNOWN) {
s = "Unknown";
goto append;
}
if (key == KEYC_ANY) {
s = "Any";
goto append;
}
if (key == KEYC_FOCUS_IN) {
s = "FocusIn";
goto append;
}
if (key == KEYC_FOCUS_OUT) {
s = "FocusOut";
goto append;
}
if (key == KEYC_PASTE_START) {
s = "PasteStart";
goto append;
}
if (key == KEYC_PASTE_END) {
s = "PasteEnd";
goto append;
}
if (key == KEYC_MOUSE) {
s = "Mouse";
goto append;
}
if (key == KEYC_DRAGGING) {
s = "Dragging";
goto append;
}
if (key == KEYC_MOUSEMOVE_PANE) {
s = "MouseMovePane";
goto append;
}
if (key == KEYC_MOUSEMOVE_STATUS) {
s = "MouseMoveStatus";
goto append;
}
if (key == KEYC_MOUSEMOVE_STATUS_LEFT) {
s = "MouseMoveStatusLeft";
goto append;
}
if (key == KEYC_MOUSEMOVE_STATUS_RIGHT) {
s = "MouseMoveStatusRight";
goto append;
}
if (key == KEYC_MOUSEMOVE_BORDER) {
s = "MouseMoveBorder";
goto append;
}
if (key >= KEYC_USER && key < KEYC_USER + KEYC_NUSER) {
snprintf(tmp, sizeof tmp, "User%u", (u_int)(key - KEYC_USER));
strlcat(out, tmp, sizeof out);
return (out);
}
/* Try the key against the string table. */
for (i = 0; i < nitems(key_string_table); i++) {
if (key == key_string_table[i].key)
@@ -352,4 +375,8 @@ key_string_lookup_key(key_code key)
strlcat(out, tmp, sizeof out);
return (out);
append:
strlcat(out, s, sizeof out);
return (out);
}

View File

@@ -154,8 +154,6 @@ screen_set_cursor_colour(struct screen *s, const char *colour)
int
screen_set_title(struct screen *s, const char *title)
{
char *cp;
if (!utf8_isvalid(title))
return (0);
free(s->title);

View File

@@ -660,8 +660,7 @@ have_event:
break;
}
c->tty.mouse_drag_flag = 0;
return (key);
goto out;
}
/* Convert to a key binding. */
@@ -956,6 +955,7 @@ have_event:
if (key == KEYC_UNKNOWN)
return (KEYC_UNKNOWN);
out:
/* Apply modifiers if any. */
if (b & MOUSE_MASK_META)
key |= KEYC_ESCAPE;
@@ -964,6 +964,8 @@ have_event:
if (b & MOUSE_MASK_SHIFT)
key |= KEYC_SHIFT;
if (log_get_level() != 0)
log_debug("mouse key is %s", key_string_lookup_key (key));
return (key);
}
@@ -1057,7 +1059,7 @@ server_client_key_callback(struct cmdq_item *item, void *data)
* Mouse drag is in progress, so fire the callback (now that
* the mouse event is valid).
*/
if (key == KEYC_DRAGGING) {
if ((key & KEYC_MASK_KEY) == KEYC_DRAGGING) {
c->tty.mouse_drag_update(c, m);
goto out;
}
@@ -1704,7 +1706,6 @@ static void
server_client_dispatch(struct imsg *imsg, void *arg)
{
struct client *c = arg;
const char *data;
ssize_t datalen;
struct session *s;
@@ -1716,7 +1717,6 @@ server_client_dispatch(struct imsg *imsg, void *arg)
return;
}
data = imsg->data;
datalen = imsg->hdr.len - IMSG_HEADER_SIZE;
switch (imsg->hdr.type) {

View File

@@ -228,9 +228,9 @@ spawn_pane(struct spawn_context *sc, char **cause)
* the pane's stored one unless specified.
*/
if (sc->cwd != NULL)
cwd = format_single(item, sc->cwd, c, s, NULL, NULL);
cwd = format_single(item, sc->cwd, c, item->target.s, NULL, NULL);
else if (~sc->flags & SPAWN_RESPAWN)
cwd = xstrdup(server_client_get_cwd(c, s));
cwd = xstrdup(server_client_get_cwd(c, item->target.s));
else
cwd = NULL;

84
tmux.1
View File

@@ -1036,9 +1036,12 @@ If
is specified, list only clients connected to that session.
.It Xo Ic list-commands
.Op Fl F Ar format
.Op Ar command
.Xc
.D1 (alias: Ic lscm )
List the syntax of all commands supported by
List the syntax of
.Ar command
or - if omitted - of all commands supported by
.Nm .
.It Ic list-sessions Op Fl F Ar format
.D1 (alias: Ic ls )
@@ -1503,9 +1506,11 @@ The following commands are supported in copy mode:
.It Li "scroll-up" Ta "C-y" Ta "C-Up"
.It Li "search-again" Ta "n" Ta "n"
.It Li "search-backward <for>" Ta "?" Ta ""
.It Li "search-forward <for>" Ta "/" Ta ""
.It Li "search-backward-incremental <for>" Ta "" Ta "C-r"
.It Li "search-backward-text <for>" Ta "" Ta ""
.It Li "search-forward <for>" Ta "/" Ta ""
.It Li "search-forward-incremental <for>" Ta "" Ta "C-s"
.It Li "search-forward-text <for>" Ta "" Ta ""
.It Li "search-reverse" Ta "N" Ta "N"
.It Li "select-line" Ta "V" Ta ""
.It Li "select-word" Ta "" Ta ""
@@ -1514,6 +1519,26 @@ The following commands are supported in copy mode:
.It Li "top-line" Ta "H" Ta "M-R"
.El
.Pp
The search commands come in several varieties:
.Ql search-forward
and
.Ql search-backward
search for a regular expression;
the
.Ql -text
variants search for a plain text string rather than a regular expression;
.Ql -incremental
perform an incremental search and expect to be used with the
.Fl i
flag to the
.Ic command-prompt
command.
.Ql search-again
repeats the last search and
.Ql search-reverse
does the same but reverses the direction (forward becomes backward and backward
becomes forward).
.Pp
Copy commands may take an optional buffer prefix argument which is used
to generate the buffer name (the default is
.Ql buffer
@@ -1565,7 +1590,7 @@ The synopsis for the
command is:
.Bl -tag -width Ds
.It Xo Ic copy-mode
.Op Fl Meu
.Op Fl eHMqu
.Op Fl t Ar target-pane
.Xc
Enter copy mode.
@@ -1575,6 +1600,11 @@ option scrolls one page up.
.Fl M
begins a mouse drag (only valid if bound to a mouse key binding, see
.Sx MOUSE SUPPORT ) .
.Fl H
hides the position indicator in the top right.
.Fl q
cancels copy mode and any other modes.
.Pp
.Fl e
specifies that scrolling to the bottom of the history (to the visible screen)
should exit copy mode.
@@ -2686,37 +2716,40 @@ To view the default bindings and possible commands, see the
.Ic list-keys
command.
.It Xo Ic list-keys
.Op Fl 1N
.Op Fl 1aN
.Op Fl P Ar prefix-string Fl T Ar key-table
.Op key
.Op Ar key
.Xc
.D1 (alias: Ic lsk )
List all key bindings.
By default this shows all keys or any bindings for
.Ar key
in the syntax of the
List key bindings.
There are two forms: the default lists keys as
.Ic bind-key
command.
commands;
.Fl N
instead show keys and attached notes, i
.Ar key-table
if given or in the
lists only keys with attached notes and shows only the key and note for each
key.
.Pp
With the default form, all key tables are listed by default.
.Fl T
lists only keys in
.Ar key-table .
.Pp
With the
.Fl N
form, only keys in the
.Em root
and
.Em prefix
key tables by default.
.Fl P
specifies a prefix to print before each key.
With
.Fl 1
only the first matching key and note is shown.
.Pp
Without
.Fl N ,
key tables are listed by default;
.Fl T
prints only keys in
.Ar key-table ,
otherwise all key tables are printed.
also lists only keys in
.Ar key-table .
.Fl P
specifies a prefix to print before each key and
.Fl 1
lists only the first matching key.
.Fl a
lists the command for keys that do have a note rather than skipping them.
.It Xo Ic send-keys
.Op Fl FHlMRX
.Op Fl N Ar repeat-count
@@ -4348,6 +4381,7 @@ The following variables are available, where appropriate:
.It Li "scroll_position" Ta "" Ta "Scroll position in copy mode"
.It Li "scroll_region_lower" Ta "" Ta "Bottom of scroll region in pane"
.It Li "scroll_region_upper" Ta "" Ta "Top of scroll region in pane"
.It Li "selection_active" Ta "" Ta "1 if selection started and changes with the cursor in copy mode"
.It Li "selection_end_x" Ta "" Ta "X position of the end of the selection"
.It Li "selection_end_y" Ta "" Ta "Y position of the end of the selection"
.It Li "selection_present" Ta "" Ta "1 if selection started in copy mode"

2
tmux.h
View File

@@ -927,7 +927,9 @@ struct window_pane {
TAILQ_HEAD (, window_mode_entry) modes;
struct event modetimer;
time_t modelast;
char *searchstr;
int searchregex;
TAILQ_ENTRY(window_pane) entry;
RB_ENTRY(window_pane) tree_entry;

12
tty.c
View File

@@ -330,8 +330,10 @@ tty_start_tty(struct tty *tty)
log_debug("%s: using UTF-8 for ACS", c->name);
tty_putcode(tty, TTYC_CNORM);
if (tty_term_has(tty->term, TTYC_KMOUS))
tty_puts(tty, "\033[?1000l\033[?1002l\033[?1006l\033[?1005l");
if (tty_term_has(tty->term, TTYC_KMOUS)) {
tty_puts(tty, "\033[?1000l\033[?1002l\033[?1003l");
tty_puts(tty, "\033[?1006l\033[?1005l");
}
if (tty_term_flag(tty->term, TTYC_XT)) {
if (options_get_number(global_options, "focus-events")) {
@@ -404,8 +406,10 @@ tty_stop_tty(struct tty *tty)
tty_raw(tty, tty_term_string(tty->term, TTYC_CR));
tty_raw(tty, tty_term_string(tty->term, TTYC_CNORM));
if (tty_term_has(tty->term, TTYC_KMOUS))
tty_raw(tty, "\033[?1000l\033[?1002l\033[?1006l\033[?1005l");
if (tty_term_has(tty->term, TTYC_KMOUS)) {
tty_raw(tty, "\033[?1000l\033[?1002l\033[?1003l");
tty_raw(tty, "\033[?1006l\033[?1005l");
}
if (tty_term_flag(tty->term, TTYC_XT)) {
if (tty->flags & TTY_FOCUS) {

View File

@@ -209,7 +209,7 @@ window_buffer_draw(__unused void *modedata, void *itemdata,
struct paste_buffer *pb;
const char *pdata, *start, *end;
char *buf = NULL;
size_t psize, len;
size_t psize;
u_int i, cx = ctx->s->cx, cy = ctx->s->cy;
pb = paste_get_name(item->name);
@@ -222,7 +222,7 @@ window_buffer_draw(__unused void *modedata, void *itemdata,
while (end != pdata + psize && *end != '\n')
end++;
buf = xreallocarray(buf, 4, end - start + 1);
len = utf8_strvis(buf, start, end - start, VIS_OCTAL|VIS_TAB);
utf8_strvis(buf, start, end - start, VIS_OCTAL|VIS_TAB);
if (*buf != '\0') {
screen_write_cursormove(ctx, cx, cy + i, 0);
screen_write_nputs(ctx, sx, &grid_default_cell, "%s",

File diff suppressed because it is too large Load Diff

View File

@@ -548,31 +548,38 @@ window_get_active_at(struct window *w, u_int x, u_int y)
struct window_pane *
window_find_string(struct window *w, const char *s)
{
u_int x, y;
u_int x, y, top = 0, bottom = w->sy - 1;
int status;
x = w->sx / 2;
y = w->sy / 2;
status = options_get_number(w->options, "pane-border-status");
if (status == PANE_STATUS_TOP)
top++;
else if (status == PANE_STATUS_BOTTOM)
bottom--;
if (strcasecmp(s, "top") == 0)
y = 0;
y = top;
else if (strcasecmp(s, "bottom") == 0)
y = w->sy - 1;
y = bottom;
else if (strcasecmp(s, "left") == 0)
x = 0;
else if (strcasecmp(s, "right") == 0)
x = w->sx - 1;
else if (strcasecmp(s, "top-left") == 0) {
x = 0;
y = 0;
y = top;
} else if (strcasecmp(s, "top-right") == 0) {
x = w->sx - 1;
y = 0;
y = top;
} else if (strcasecmp(s, "bottom-left") == 0) {
x = 0;
y = w->sy - 1;
y = bottom;
} else if (strcasecmp(s, "bottom-right") == 0) {
x = w->sx - 1;
y = w->sy - 1;
y = bottom;
} else
return (NULL);