Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Import upstream snapshot from SVN r2630

  • Loading branch information...
commit c2acb99b814de2d79cd36d0960f3f10b83cb101d 1 parent b016948
Romain Francoise orebokech authored
5 Makefile.in
View
@@ -251,6 +251,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
+LIBEVENT_CFLAGS = @LIBEVENT_CFLAGS@
+LIBEVENT_LIBS = @LIBEVENT_LIBS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
@@ -265,6 +267,9 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
PLATFORM = @PLATFORM@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
10 TODO
View
@@ -100,7 +100,6 @@
and a buffer) info() when changing to same window
- way to add dest for break-pane; maybe some easier way to unbreak-pane
- case insensitive searching
-- pane-index option like base-index
- option to move status line to top
- configurable borders and empty space filler for when panes < window?
- mouse-select-pane will screw up with !MODE_MOUSE_STANDARD (it sets the
@@ -113,10 +112,6 @@
in commands without quotes
- a command to choose from a generic list, so you can do eg
choose-list -l Abc,Moo,Blah "run-shell 'sh /my/choose/script %%'"
-- else part for if-shell
-- add general internal format for lists (key=value) and a way to output them in
- different representations, use for list-windows, etc etc. see message id
- 20110221205346.GA1580@yelena.nicm.ath.cx
- numeric prefix in copy mode should be paste buffer for C-w
- named buffers and allow gaps in the stack
- npage/ppage/dc/ic should have aliases for more typical names
@@ -128,14 +123,12 @@
- monitor-activity is broken in several ways with multiple clients
- monitor-activity should be more powerful (eg set a region)
- maybe a way to put pane names instead of window names in status line
-- Support for borderless panes
+- support for borderless panes
- run-shell/if-shell should support status_replace stuff
- wait-pane command or another way to make it synchronous/wait for command to
finish
- last-pane across sessions
- attach should take a pane and select it as well as attaching
-- support for E3, screen-devel
- <1311003510-28900-1-git-send-email-mlichvar@redhat.com>
- should default-path be a window option?
- option to put status line at top (why?)
- panes should have names like windows
@@ -146,6 +139,7 @@
- flags to find-window to select what is searched (title, name, content, history)
- fetch full command line on !Linux, and add option to strip prefixes
such as "sh " "/bin/sh " etc etc
+- synchronize-windows option
* We need a tmux terminfo entry to document the extensions we are using in
upstream terminfo. Must NOT change (only add or remove) anything from
TERM=screen so we can fallback!
160 aclocal.m4
View
@@ -19,6 +19,166 @@ You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically `autoreconf'.])])
+# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
+# serial 1 (pkg-config-0.24)
+#
+# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# PKG_PROG_PKG_CONFIG([MIN-VERSION])
+# ----------------------------------
+AC_DEFUN([PKG_PROG_PKG_CONFIG],
+[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
+m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
+m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
+AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
+AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+ AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
+fi
+if test -n "$PKG_CONFIG"; then
+ _pkg_min_version=m4_default([$1], [0.9.0])
+ AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
+ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ PKG_CONFIG=""
+ fi
+fi[]dnl
+])# PKG_PROG_PKG_CONFIG
+
+# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+#
+# Check to see whether a particular set of modules exists. Similar
+# to PKG_CHECK_MODULES(), but does not set variables or print errors.
+#
+# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+# only at the first occurence in configure.ac, so if the first place
+# it's called might be skipped (such as if it is within an "if", you
+# have to call PKG_CHECK_EXISTS manually
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_EXISTS],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+if test -n "$PKG_CONFIG" && \
+ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
+ m4_default([$2], [:])
+m4_ifvaln([$3], [else
+ $3])dnl
+fi])
+
+# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
+# ---------------------------------------------
+m4_define([_PKG_CONFIG],
+[if test -n "$$1"; then
+ pkg_cv_[]$1="$$1"
+ elif test -n "$PKG_CONFIG"; then
+ PKG_CHECK_EXISTS([$3],
+ [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes ],
+ [pkg_failed=yes])
+ else
+ pkg_failed=untried
+fi[]dnl
+])# _PKG_CONFIG
+
+# _PKG_SHORT_ERRORS_SUPPORTED
+# -----------------------------
+AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
+fi[]dnl
+])# _PKG_SHORT_ERRORS_SUPPORTED
+
+
+# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+# [ACTION-IF-NOT-FOUND])
+#
+#
+# Note that if there is a possibility the first call to
+# PKG_CHECK_MODULES might not happen, you should be sure to include an
+# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
+#
+#
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_MODULES],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
+AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
+
+pkg_failed=no
+AC_MSG_CHECKING([for $1])
+
+_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
+_PKG_CONFIG([$1][_LIBS], [libs], [$2])
+
+m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
+and $1[]_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.])
+
+if test $pkg_failed = yes; then
+ AC_MSG_RESULT([no])
+ _PKG_SHORT_ERRORS_SUPPORTED
+ if test $_pkg_short_errors_supported = yes; then
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
+ else
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
+
+ m4_default([$4], [AC_MSG_ERROR(
+[Package requirements ($2) were not met:
+
+$$1_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+_PKG_TEXT])[]dnl
+ ])
+elif test $pkg_failed = untried; then
+ AC_MSG_RESULT([no])
+ m4_default([$4], [AC_MSG_FAILURE(
+[The pkg-config script could not be found or is too old. Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+_PKG_TEXT
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
+ ])
+else
+ $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
+ $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
+ AC_MSG_RESULT([yes])
+ $3
+fi[]dnl
+])# PKG_CHECK_MODULES
+
# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
36 cmd-if-shell.c
View
@@ -1,4 +1,4 @@
-/* $Id: cmd-if-shell.c 2522 2011-05-29 15:13:36Z tcunha $ */
+/* $Id: cmd-if-shell.c 2627 2011-10-31 13:55:10Z tcunha $ */
/*
* Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
@@ -25,7 +25,7 @@
#include "tmux.h"
/*
- * Executes a tmux command if a shell command returns true.
+ * Executes a tmux command if a shell command returns true or false.
*/
int cmd_if_shell_exec(struct cmd *, struct cmd_ctx *);
@@ -35,8 +35,8 @@ void cmd_if_shell_free(void *);
const struct cmd_entry cmd_if_shell_entry = {
"if-shell", "if",
- "", 2, 2,
- "shell-command command",
+ "", 2, 3,
+ "shell-command command [command]",
0,
NULL,
NULL,
@@ -44,7 +44,8 @@ const struct cmd_entry cmd_if_shell_entry = {
};
struct cmd_if_shell_data {
- char *cmd;
+ char *cmd_if;
+ char *cmd_else;
struct cmd_ctx ctx;
};
@@ -56,7 +57,11 @@ cmd_if_shell_exec(struct cmd *self, struct cmd_ctx *ctx)
const char *shellcmd = args->argv[0];
cdata = xmalloc(sizeof *cdata);
- cdata->cmd = xstrdup(args->argv[1]);
+ cdata->cmd_if = xstrdup(args->argv[1]);
+ if (args->argc == 3)
+ cdata->cmd_else = xstrdup(args->argv[2]);
+ else
+ cdata->cmd_else = NULL;
memcpy(&cdata->ctx, ctx, sizeof cdata->ctx);
if (ctx->cmdclient != NULL)
@@ -75,12 +80,15 @@ cmd_if_shell_callback(struct job *job)
struct cmd_if_shell_data *cdata = job->data;
struct cmd_ctx *ctx = &cdata->ctx;
struct cmd_list *cmdlist;
- char *cause;
-
- if (!WIFEXITED(job->status) || WEXITSTATUS(job->status) != 0)
- return;
-
- if (cmd_string_parse(cdata->cmd, &cmdlist, &cause) != 0) {
+ char *cause, *cmd;
+
+ if (!WIFEXITED(job->status) || WEXITSTATUS(job->status) != 0) {
+ cmd = cdata->cmd_else;
+ if (cmd == NULL)
+ return;
+ } else
+ cmd = cdata->cmd_if;
+ if (cmd_string_parse(cmd, &cmdlist, &cause) != 0) {
if (cause != NULL) {
ctx->error(ctx, "%s", cause);
xfree(cause);
@@ -107,6 +115,8 @@ cmd_if_shell_free(void *data)
if (ctx->curclient != NULL)
ctx->curclient->references--;
- xfree(cdata->cmd);
+ if (cdata->cmd_else != NULL)
+ xfree(cdata->cmd_else);
+ xfree(cdata->cmd_if);
xfree(cdata);
}
46 cmd-list-clients.c
View
@@ -1,4 +1,4 @@
-/* $Id: cmd-list-clients.c 2582 2011-08-21 12:38:55Z tcunha $ */
+/* $Id: cmd-list-clients.c 2617 2011-10-23 15:03:50Z tcunha $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -31,8 +31,8 @@ int cmd_list_clients_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_list_clients_entry = {
"list-clients", "lsc",
- "t:", 0, 0,
- CMD_TARGET_SESSION_USAGE,
+ "F:t:", 0, 0,
+ "[-F format] " CMD_TARGET_SESSION_USAGE,
CMD_READONLY,
NULL,
NULL,
@@ -43,11 +43,13 @@ const struct cmd_entry cmd_list_clients_entry = {
int
cmd_list_clients_exec(struct cmd *self, struct cmd_ctx *ctx)
{
- struct args *args = self->args;
- struct client *c;
- struct session *s;
- u_int i;
- const char *s_utf8;
+ struct args *args = self->args;
+ struct client *c;
+ struct session *s;
+ struct format_tree *ft;
+ const char *template;
+ u_int i;
+ char *line;
if (args_has(args, 't')) {
s = cmd_find_session(ctx, args_get(args, 't'), 0);
@@ -56,22 +58,32 @@ cmd_list_clients_exec(struct cmd *self, struct cmd_ctx *ctx)
} else
s = NULL;
+ template = args_get(args, 'F');
+ if (template == NULL) {
+ template = "#{client_tty}: #{session_name} "
+ "[#{client_width}x#{client_height} #{client_termname}]"
+ "#{?client_utf8, (utf8),}"
+ "#{?client_readonly, (ro),}";
+ }
+
for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
c = ARRAY_ITEM(&clients, i);
if (c == NULL || c->session == NULL)
continue;
- if (c->tty.flags & TTY_UTF8)
- s_utf8 = " (utf8)";
- else
- s_utf8 = "";
-
if (s != NULL && s != c->session)
continue;
- ctx->print(ctx, "%s: %s [%ux%u %s]%s%s", c->tty.path,
- c->session->name, c->tty.sx, c->tty.sy,
- c->tty.termname, s_utf8,
- c->flags & CLIENT_READONLY ? " (ro)" : "");
+
+ ft = format_create();
+ format_add(ft, "line", "%u", i);
+ format_session(ft, c->session);
+ format_client(ft, c);
+
+ line = format_expand(ft, template);
+ ctx->print(ctx, "%s", line);
+ xfree(line);
+
+ format_free(ft);
}
return (0);
21 cmd-load-buffer.c
View
@@ -1,4 +1,4 @@
-/* $Id: cmd-load-buffer.c 2553 2011-07-09 09:42:33Z tcunha $ */
+/* $Id: cmd-load-buffer.c 2620 2011-10-23 15:08:58Z tcunha $ */
/*
* Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
@@ -27,7 +27,7 @@
#include "tmux.h"
/*
- * Loads a session paste buffer from a file.
+ * Loads a paste buffer from a file.
*/
int cmd_load_buffer_exec(struct cmd *, struct cmd_ctx *);
@@ -48,8 +48,9 @@ cmd_load_buffer_exec(struct cmd *self, struct cmd_ctx *ctx)
{
struct args *args = self->args;
struct client *c = ctx->cmdclient;
+ struct session *s;
FILE *f;
- const char *path;
+ const char *path, *newpath, *wd;
char *pdata, *new_pdata, *cause;
size_t psize;
u_int limit;
@@ -93,6 +94,19 @@ cmd_load_buffer_exec(struct cmd *self, struct cmd_ctx *ctx)
return (1);
}
+ if (c != NULL)
+ wd = c->cwd;
+ else if ((s = cmd_current_session(ctx, 0)) != NULL) {
+ wd = options_get_string(&s->options, "default-path");
+ if (*wd == '\0')
+ wd = s->cwd;
+ } else
+ wd = NULL;
+ if (wd != NULL && *wd != '\0') {
+ newpath = get_full_path(wd, path);
+ if (newpath != NULL)
+ path = newpath;
+ }
if ((f = fopen(path, "rb")) == NULL) {
ctx->error(ctx, "%s: %s", path, strerror(errno));
return (-1);
@@ -125,6 +139,7 @@ cmd_load_buffer_exec(struct cmd *self, struct cmd_ctx *ctx)
}
if (paste_replace(&global_buffers, buffer, pdata, psize) != 0) {
ctx->error(ctx, "no buffer %d", buffer);
+ xfree(pdata);
return (-1);
}
18 cmd-new-session.c
View
@@ -1,4 +1,4 @@
-/* $Id: cmd-new-session.c 2553 2011-07-09 09:42:33Z tcunha $ */
+/* $Id: cmd-new-session.c 2619 2011-10-23 15:05:20Z tcunha $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -154,9 +154,17 @@ cmd_new_session_exec(struct cmd *self, struct cmd_ctx *ctx)
}
/* Find new session size. */
- if (detached) {
+ if (ctx->cmdclient != NULL) {
+ sx = ctx->cmdclient->tty.sx;
+ sy = ctx->cmdclient->tty.sy;
+ } else if (ctx->curclient != NULL) {
+ sx = ctx->curclient->tty.sx;
+ sy = ctx->curclient->tty.sy;
+ } else {
sx = 80;
sy = 24;
+ }
+ if (detached) {
if (args_has(args, 'x')) {
sx = strtonum(
args_get(args, 'x'), 1, USHRT_MAX, &errstr);
@@ -173,12 +181,6 @@ cmd_new_session_exec(struct cmd *self, struct cmd_ctx *ctx)
return (-1);
}
}
- } else if (ctx->cmdclient != NULL) {
- sx = ctx->cmdclient->tty.sx;
- sy = ctx->cmdclient->tty.sy;
- } else {
- sx = ctx->curclient->tty.sx;
- sy = ctx->curclient->tty.sy;
}
if (sy > 0 && options_get_number(&global_s_options, "status"))
sy--;
4 cmd-pipe-pane.c
View
@@ -1,4 +1,4 @@
-/* $Id: cmd-pipe-pane.c 2573 2011-08-04 17:04:08Z tcunha $ */
+/* $Id: cmd-pipe-pane.c 2628 2011-10-31 13:55:43Z tcunha $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -38,7 +38,7 @@ void cmd_pipe_pane_error_callback(struct bufferevent *, short, void *);
const struct cmd_entry cmd_pipe_pane_entry = {
"pipe-pane", "pipep",
"ot:", 0, 1,
- CMD_TARGET_PANE_USAGE "[-o] [command]",
+ "[-o] " CMD_TARGET_PANE_USAGE " [command]",
0,
NULL,
NULL,
21 cmd-save-buffer.c
View
@@ -1,4 +1,4 @@
-/* $Id: cmd-save-buffer.c 2553 2011-07-09 09:42:33Z tcunha $ */
+/* $Id: cmd-save-buffer.c 2620 2011-10-23 15:08:58Z tcunha $ */
/*
* Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
@@ -25,7 +25,7 @@
#include "tmux.h"
/*
- * Saves a session paste buffer to a file.
+ * Saves a paste buffer to a file.
*/
int cmd_save_buffer_exec(struct cmd *, struct cmd_ctx *);
@@ -45,8 +45,9 @@ cmd_save_buffer_exec(struct cmd *self, struct cmd_ctx *ctx)
{
struct args *args = self->args;
struct client *c = ctx->cmdclient;
+ struct session *s;
struct paste_buffer *pb;
- const char *path;
+ const char *path, *newpath, *wd;
char *cause;
int buffer;
mode_t mask;
@@ -80,6 +81,20 @@ cmd_save_buffer_exec(struct cmd *self, struct cmd_ctx *ctx)
}
bufferevent_write(c->stdout_event, pb->data, pb->size);
} else {
+ if (c != NULL)
+ wd = c->cwd;
+ else if ((s = cmd_current_session(ctx, 0)) != NULL) {
+ wd = options_get_string(&s->options, "default-path");
+ if (*wd == '\0')
+ wd = s->cwd;
+ } else
+ wd = NULL;
+ if (wd != NULL && *wd != '\0') {
+ newpath = get_full_path(wd, path);
+ if (newpath != NULL)
+ path = newpath;
+ }
+
mask = umask(S_IRWXG | S_IRWXO);
if (args_has(self->args, 'a'))
f = fopen(path, "ab");
4 cmd-set-buffer.c
View
@@ -1,4 +1,4 @@
-/* $Id: cmd-set-buffer.c 2553 2011-07-09 09:42:33Z tcunha $ */
+/* $Id: cmd-set-buffer.c 2616 2011-10-23 15:02:20Z tcunha $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -23,7 +23,7 @@
#include "tmux.h"
/*
- * Add or set a session paste buffer.
+ * Add or set a paste buffer.
*/
int cmd_set_buffer_exec(struct cmd *, struct cmd_ctx *);
4 cmd-show-buffer.c
View
@@ -1,4 +1,4 @@
-/* $Id: cmd-show-buffer.c 2553 2011-07-09 09:42:33Z tcunha $ */
+/* $Id: cmd-show-buffer.c 2616 2011-10-23 15:02:20Z tcunha $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -21,7 +21,7 @@
#include "tmux.h"
/*
- * Show a session paste buffer.
+ * Show a paste buffer.
*/
int cmd_show_buffer_exec(struct cmd *, struct cmd_ctx *);
281 configure
View
@@ -654,6 +654,11 @@ NO_IMSG_TRUE
XOPEN_DEFINES
NO_B64_NTOP_FALSE
NO_B64_NTOP_TRUE
+LIBEVENT_LIBS
+LIBEVENT_CFLAGS
+PKG_CONFIG_LIBDIR
+PKG_CONFIG_PATH
+PKG_CONFIG
IS_GLIBC_FALSE
IS_GLIBC_TRUE
IS_SUNCC_FALSE
@@ -767,7 +772,12 @@ CFLAGS
LDFLAGS
LIBS
CPPFLAGS
-CPP'
+CPP
+PKG_CONFIG
+PKG_CONFIG_PATH
+PKG_CONFIG_LIBDIR
+LIBEVENT_CFLAGS
+LIBEVENT_LIBS'
# Initialize some variables set by options.
@@ -1402,6 +1412,15 @@ Some influential environment variables:
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
CPP C preprocessor
+ PKG_CONFIG path to pkg-config utility
+ PKG_CONFIG_PATH
+ directories to add to pkg-config's search path
+ PKG_CONFIG_LIBDIR
+ path overriding pkg-config's built-in search path
+ LIBEVENT_CFLAGS
+ C compiler flags for LIBEVENT, overriding pkg-config
+ LIBEVENT_LIBS
+ linker flags for LIBEVENT, overriding pkg-config
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
@@ -4535,7 +4554,187 @@ fi
# Look for libevent.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing event_init" >&5
+
+
+
+
+
+
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
+set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_PKG_CONFIG+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $PKG_CONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
+if test -n "$PKG_CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
+$as_echo "$PKG_CONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_PKG_CONFIG"; then
+ ac_pt_PKG_CONFIG=$PKG_CONFIG
+ # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_PKG_CONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
+if test -n "$ac_pt_PKG_CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
+$as_echo "$ac_pt_PKG_CONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_PKG_CONFIG" = x; then
+ PKG_CONFIG=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ PKG_CONFIG=$ac_pt_PKG_CONFIG
+ fi
+else
+ PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
+fi
+
+fi
+if test -n "$PKG_CONFIG"; then
+ _pkg_min_version=0.9.0
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
+$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
+ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ PKG_CONFIG=""
+ fi
+fi
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBEVENT" >&5
+$as_echo_n "checking for LIBEVENT... " >&6; }
+
+if test -n "$LIBEVENT_CFLAGS"; then
+ pkg_cv_LIBEVENT_CFLAGS="$LIBEVENT_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libevent\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "libevent") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_LIBEVENT_CFLAGS=`$PKG_CONFIG --cflags "libevent" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+if test -n "$LIBEVENT_LIBS"; then
+ pkg_cv_LIBEVENT_LIBS="$LIBEVENT_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libevent\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "libevent") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_LIBEVENT_LIBS=`$PKG_CONFIG --libs "libevent" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
+fi
+ if test $_pkg_short_errors_supported = yes; then
+ LIBEVENT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libevent" 2>&1`
+ else
+ LIBEVENT_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libevent" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$LIBEVENT_PKG_ERRORS" >&5
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing event_init" >&5
$as_echo_n "checking for library containing event_init... " >&6; }
if ${ac_cv_search_event_init+:} false; then :
$as_echo_n "(cached) " >&6
@@ -4594,6 +4793,84 @@ else
fi
+
+
+elif test $pkg_failed = untried; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing event_init" >&5
+$as_echo_n "checking for library containing event_init... " >&6; }
+if ${ac_cv_search_event_init+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char event_init ();
+int
+main ()
+{
+return event_init ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' event event-1.4 event2; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_search_event_init=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext
+ if ${ac_cv_search_event_init+:} false; then :
+ break
+fi
+done
+if ${ac_cv_search_event_init+:} false; then :
+
+else
+ ac_cv_search_event_init=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_event_init" >&5
+$as_echo "$ac_cv_search_event_init" >&6; }
+ac_res=$ac_cv_search_event_init
+if test "$ac_res" != no; then :
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+ found_libevent=yes
+else
+ found_libevent=no
+
+fi
+
+
+
+else
+ LIBEVENT_CFLAGS=$pkg_cv_LIBEVENT_CFLAGS
+ LIBEVENT_LIBS=$pkg_cv_LIBEVENT_LIBS
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+ CPPFLAGS="$LIBEVENT_CFLAGS $CPPFLAGS"
+ LIBS="$LIBEVENT_LIBS $LIBS"
+ found_libevent=yes
+
+fi
if test "x$found_libevent" = xno; then
as_fn_error $? "\"libevent not found\"" "$LINENO" 5
fi
31 configure.ac
View
@@ -1,4 +1,4 @@
-# $Id: configure.ac 2600 2011-09-29 08:43:01Z nicm $
+# $Id: configure.ac 2625 2011-10-27 23:00:45Z nicm $
# Miscellaneous autofoo bullshit.
AC_INIT(tmux, 1.6)
@@ -105,11 +105,22 @@ AC_MSG_RESULT($found_glibc)
AC_SEARCH_LIBS(clock_gettime, rt)
# Look for libevent.
-AC_SEARCH_LIBS(
- event_init,
- [event event-1.4 event2],
- found_libevent=yes,
- found_libevent=no
+PKG_CHECK_MODULES(
+ LIBEVENT,
+ libevent,
+ [
+ CPPFLAGS="$LIBEVENT_CFLAGS $CPPFLAGS"
+ LIBS="$LIBEVENT_LIBS $LIBS"
+ found_libevent=yes
+ ],
+ [
+ AC_SEARCH_LIBS(
+ event_init,
+ [event event-1.4 event2],
+ found_libevent=yes,
+ found_libevent=no
+ )
+ ]
)
if test "x$found_libevent" = xno; then
AC_MSG_ERROR("libevent not found")
@@ -336,7 +347,7 @@ AC_CHECK_FUNCS(
# Check for BSD-style integer types.
AC_MSG_CHECKING(for BSD-style unsigned types)
-AC_COMPILE_IFELSE(
+AC_COMPILE_IFELSE([AC_LANG_SOURCE(
[
#include <sys/types.h>
#ifdef HAVE_STDINT_H
@@ -346,7 +357,7 @@ AC_COMPILE_IFELSE(
#endif
int main(void)
{ u_int8_t u8; u_int16_t u16; u_int32_t u32; u_int64_t u64; }
- ],
+ ])],
[AC_DEFINE(HAVE_BSD_TYPES) AC_MSG_RESULT(yes)],
AC_MSG_RESULT(no)
)
@@ -370,7 +381,7 @@ fi
# Look for __progname.
AC_MSG_CHECKING(for __progname)
-AC_LINK_IFELSE(
+AC_LINK_IFELSE([AC_LANG_SOURCE(
[
#include <stdio.h>
#include <stdlib.h>
@@ -380,7 +391,7 @@ AC_LINK_IFELSE(
printf("%s\n", cp);
exit(0);
}
- ],
+ ])],
[AC_DEFINE(HAVE___PROGNAME) AC_MSG_RESULT(yes)],
AC_MSG_RESULT(no)
)
2  examples/tmux.vim
View
@@ -77,7 +77,7 @@ syn keyword tmuxOptsSetw window-status-alert-bg window-status-alert-fg
syn keyword tmuxTodo FIXME NOTE TODO XXX contained
-syn match tmuxKey /\(C-\|M-\|\^\)\p/ display
+syn match tmuxKey /\(C-\|M-\|\^\)\+\S\+/ display
syn match tmuxNumber /\d\+/ display
syn match tmuxOptions /\s-\a\+/ display
syn match tmuxVariable /\w\+=/ display
36 format.c
View
@@ -295,6 +295,42 @@ format_session(struct format_tree *ft, struct session *s)
format_add(ft, "session_attached", "%d", 1);
}
+/* Set default format keys for a client. */
+void
+format_client(struct format_tree *ft, struct client *c)
+{
+ char *tim;
+ time_t t;
+
+ format_add(ft, "client_cwd", "%s", c->cwd);
+ format_add(ft, "client_height", "%u", c->tty.sx);
+ format_add(ft, "client_width", "%u", c->tty.sy);
+ format_add(ft, "client_tty", "%s", c->tty.path);
+ format_add(ft, "client_termname", "%s", c->tty.termname);
+
+ t = c->creation_time.tv_sec;
+ format_add(ft, "client_created", "%ld", (long) t);
+ tim = ctime(&t);
+ *strchr(tim, '\n') = '\0';
+ format_add(ft, "client_created_string", "%s", tim);
+
+ t = c->activity_time.tv_sec;
+ format_add(ft, "client_activity", "%ld", (long) t);
+ tim = ctime(&t);
+ *strchr(tim, '\n') = '\0';
+ format_add(ft, "client_activity_string", "%s", tim);
+
+ if (c->tty.flags & TTY_UTF8)
+ format_add(ft, "client_utf8", "%d", 1);
+ else
+ format_add(ft, "client_utf8", "%d", 0);
+
+ if (c->flags & CLIENT_READONLY)
+ format_add(ft, "client_readonly", "%d", 1);
+ else
+ format_add(ft, "client_readonly", "%d", 0);
+}
+
/* Set default format keys for a winlink. */
void
format_winlink(struct format_tree *ft, struct session *s, struct winlink *wl)
13 input.c
View
@@ -1,4 +1,4 @@
-/* $Id: input.c 2553 2011-07-09 09:42:33Z tcunha $ */
+/* $Id: input.c 2621 2011-10-23 15:10:22Z tcunha $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -1126,6 +1126,17 @@ input_csi_dispatch(struct input_ctx *ictx)
case 2:
screen_write_clearscreen(sctx);
break;
+ case 3:
+ switch (input_get(ictx, 1, 0, 0)) {
+ case 0:
+ /*
+ * Linux console extension to clear history
+ * (for example before locking the screen).
+ */
+ screen_write_clearhistory(sctx);
+ break;
+ }
+ break;
default:
log_debug("%s: unknown '%c'", __func__, ictx->ch);
break;
6 key-string.c
View
@@ -1,4 +1,4 @@
-/* $Id: key-string.c 2553 2011-07-09 09:42:33Z tcunha $ */
+/* $Id: key-string.c 2622 2011-10-23 15:11:09Z tcunha $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -55,7 +55,11 @@ const struct {
{ "Home", KEYC_HOME },
{ "End", KEYC_END },
{ "NPage", KEYC_NPAGE },
+ { "PageDown", KEYC_NPAGE },
+ { "PgDn", KEYC_NPAGE },
{ "PPage", KEYC_PPAGE },
+ { "PageUp", KEYC_PPAGE },
+ { "PgUp", KEYC_PPAGE },
{ "Tab", '\011' },
{ "BTab", KEYC_BTAB },
{ "Space", ' ' },
4 options-table.c
View
@@ -1,4 +1,4 @@
-/* $Id: options-table.c 2587 2011-08-25 21:13:45Z tcunha $ */
+/* $Id: options-table.c 2629 2011-10-31 13:56:16Z tcunha $ */
/*
* Copyright (c) 2011 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -375,7 +375,7 @@ const struct options_table_entry session_options_table[] = {
.default_str = "*88col*:colors=88,*256col*:colors=256"
",xterm*:XT:Ms=\\E]52;%p1%s;%p2%s\\007"
":Cc=\\E]12;%p1%s\\007:Cr=\\E]112\\007"
- ":Cs=\\E[%p1%d q:Csr=\\E[2 q"
+ ":Cs=\\E[%p1%d q:Csr=\\E[2 q,screen*:XT"
},
{ .name = "update-environment",
13 screen-write.c
View
@@ -1,4 +1,4 @@
-/* $Id: screen-write.c 2553 2011-07-09 09:42:33Z tcunha $ */
+/* $Id: screen-write.c 2621 2011-10-23 15:10:22Z tcunha $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -985,6 +985,17 @@ screen_write_clearscreen(struct screen_write_ctx *ctx)
tty_write(tty_cmd_clearscreen, &ttyctx);
}
+/* Clear entire history. */
+void
+screen_write_clearhistory(struct screen_write_ctx *ctx)
+{
+ struct screen *s = ctx->s;
+ struct grid *gd = s->grid;
+
+ grid_move_lines(gd, 0, gd->hsize, gd->sy);
+ gd->hsize = 0;
+}
+
/* Write cell data. */
void
screen_write_cell(struct screen_write_ctx *ctx,
3  server-fn.c
View
@@ -1,4 +1,4 @@
-/* $Id: server-fn.c 2596 2011-09-21 16:35:13Z tcunha $ */
+/* $Id: server-fn.c 2621 2011-10-23 15:10:22Z tcunha $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -237,6 +237,7 @@ server_lock_client(struct client *c)
tty_stop_tty(&c->tty);
tty_raw(&c->tty, tty_term_string(c->tty.term, TTYC_SMCUP));
tty_raw(&c->tty, tty_term_string(c->tty.term, TTYC_CLEAR));
+ tty_raw(&c->tty, tty_term_string(c->tty.term, TTYC_E3));
c->flags |= CLIENT_SUSPENDED;
server_write_client(c, MSG_LOCK, &lockdata, sizeof lockdata);
32 tmux.1
View
@@ -14,7 +14,7 @@
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: October 2 2011 $
+.Dd $Mdocdate: October 27 2011 $
.Dt TMUX 1
.Os
.Sh NAME
@@ -610,9 +610,17 @@ server and clients and destroy all sessions.
.It Ic kill-session Op Fl t Ar target-session
Destroy the given session, closing any windows linked to it and no other
sessions, and detaching all clients attached to it.
-.It Ic list-clients Op Fl t Ar target-session
+.It Xo Ic list-clients
+.Op Fl F Ar format
+.Op Fl t Ar target-session
+.Xc
.D1 (alias: Ic lsc )
List all clients attached to the server.
+For the meaning of the
+.Fl F
+flag, see the
+.Sx FORMATS
+section.
If
.Ar target-session
is specified, list only clients connected to that session.
@@ -2564,6 +2572,7 @@ is used.
.El
.Sh FORMATS
The
+.Ic list-clients ,
.Ic list-sessions ,
.Ic list-windows
and
@@ -2601,6 +2610,17 @@ if it is unattached.
The following variables are available, where appropriate:
.Bl -column "session_created_string" "Replaced with" -offset indent
.It Sy "Variable name" Ta Sy "Replaced with"
+.It Li "client_activity" Ta "Integer time client last had activity"
+.It Li "client_activity_string" Ta "String time client last had activity"
+.It Li "client_created" Ta "Integer time client created"
+.It Li "client_created_string" Ta "String time client created"
+.It Li "client_cwd" Ta "Working directory of client"
+.It Li "client_height" Ta "Height of client"
+.It Li "client_readonly" Ta "1 if client is readonly"
+.It Li "client_termname" Ta "Terminal name of client"
+.It Li "client_tty" Ta "Pseudo terminal of client"
+.It Li "client_utf8" Ta "1 if client supports utf8"
+.It Li "client_width" Ta "Width of client"
.It Li "host" Ta "Hostname of local host"
.It Li "line" Ta "Line number in the list"
.It Li "pane_active" Ta "1 if active pane"
@@ -2956,13 +2976,15 @@ Miscellaneous commands are as follows:
.Bl -tag -width Ds
.It Ic clock-mode Op Fl t Ar target-pane
Display a large clock.
-.It Ic if-shell Ar shell-command command
+.It Ic if-shell Ar shell-command command Op Ar command
.D1 (alias: Ic if )
-Execute
+Execute the first
.Ar command
if
.Ar shell-command
-returns success.
+returns success or the second
+.Ar command
+otherwise.
.It Ic lock-server
.D1 (alias: Ic lock )
Lock each client individually by running the command specified by the
22 tmux.c
View
@@ -1,4 +1,4 @@
-/* $Id: tmux.c 2606 2011-10-02 11:32:24Z tcunha $ */
+/* $Id: tmux.c 2620 2011-10-23 15:08:58Z tcunha $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -127,6 +127,22 @@ areshell(const char *shell)
return (0);
}
+const char*
+get_full_path(const char *wd, const char *path)
+{
+ static char newpath[MAXPATHLEN];
+ char oldpath[MAXPATHLEN];
+
+ if (getcwd(oldpath, sizeof oldpath) == NULL)
+ return (NULL);
+ if (chdir(wd) != 0)
+ return (NULL);
+ if (realpath(path, newpath) != 0)
+ return (NULL);
+ chdir(oldpath);
+ return (newpath);
+}
+
void
parseenvironment(void)
{
@@ -295,8 +311,8 @@ main(int argc, char **argv)
* if not they know that output from UTF-8-capable programs may
* be wrong.
*/
- if ((s = getenv("LC_ALL")) == NULL) {
- if ((s = getenv("LC_CTYPE")) == NULL)
+ if ((s = getenv("LC_ALL")) == NULL || *s == '\0') {
+ if ((s = getenv("LC_CTYPE")) == NULL || *s == '\0')
s = getenv("LANG");
}
if (s != NULL && (strcasestr(s, "UTF-8") != NULL ||
6 tmux.h
View
@@ -1,4 +1,4 @@
-/* $Id: tmux.h 2591 2011-09-21 16:31:15Z tcunha $ */
+/* $Id: tmux.h 2621 2011-10-23 15:10:22Z tcunha $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -202,6 +202,7 @@ enum tty_code_code {
TTYC_DIM, /* enter_dim_mode, mh */
TTYC_DL, /* parm_delete_line, DL */
TTYC_DL1, /* delete_line, dl */
+ TTYC_E3,
TTYC_EL, /* clr_eol, ce */
TTYC_EL1, /* clr_bol, cb */
TTYC_ENACS, /* ena_acs, eA */
@@ -1341,6 +1342,7 @@ void logfile(const char *);
const char *getshell(void);
int checkshell(const char *);
int areshell(const char *);
+const char* get_full_path(const char *, const char *);
void setblocking(int, int);
__dead void shell_exec(const char *, const char *);
@@ -1360,6 +1362,7 @@ void format_add(
const char *format_find(struct format_tree *, const char *);
char *format_expand(struct format_tree *, const char *);
void format_session(struct format_tree *, struct session *);
+void format_client(struct format_tree *, struct client *);
void format_winlink(
struct format_tree *, struct session *, struct winlink *);
void format_window_pane(struct format_tree *, struct window_pane *);
@@ -1860,6 +1863,7 @@ void screen_write_kkeypadmode(struct screen_write_ctx *, int);
void screen_write_clearendofscreen(struct screen_write_ctx *);
void screen_write_clearstartofscreen(struct screen_write_ctx *);
void screen_write_clearscreen(struct screen_write_ctx *);
+void screen_write_clearhistory(struct screen_write_ctx *);
void screen_write_cell(struct screen_write_ctx *,
const struct grid_cell *, const struct utf8_data *);
void screen_write_setselection(struct screen_write_ctx *, u_char *, u_int);
3  tty-term.c
View
@@ -1,4 +1,4 @@
-/* $Id: tty-term.c 2553 2011-07-09 09:42:33Z tcunha $ */
+/* $Id: tty-term.c 2621 2011-10-23 15:10:22Z tcunha $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -64,6 +64,7 @@ const struct tty_term_code_entry tty_term_codes[NTTYCODE] = {
{ TTYC_DIM, TTYCODE_STRING, "dim" },
{ TTYC_DL, TTYCODE_STRING, "dl" },
{ TTYC_DL1, TTYCODE_STRING, "dl1" },
+ { TTYC_E3, TTYCODE_STRING, "E3" },
{ TTYC_EL, TTYCODE_STRING, "el" },
{ TTYC_EL1, TTYCODE_STRING, "el1" },
{ TTYC_ENACS, TTYCODE_STRING, "enacs" },
43 window-copy.c
View
@@ -1,4 +1,4 @@
-/* $Id: window-copy.c 2553 2011-07-09 09:42:33Z tcunha $ */
+/* $Id: window-copy.c 2626 2011-10-31 13:54:28Z tcunha $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -52,7 +52,7 @@ void window_copy_goto_line(struct window_pane *, const char *);
void window_copy_update_cursor(struct window_pane *, u_int, u_int);
void window_copy_start_selection(struct window_pane *);
int window_copy_update_selection(struct window_pane *);
-void window_copy_copy_selection(struct window_pane *);
+void window_copy_copy_selection(struct window_pane *, int);
void window_copy_clear_selection(struct window_pane *);
void window_copy_copy_line(
struct window_pane *, char **, size_t *, u_int, u_int, u_int);
@@ -134,7 +134,7 @@ struct window_copy_mode_data {
const char *inputprompt;
char *inputstr;
- u_int numprefix;
+ int numprefix;
enum window_copy_input_type searchtype;
char *searchstr;
@@ -165,7 +165,7 @@ window_copy_init(struct window_pane *wp)
data->inputtype = WINDOW_COPY_OFF;
data->inputprompt = NULL;
data->inputstr = xstrdup("");
- data->numprefix = 0;
+ data->numprefix = -1;
data->searchtype = WINDOW_COPY_OFF;
data->searchstr = NULL;
@@ -358,12 +358,12 @@ window_copy_key(struct window_pane *wp, struct session *sess, int key)
const char *word_separators;
struct window_copy_mode_data *data = wp->modedata;
struct screen *s = &data->screen;
- u_int n, np;
- int keys;
+ u_int n;
+ int np, keys;
enum mode_key_cmd cmd;
np = data->numprefix;
- if (np == 0)
+ if (np <= 0)
np = 1;
if (data->inputtype == WINDOW_COPY_JUMPFORWARD ||
@@ -513,7 +513,7 @@ window_copy_key(struct window_pane *wp, struct session *sess, int key)
if (sess != NULL &&
(cmd == MODEKEYCOPY_COPYLINE ||
cmd == MODEKEYCOPY_COPYENDOFLINE)) {
- window_copy_copy_selection(wp);
+ window_copy_copy_selection(wp, -1);
window_pane_reset_mode(wp);
return;
}
@@ -524,7 +524,7 @@ window_copy_key(struct window_pane *wp, struct session *sess, int key)
break;
case MODEKEYCOPY_COPYSELECTION:
if (sess != NULL) {
- window_copy_copy_selection(wp);
+ window_copy_copy_selection(wp, data->numprefix);
window_pane_reset_mode(wp);
return;
}
@@ -664,7 +664,7 @@ window_copy_key(struct window_pane *wp, struct session *sess, int key)
break;
}
- data->numprefix = 0;
+ data->numprefix = -1;
return;
input_on:
@@ -696,11 +696,11 @@ window_copy_key_input(struct window_pane *wp, int key)
struct window_copy_mode_data *data = wp->modedata;
struct screen *s = &data->screen;
size_t inputlen;
- u_int np;
+ int np;
switch (mode_key_lookup(&data->mdata, key)) {
case MODEKEYEDIT_CANCEL:
- data->numprefix = 0;
+ data->numprefix = -1;
return (-1);
case MODEKEYEDIT_BACKSPACE:
inputlen = strlen(data->inputstr);
@@ -712,7 +712,7 @@ window_copy_key_input(struct window_pane *wp, int key)
break;
case MODEKEYEDIT_ENTER:
np = data->numprefix;
- if (np == 0)
+ if (np <= 0)
np = 1;
switch (data->inputtype) {
@@ -738,7 +738,7 @@ window_copy_key_input(struct window_pane *wp, int key)
*data->inputstr = '\0';
break;
}
- data->numprefix = 0;
+ data->numprefix = -1;
return (1);
case MODEKEY_OTHER:
if (key < 32 || key > 126)
@@ -767,7 +767,7 @@ window_copy_key_numeric_prefix(struct window_pane *wp, int key)
if (key < '0' || key > '9')
return 1;
- if (data->numprefix >= 100) /* no more than three digits */
+ if (data->numprefix >= 100) /* no more than three digits */
return 0;
data->numprefix = data->numprefix * 10 + key - '0';
@@ -834,7 +834,7 @@ window_copy_mouse(
s->mode &= ~MODE_MOUSE_BUTTON;
s->mode |= MODE_MOUSE_STANDARD;
if (sess != NULL) {
- window_copy_copy_selection(wp);
+ window_copy_copy_selection(wp, -1);
window_pane_reset_mode(wp);
}
}
@@ -1235,7 +1235,7 @@ window_copy_update_selection(struct window_pane *wp)
}
void
-window_copy_copy_selection(struct window_pane *wp)
+window_copy_copy_selection(struct window_pane *wp, int idx)
{
struct window_copy_mode_data *data = wp->modedata;
struct screen *s = &data->screen;
@@ -1315,7 +1315,7 @@ window_copy_copy_selection(struct window_pane *wp)
} else {
if (keys == MODEKEY_EMACS)
lastex = ex;
- else
+ else
lastex = ex + 1;
restex = xx;
firstsx = sx;
@@ -1347,8 +1347,11 @@ window_copy_copy_selection(struct window_pane *wp)
screen_write_setselection(&wp->ictx.ctx, buf, off);
/* Add the buffer to the stack. */
- limit = options_get_number(&global_options, "buffer-limit");
- paste_add(&global_buffers, buf, off, limit);
+ if (idx == -1) {
+ limit = options_get_number(&global_options, "buffer-limit");
+ paste_add(&global_buffers, buf, off, limit);
+ } else
+ paste_replace(&global_buffers, idx, buf, off);
}
void
Please sign in to comment.
Something went wrong with that request. Please try again.