mirror of
https://github.com/tmux/tmux.git
synced 2026-09-17 02:31:58 +00:00
Compare commits
26 Commits
3.7
...
release_3.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e9634d4074 | ||
|
|
181e818b93 | ||
|
|
1c98c3a2a3 | ||
|
|
d28c9f613d | ||
|
|
0d7b9e87f4 | ||
|
|
4ec08da492 | ||
|
|
22cdf6acac | ||
|
|
83b9aff1ae | ||
|
|
e476c1230b | ||
|
|
746f275d41 | ||
|
|
e2d26c20d2 | ||
|
|
81e12f5397 | ||
|
|
8f3963635b | ||
|
|
18d5232804 | ||
|
|
c515d8cae0 | ||
|
|
8237d72900 | ||
|
|
173cc3dfc5 | ||
|
|
e802909de0 | ||
|
|
0e418b62d2 | ||
|
|
78a2145a47 | ||
|
|
dbe50934b1 | ||
|
|
166267c87a | ||
|
|
132a63d1da | ||
|
|
4e612612dc | ||
|
|
6c2ef75681 | ||
|
|
84291b021f |
32
CHANGES
32
CHANGES
@@ -1,3 +1,35 @@
|
|||||||
|
CHANGES FROM 3.7c TO 3.7d
|
||||||
|
|
||||||
|
* Do not use stale pointers to windows when panes in modes are joined.
|
||||||
|
|
||||||
|
* Fix problem where list-keys output can go to view mode instead of stdout.
|
||||||
|
|
||||||
|
CHANGES FROM 3.7b TO 3.7c
|
||||||
|
|
||||||
|
* Build with jemalloc on macOS to avoid what appears to be a bug in calloc
|
||||||
|
(issue 5385).
|
||||||
|
|
||||||
|
* Fix scrollbar initial state so they appear on new windows (issue 5339).
|
||||||
|
|
||||||
|
* Check time periodically in loops rather than every one (issue 5367).
|
||||||
|
|
||||||
|
* Use message-style again as default for message-format.
|
||||||
|
|
||||||
|
* Unzoom before creating floating panes to avoid a crash.
|
||||||
|
|
||||||
|
CHANGES FROM 3.7a TO 3.7b
|
||||||
|
|
||||||
|
* Fix so that the end of a synchronized update again triggers a redraw.
|
||||||
|
|
||||||
|
CHANGES FROM 3.7 TO 3.7a
|
||||||
|
|
||||||
|
* Fix crash in break-pane when no name is provided.
|
||||||
|
|
||||||
|
* Scrollbar options are now cached rather than being looked up for every redraw
|
||||||
|
(issue 5298).
|
||||||
|
|
||||||
|
* Only forbid #( in names, allow #[, empty names, : and .
|
||||||
|
|
||||||
CHANGES FROM 3.6b TO 3.7
|
CHANGES FROM 3.6b TO 3.7
|
||||||
|
|
||||||
* Add floating panes. These are panes which sit above the layout ("tiled
|
* Add floating panes. These are panes which sit above the layout ("tiled
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ cmd_break_pane_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
int idx = target->idx, before;
|
int idx = target->idx, before;
|
||||||
const char *template, *name = args_get(args, 'n');
|
const char *template, *name = args_get(args, 'n');
|
||||||
|
|
||||||
if (name != NULL && !check_name(name, WINDOW_NAME_FORBID)) {
|
if (name != NULL && !check_name(name)) {
|
||||||
cmdq_error(item, "invalid window name: %s", name);
|
cmdq_error(item, "invalid window name: %s", name);
|
||||||
return (CMD_RETURN_ERROR);
|
return (CMD_RETURN_ERROR);
|
||||||
}
|
}
|
||||||
@@ -86,7 +86,7 @@ cmd_break_pane_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
return (CMD_RETURN_ERROR);
|
return (CMD_RETURN_ERROR);
|
||||||
}
|
}
|
||||||
if (name != NULL) {
|
if (name != NULL) {
|
||||||
window_set_name(w, name, WINDOW_NAME_FORBID);
|
window_set_name(w, name, 0);
|
||||||
options_set_number(w->options, "automatic-rename", 0);
|
options_set_number(w->options, "automatic-rename", 0);
|
||||||
}
|
}
|
||||||
server_unlink_window(src_s, wl);
|
server_unlink_window(src_s, wl);
|
||||||
@@ -114,9 +114,9 @@ cmd_break_pane_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
w->active = wp;
|
w->active = wp;
|
||||||
w->latest = tc;
|
w->latest = tc;
|
||||||
|
|
||||||
if (name != NULL) {
|
if (name == NULL) {
|
||||||
newname = default_window_name(w);
|
newname = default_window_name(w);
|
||||||
window_set_name(w, newname, WINDOW_NAME_FORBID);
|
window_set_name(w, newname, 0);
|
||||||
free(newname);
|
free(newname);
|
||||||
} else {
|
} else {
|
||||||
window_set_name(w, name, 0);
|
window_set_name(w, name, 0);
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ cmd_list_keys_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
cmd_list_keys_format_add_key_binding(ft, l[i], prefix);
|
cmd_list_keys_format_add_key_binding(ft, l[i], prefix);
|
||||||
|
|
||||||
line = format_expand(ft, template);
|
line = format_expand(ft, template);
|
||||||
if ((single && tc != NULL) || n == 1)
|
if (single && tc != NULL && (~tc->flags & CLIENT_CONTROL))
|
||||||
status_message_set(tc, -1, 1, 0, 0, "%s", line);
|
status_message_set(tc, -1, 1, 0, 0, "%s", line);
|
||||||
else if (*line != '\0')
|
else if (*line != '\0')
|
||||||
cmdq_print(item, "%s", line);
|
cmdq_print(item, "%s", line);
|
||||||
|
|||||||
@@ -101,22 +101,22 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
|
|
||||||
if ((tmp = args_get(args, 'n')) != NULL) {
|
if ((tmp = args_get(args, 'n')) != NULL) {
|
||||||
ename = format_single(item, tmp, c, NULL, NULL, NULL);
|
ename = format_single(item, tmp, c, NULL, NULL, NULL);
|
||||||
if (!check_name(ename, WINDOW_NAME_FORBID)) {
|
if (!check_name(ename)) {
|
||||||
cmdq_error(item, "invalid window name: %s", ename);
|
cmdq_error(item, "invalid window name: %s", ename);
|
||||||
free(ename);
|
free(ename);
|
||||||
return (CMD_RETURN_ERROR);
|
return (CMD_RETURN_ERROR);
|
||||||
}
|
}
|
||||||
wname = clean_name(ename, WINDOW_NAME_FORBID);
|
wname = clean_name(ename, 0);
|
||||||
free(ename);
|
free(ename);
|
||||||
}
|
}
|
||||||
if ((tmp = args_get(args, 's')) != NULL) {
|
if ((tmp = args_get(args, 's')) != NULL) {
|
||||||
ename = format_single(item, tmp, c, NULL, NULL, NULL);
|
ename = format_single(item, tmp, c, NULL, NULL, NULL);
|
||||||
if (!check_name(ename, SESSION_NAME_FORBID)) {
|
if (!check_name(ename)) {
|
||||||
cmdq_error(item, "invalid session name: %s", ename);
|
cmdq_error(item, "invalid session name: %s", ename);
|
||||||
free(ename);
|
free(ename);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
sname = clean_name(ename, SESSION_NAME_FORBID);
|
sname = clean_name(ename, 0);
|
||||||
free(ename);
|
free(ename);
|
||||||
}
|
}
|
||||||
if (args_has(args, 'A')) {
|
if (args_has(args, 'A')) {
|
||||||
@@ -152,12 +152,12 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
else if (groupwith != NULL)
|
else if (groupwith != NULL)
|
||||||
prefix = xstrdup(groupwith->name);
|
prefix = xstrdup(groupwith->name);
|
||||||
else {
|
else {
|
||||||
if (!check_name(group, SESSION_NAME_FORBID)) {
|
if (!check_name(group)) {
|
||||||
cmdq_error(item,
|
cmdq_error(item,
|
||||||
"invalid session group name: %s", group);
|
"invalid session group name: %s", group);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
prefix = clean_name(group, SESSION_NAME_FORBID);
|
prefix = clean_name(group, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,12 +73,12 @@ cmd_new_window_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
name = args_get(args, 'n');
|
name = args_get(args, 'n');
|
||||||
if (name != NULL) {
|
if (name != NULL) {
|
||||||
expanded = format_single(item, name, c, s, NULL, NULL);
|
expanded = format_single(item, name, c, s, NULL, NULL);
|
||||||
if (!check_name(expanded, WINDOW_NAME_FORBID)) {
|
if (!check_name(expanded)) {
|
||||||
cmdq_error(item, "invalid window name: %s", expanded);
|
cmdq_error(item, "invalid window name: %s", expanded);
|
||||||
free(expanded);
|
free(expanded);
|
||||||
return (CMD_RETURN_ERROR);
|
return (CMD_RETURN_ERROR);
|
||||||
}
|
}
|
||||||
wname = clean_name(expanded, WINDOW_NAME_FORBID);
|
wname = clean_name(expanded, 0);
|
||||||
free(expanded);
|
free(expanded);
|
||||||
}
|
}
|
||||||
if (args_has(args, 'S') && wname != NULL && target->idx == -1) {
|
if (args_has(args, 'S') && wname != NULL && target->idx == -1) {
|
||||||
|
|||||||
@@ -52,12 +52,12 @@ cmd_rename_session_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
char *newname, *tmp;
|
char *newname, *tmp;
|
||||||
|
|
||||||
tmp = format_single_from_target(item, args_string(args, 0));
|
tmp = format_single_from_target(item, args_string(args, 0));
|
||||||
if (!check_name(tmp, SESSION_NAME_FORBID)) {
|
if (!check_name(tmp)) {
|
||||||
cmdq_error(item, "invalid session name: %s", tmp);
|
cmdq_error(item, "invalid session name: %s", tmp);
|
||||||
free(tmp);
|
free(tmp);
|
||||||
return (CMD_RETURN_ERROR);
|
return (CMD_RETURN_ERROR);
|
||||||
}
|
}
|
||||||
newname = clean_name(tmp, SESSION_NAME_FORBID);
|
newname = clean_name(tmp, 0);
|
||||||
free(tmp);
|
free(tmp);
|
||||||
if (strcmp(newname, s->name) == 0) {
|
if (strcmp(newname, s->name) == 0) {
|
||||||
free(newname);
|
free(newname);
|
||||||
|
|||||||
@@ -51,13 +51,13 @@ cmd_rename_window_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
char *name;
|
char *name;
|
||||||
|
|
||||||
name = format_single_from_target(item, args_string(args, 0));
|
name = format_single_from_target(item, args_string(args, 0));
|
||||||
if (!check_name(name, WINDOW_NAME_FORBID)) {
|
if (!check_name(name)) {
|
||||||
cmdq_error(item, "invalid window name: %s", name);
|
cmdq_error(item, "invalid window name: %s", name);
|
||||||
free(name);
|
free(name);
|
||||||
return (CMD_RETURN_ERROR);
|
return (CMD_RETURN_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
window_set_name(wl->window, name, WINDOW_NAME_FORBID);
|
window_set_name(wl->window, name, 0);
|
||||||
options_set_number(wl->window->options, "automatic-rename", 0);
|
options_set_number(wl->window->options, "automatic-rename", 0);
|
||||||
free(name);
|
free(name);
|
||||||
|
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ cmd_resize_pane_mouse_update_floating(struct client *c, struct mouse_event *m)
|
|||||||
struct window_pane *wp;
|
struct window_pane *wp;
|
||||||
struct layout_cell *lc;
|
struct layout_cell *lc;
|
||||||
int y, ly, x, lx, sx, sy, new_sx, new_sy;
|
int y, ly, x, lx, sx, sy, new_sx, new_sy;
|
||||||
int scrollbars, sb_pos, left, right;
|
int left, right;
|
||||||
int new_xoff, new_yoff, resizes = 0;
|
int new_xoff, new_yoff, resizes = 0;
|
||||||
|
|
||||||
wp = cmd_mouse_pane(m, NULL, &wl);
|
wp = cmd_mouse_pane(m, NULL, &wl);
|
||||||
@@ -193,15 +193,13 @@ cmd_resize_pane_mouse_update_floating(struct client *c, struct mouse_event *m)
|
|||||||
lc = wp->layout_cell;
|
lc = wp->layout_cell;
|
||||||
sx = wp->sx;
|
sx = wp->sx;
|
||||||
sy = wp->sy;
|
sy = wp->sy;
|
||||||
scrollbars = options_get_number(w->options, "pane-scrollbars");
|
|
||||||
sb_pos = options_get_number(w->options, "pane-scrollbars-position");
|
|
||||||
left = wp->xoff - 1;
|
left = wp->xoff - 1;
|
||||||
right = wp->xoff + sx;
|
right = wp->xoff + sx;
|
||||||
if (window_pane_show_scrollbar(wp, scrollbars) &&
|
if (window_pane_show_scrollbar(wp) &&
|
||||||
sb_pos == PANE_SCROLLBARS_LEFT) {
|
w->sb_pos == PANE_SCROLLBARS_LEFT) {
|
||||||
left -= wp->scrollbar_style.width + wp->scrollbar_style.pad;
|
left -= wp->scrollbar_style.width + wp->scrollbar_style.pad;
|
||||||
} else if (window_pane_show_scrollbar(wp, scrollbars) &&
|
} else if (window_pane_show_scrollbar(wp) &&
|
||||||
sb_pos == PANE_SCROLLBARS_RIGHT) {
|
w->sb_pos == PANE_SCROLLBARS_RIGHT) {
|
||||||
right += wp->scrollbar_style.width + wp->scrollbar_style.pad;
|
right += wp->scrollbar_style.width + wp->scrollbar_style.pad;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ cmd_split_window_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
flags |= SPAWN_FULLSIZE;
|
flags |= SPAWN_FULLSIZE;
|
||||||
|
|
||||||
input = args_has(args, 'I');
|
input = args_has(args, 'I');
|
||||||
if (input)
|
if (input || (count == 1 && *args_string(args, 0) == '\0'))
|
||||||
empty = 1;
|
empty = 1;
|
||||||
else
|
else
|
||||||
empty = args_has(args, 'E');
|
empty = args_has(args, 'E');
|
||||||
|
|||||||
133
configure.ac
133
configure.ac
@@ -1,6 +1,6 @@
|
|||||||
# configure.ac
|
# configure.ac
|
||||||
|
|
||||||
AC_INIT([tmux], 3.7)
|
AC_INIT([tmux], 3.7d)
|
||||||
AC_PREREQ([2.60])
|
AC_PREREQ([2.60])
|
||||||
|
|
||||||
AC_CONFIG_AUX_DIR(etc)
|
AC_CONFIG_AUX_DIR(etc)
|
||||||
@@ -76,9 +76,7 @@ AM_CONDITIONAL(IS_OPTIMIZED, test "x$enable_optimizations" = xyes)
|
|||||||
# Is this --enable-asan?
|
# Is this --enable-asan?
|
||||||
AC_ARG_ENABLE(
|
AC_ARG_ENABLE(
|
||||||
asan,
|
asan,
|
||||||
AS_HELP_STRING(--enable-asan, enable ASAN build flags),
|
AS_HELP_STRING(--enable-asan, enable ASAN build flags)
|
||||||
,
|
|
||||||
enable_asan=no
|
|
||||||
)
|
)
|
||||||
AM_CONDITIONAL(IS_ASAN, test "x$enable_asan" = xyes)
|
AM_CONDITIONAL(IS_ASAN, test "x$enable_asan" = xyes)
|
||||||
|
|
||||||
@@ -241,6 +239,7 @@ AC_LIBOBJ(getopt_long)
|
|||||||
|
|
||||||
# Look for libevent. Try libevent_core or libevent with pkg-config first then
|
# Look for libevent. Try libevent_core or libevent with pkg-config first then
|
||||||
# look for the library.
|
# look for the library.
|
||||||
|
libevent_version=off
|
||||||
PKG_CHECK_MODULES(
|
PKG_CHECK_MODULES(
|
||||||
LIBEVENT_CORE,
|
LIBEVENT_CORE,
|
||||||
[libevent_core >= 2],
|
[libevent_core >= 2],
|
||||||
@@ -249,6 +248,8 @@ PKG_CHECK_MODULES(
|
|||||||
CPPFLAGS="$AM_CPPFLAGS $SAVED_CPPFLAGS"
|
CPPFLAGS="$AM_CPPFLAGS $SAVED_CPPFLAGS"
|
||||||
LIBS="$LIBEVENT_CORE_LIBS $LIBS"
|
LIBS="$LIBEVENT_CORE_LIBS $LIBS"
|
||||||
found_libevent=yes
|
found_libevent=yes
|
||||||
|
libevent_version=`$PKG_CONFIG --modversion libevent_core 2>/dev/null`
|
||||||
|
test "x$libevent_version" = x && libevent_version=on
|
||||||
],
|
],
|
||||||
found_libevent=no
|
found_libevent=no
|
||||||
)
|
)
|
||||||
@@ -261,6 +262,8 @@ if test x$found_libevent = xno; then
|
|||||||
CPPFLAGS="$AM_CPPFLAGS $SAVED_CPPFLAGS"
|
CPPFLAGS="$AM_CPPFLAGS $SAVED_CPPFLAGS"
|
||||||
LIBS="$LIBEVENT_LIBS $LIBS"
|
LIBS="$LIBEVENT_LIBS $LIBS"
|
||||||
found_libevent=yes
|
found_libevent=yes
|
||||||
|
libevent_version=`$PKG_CONFIG --modversion libevent 2>/dev/null`
|
||||||
|
test "x$libevent_version" = x && libevent_version=on
|
||||||
],
|
],
|
||||||
found_libevent=no
|
found_libevent=no
|
||||||
)
|
)
|
||||||
@@ -269,7 +272,8 @@ if test x$found_libevent = xno; then
|
|||||||
AC_SEARCH_LIBS(
|
AC_SEARCH_LIBS(
|
||||||
event_init,
|
event_init,
|
||||||
[event_core event event-1.4],
|
[event_core event event-1.4],
|
||||||
found_libevent=yes,
|
[found_libevent=yes
|
||||||
|
libevent_version=on],
|
||||||
found_libevent=no
|
found_libevent=no
|
||||||
)
|
)
|
||||||
fi
|
fi
|
||||||
@@ -296,6 +300,7 @@ fi
|
|||||||
|
|
||||||
# Look for ncurses or curses. Try pkg-config first then directly for the
|
# Look for ncurses or curses. Try pkg-config first then directly for the
|
||||||
# library.
|
# library.
|
||||||
|
ncurses_version=off
|
||||||
PKG_CHECK_MODULES(
|
PKG_CHECK_MODULES(
|
||||||
LIBTINFOW,
|
LIBTINFOW,
|
||||||
tinfow,
|
tinfow,
|
||||||
@@ -304,6 +309,8 @@ PKG_CHECK_MODULES(
|
|||||||
CPPFLAGS="$LIBTINFOW_CFLAGS $SAVED_CPPFLAGS"
|
CPPFLAGS="$LIBTINFOW_CFLAGS $SAVED_CPPFLAGS"
|
||||||
LIBS="$LIBTINFOW_LIBS $LIBS"
|
LIBS="$LIBTINFOW_LIBS $LIBS"
|
||||||
found_ncurses=yes
|
found_ncurses=yes
|
||||||
|
ncurses_version=`$PKG_CONFIG --modversion tinfow 2>/dev/null`
|
||||||
|
test "x$ncurses_version" = x && ncurses_version=on
|
||||||
],
|
],
|
||||||
found_ncurses=no
|
found_ncurses=no
|
||||||
)
|
)
|
||||||
@@ -316,6 +323,8 @@ if test "x$found_ncurses" = xno; then
|
|||||||
CPPFLAGS="$LIBTINFO_CFLAGS $SAVED_CPPFLAGS"
|
CPPFLAGS="$LIBTINFO_CFLAGS $SAVED_CPPFLAGS"
|
||||||
LIBS="$LIBTINFO_LIBS $LIBS"
|
LIBS="$LIBTINFO_LIBS $LIBS"
|
||||||
found_ncurses=yes
|
found_ncurses=yes
|
||||||
|
ncurses_version=`$PKG_CONFIG --modversion tinfo 2>/dev/null`
|
||||||
|
test "x$ncurses_version" = x && ncurses_version=on
|
||||||
],
|
],
|
||||||
found_ncurses=no
|
found_ncurses=no
|
||||||
)
|
)
|
||||||
@@ -329,6 +338,8 @@ if test "x$found_ncurses" = xno; then
|
|||||||
CPPFLAGS="$LIBNCURSESW_CFLAGS $SAVED_CPPFLAGS"
|
CPPFLAGS="$LIBNCURSESW_CFLAGS $SAVED_CPPFLAGS"
|
||||||
LIBS="$LIBNCURSESW_LIBS $LIBS"
|
LIBS="$LIBNCURSESW_LIBS $LIBS"
|
||||||
found_ncurses=yes
|
found_ncurses=yes
|
||||||
|
ncurses_version=`$PKG_CONFIG --modversion ncursesw 2>/dev/null`
|
||||||
|
test "x$ncurses_version" = x && ncurses_version=on
|
||||||
],
|
],
|
||||||
found_ncurses=no
|
found_ncurses=no
|
||||||
)
|
)
|
||||||
@@ -342,6 +353,8 @@ if test "x$found_ncurses" = xno; then
|
|||||||
CPPFLAGS="$LIBNCURSES_CFLAGS $SAVED_CPPFLAGS"
|
CPPFLAGS="$LIBNCURSES_CFLAGS $SAVED_CPPFLAGS"
|
||||||
LIBS="$LIBNCURSES_LIBS $LIBS"
|
LIBS="$LIBNCURSES_LIBS $LIBS"
|
||||||
found_ncurses=yes
|
found_ncurses=yes
|
||||||
|
ncurses_version=`$PKG_CONFIG --modversion ncurses 2>/dev/null`
|
||||||
|
test "x$ncurses_version" = x && ncurses_version=on
|
||||||
],
|
],
|
||||||
found_ncurses=no
|
found_ncurses=no
|
||||||
)
|
)
|
||||||
@@ -350,7 +363,8 @@ if test "x$found_ncurses" = xno; then
|
|||||||
AC_SEARCH_LIBS(
|
AC_SEARCH_LIBS(
|
||||||
setupterm,
|
setupterm,
|
||||||
[tinfow tinfo terminfo ncursesw ncurses],
|
[tinfow tinfo terminfo ncursesw ncurses],
|
||||||
found_ncurses=yes,
|
[found_ncurses=yes
|
||||||
|
ncurses_version=on],
|
||||||
found_ncurses=no
|
found_ncurses=no
|
||||||
)
|
)
|
||||||
if test "x$found_ncurses" = xyes; then
|
if test "x$found_ncurses" = xyes; then
|
||||||
@@ -380,6 +394,7 @@ else
|
|||||||
LIBS="$LIBS -lcurses"
|
LIBS="$LIBS -lcurses"
|
||||||
CPPFLAGS="$CPPFLAGS -DHAVE_CURSES_H"
|
CPPFLAGS="$CPPFLAGS -DHAVE_CURSES_H"
|
||||||
AC_DEFINE(HAVE_CURSES_H)
|
AC_DEFINE(HAVE_CURSES_H)
|
||||||
|
ncurses_version=on
|
||||||
else
|
else
|
||||||
AC_MSG_ERROR("curses not found")
|
AC_MSG_ERROR("curses not found")
|
||||||
fi
|
fi
|
||||||
@@ -390,6 +405,7 @@ AC_CHECK_FUNCS([ \
|
|||||||
])
|
])
|
||||||
|
|
||||||
# Look for utempter.
|
# Look for utempter.
|
||||||
|
utempter_version=off
|
||||||
AC_ARG_ENABLE(
|
AC_ARG_ENABLE(
|
||||||
utempter,
|
utempter,
|
||||||
AS_HELP_STRING(--enable-utempter, use utempter if it is installed)
|
AS_HELP_STRING(--enable-utempter, use utempter if it is installed)
|
||||||
@@ -406,17 +422,34 @@ if test "x$enable_utempter" = xyes; then
|
|||||||
fi
|
fi
|
||||||
if test "x$enable_utempter" = xyes; then
|
if test "x$enable_utempter" = xyes; then
|
||||||
AC_DEFINE(HAVE_UTEMPTER)
|
AC_DEFINE(HAVE_UTEMPTER)
|
||||||
|
utempter_version=on
|
||||||
else
|
else
|
||||||
AC_MSG_ERROR("utempter not found")
|
AC_MSG_ERROR("utempter not found")
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Look for utf8proc.
|
# Look for utf8proc.
|
||||||
|
utf8proc_version=off
|
||||||
AC_ARG_ENABLE(
|
AC_ARG_ENABLE(
|
||||||
utf8proc,
|
utf8proc,
|
||||||
AS_HELP_STRING(--enable-utf8proc, use utf8proc if it is installed)
|
AS_HELP_STRING(--enable-utf8proc, use utf8proc if it is installed)
|
||||||
)
|
)
|
||||||
|
try_utf8proc=no
|
||||||
|
require_utf8proc=no
|
||||||
if test "x$enable_utf8proc" = xyes; then
|
if test "x$enable_utf8proc" = xyes; then
|
||||||
|
try_utf8proc=yes
|
||||||
|
elif test "x$enable_utf8proc" = x; then
|
||||||
|
case "$host_os" in
|
||||||
|
*darwin*)
|
||||||
|
try_utf8proc=yes
|
||||||
|
require_utf8proc=yes
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
if test "x$try_utf8proc" = xyes; then
|
||||||
|
SAVED_AM_CPPFLAGS="$AM_CPPFLAGS"
|
||||||
|
SAVED_OLD_CPPFLAGS="$CPPFLAGS"
|
||||||
|
SAVED_LIBS="$LIBS"
|
||||||
PKG_CHECK_MODULES(
|
PKG_CHECK_MODULES(
|
||||||
LIBUTF8PROC,
|
LIBUTF8PROC,
|
||||||
libutf8proc,
|
libutf8proc,
|
||||||
@@ -424,7 +457,10 @@ if test "x$enable_utf8proc" = xyes; then
|
|||||||
AM_CPPFLAGS="$LIBUTF8PROC_CFLAGS $AM_CPPFLAGS"
|
AM_CPPFLAGS="$LIBUTF8PROC_CFLAGS $AM_CPPFLAGS"
|
||||||
CPPFLAGS="$LIBUTF8PROC_CFLAGS $SAVED_CPPFLAGS"
|
CPPFLAGS="$LIBUTF8PROC_CFLAGS $SAVED_CPPFLAGS"
|
||||||
LIBS="$LIBUTF8PROC_LIBS $LIBS"
|
LIBS="$LIBUTF8PROC_LIBS $LIBS"
|
||||||
]
|
utf8proc_version=`$PKG_CONFIG --modversion libutf8proc 2>/dev/null`
|
||||||
|
test "x$utf8proc_version" = x && utf8proc_version=on
|
||||||
|
],
|
||||||
|
[:]
|
||||||
)
|
)
|
||||||
AC_CHECK_HEADER(utf8proc.h, enable_utf8proc=yes, enable_utf8proc=no)
|
AC_CHECK_HEADER(utf8proc.h, enable_utf8proc=yes, enable_utf8proc=no)
|
||||||
if test "x$enable_utf8proc" = xyes; then
|
if test "x$enable_utf8proc" = xyes; then
|
||||||
@@ -437,13 +473,23 @@ if test "x$enable_utf8proc" = xyes; then
|
|||||||
fi
|
fi
|
||||||
if test "x$enable_utf8proc" = xyes; then
|
if test "x$enable_utf8proc" = xyes; then
|
||||||
AC_DEFINE(HAVE_UTF8PROC)
|
AC_DEFINE(HAVE_UTF8PROC)
|
||||||
|
test "x$utf8proc_version" = xoff && utf8proc_version=on
|
||||||
else
|
else
|
||||||
AC_MSG_ERROR("utf8proc not found")
|
AM_CPPFLAGS="$SAVED_AM_CPPFLAGS"
|
||||||
|
CPPFLAGS="$SAVED_OLD_CPPFLAGS"
|
||||||
|
LIBS="$SAVED_LIBS"
|
||||||
|
utf8proc_version=off
|
||||||
|
if test "x$require_utf8proc" = xyes; then
|
||||||
|
enable_utf8proc=
|
||||||
|
else
|
||||||
|
AC_MSG_ERROR("utf8proc not found")
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
AM_CONDITIONAL(HAVE_UTF8PROC, [test "x$enable_utf8proc" = xyes])
|
AM_CONDITIONAL(HAVE_UTF8PROC, [test "x$enable_utf8proc" = xyes])
|
||||||
|
|
||||||
# Check for systemd support.
|
# Check for systemd support.
|
||||||
|
systemd_version=off
|
||||||
AC_ARG_ENABLE(
|
AC_ARG_ENABLE(
|
||||||
systemd,
|
systemd,
|
||||||
AS_HELP_STRING(--enable-systemd, enable systemd integration)
|
AS_HELP_STRING(--enable-systemd, enable systemd integration)
|
||||||
@@ -457,6 +503,8 @@ if test x"$enable_systemd" = xyes; then
|
|||||||
CPPFLAGS="$AM_CPPFLAGS $SAVED_CPPFLAGS"
|
CPPFLAGS="$AM_CPPFLAGS $SAVED_CPPFLAGS"
|
||||||
LIBS="$SYSTEMD_LIBS $LIBS"
|
LIBS="$SYSTEMD_LIBS $LIBS"
|
||||||
found_systemd=yes
|
found_systemd=yes
|
||||||
|
systemd_version=`$PKG_CONFIG --modversion libsystemd 2>/dev/null`
|
||||||
|
test "x$systemd_version" = x && systemd_version=on
|
||||||
],
|
],
|
||||||
found_systemd=no
|
found_systemd=no
|
||||||
)
|
)
|
||||||
@@ -581,11 +629,27 @@ if test "x$found_malloc_trim" = xyes; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Build against jemalloc if requested.
|
# Build against jemalloc if requested.
|
||||||
|
jemalloc_version=off
|
||||||
AC_ARG_ENABLE(
|
AC_ARG_ENABLE(
|
||||||
jemalloc,
|
jemalloc,
|
||||||
AS_HELP_STRING(--enable-jemalloc, use jemalloc if it is installed)
|
AS_HELP_STRING(--enable-jemalloc, use jemalloc if it is installed)
|
||||||
)
|
)
|
||||||
|
try_jemalloc=no
|
||||||
|
require_jemalloc=no
|
||||||
if test "x$enable_jemalloc" = xyes; then
|
if test "x$enable_jemalloc" = xyes; then
|
||||||
|
try_jemalloc=yes
|
||||||
|
elif test "x$enable_jemalloc" = x; then
|
||||||
|
case "$host_os" in
|
||||||
|
*darwin*)
|
||||||
|
try_jemalloc=yes
|
||||||
|
require_jemalloc=yes
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
if test "x$try_jemalloc" = xyes; then
|
||||||
|
SAVED_AM_CPPFLAGS="$AM_CPPFLAGS"
|
||||||
|
SAVED_OLD_CPPFLAGS="$CPPFLAGS"
|
||||||
|
SAVED_LIBS="$LIBS"
|
||||||
PKG_CHECK_MODULES(
|
PKG_CHECK_MODULES(
|
||||||
JEMALLOC,
|
JEMALLOC,
|
||||||
jemalloc,
|
jemalloc,
|
||||||
@@ -593,9 +657,26 @@ if test "x$enable_jemalloc" = xyes; then
|
|||||||
AM_CPPFLAGS="$JEMALLOC_CFLAGS $AM_CPPFLAGS"
|
AM_CPPFLAGS="$JEMALLOC_CFLAGS $AM_CPPFLAGS"
|
||||||
CPPFLAGS="$AM_CPPFLAGS $SAVED_CPPFLAGS"
|
CPPFLAGS="$AM_CPPFLAGS $SAVED_CPPFLAGS"
|
||||||
LIBS="$LIBS $JEMALLOC_LIBS"
|
LIBS="$LIBS $JEMALLOC_LIBS"
|
||||||
|
jemalloc_version=`$PKG_CONFIG --modversion jemalloc 2>/dev/null`
|
||||||
|
test "x$jemalloc_version" = x && jemalloc_version=on
|
||||||
],
|
],
|
||||||
AC_MSG_ERROR("jemalloc not found")
|
enable_jemalloc=no
|
||||||
)
|
)
|
||||||
|
if test "x$enable_jemalloc" = xno; then
|
||||||
|
AM_CPPFLAGS="$SAVED_AM_CPPFLAGS"
|
||||||
|
CPPFLAGS="$SAVED_OLD_CPPFLAGS"
|
||||||
|
LIBS="$SAVED_LIBS"
|
||||||
|
jemalloc_version=off
|
||||||
|
if test "x$require_jemalloc" = xyes; then
|
||||||
|
enable_jemalloc=
|
||||||
|
else
|
||||||
|
AC_MSG_ERROR("jemalloc not found")
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
enable_jemalloc=yes
|
||||||
|
AC_DEFINE(HAVE_JEMALLOC)
|
||||||
|
test "x$jemalloc_version" = xoff && jemalloc_version=on
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check for CMSG_DATA. On some platforms like HP-UX this requires UNIX 95
|
# Check for CMSG_DATA. On some platforms like HP-UX this requires UNIX 95
|
||||||
@@ -942,6 +1023,20 @@ case "$host_os" in
|
|||||||
AC_MSG_NOTICE([])
|
AC_MSG_NOTICE([])
|
||||||
AC_MSG_ERROR([must give --enable-utf8proc or --disable-utf8proc])
|
AC_MSG_ERROR([must give --enable-utf8proc or --disable-utf8proc])
|
||||||
fi
|
fi
|
||||||
|
#
|
||||||
|
# macOS calloc(3) does not appear to always zero memory correctly,
|
||||||
|
# so complain and suggest using jemalloc instead.
|
||||||
|
#
|
||||||
|
if test "x$enable_jemalloc" = x; then
|
||||||
|
AC_MSG_NOTICE([])
|
||||||
|
AC_MSG_NOTICE([ macOS calloc(3) appears not to correctly])
|
||||||
|
AC_MSG_NOTICE([ zero allocations in some circumstances;])
|
||||||
|
AC_MSG_NOTICE([ to avoid this, configuring with])
|
||||||
|
AC_MSG_NOTICE([ --enable-jemalloc is recommended. To build])
|
||||||
|
AC_MSG_NOTICE([ without anyway, use --disable-jemalloc])
|
||||||
|
AC_MSG_NOTICE([])
|
||||||
|
AC_MSG_ERROR([must give --enable-jemalloc or --disable-jemalloc])
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
*dragonfly*)
|
*dragonfly*)
|
||||||
AC_MSG_RESULT(dragonfly)
|
AC_MSG_RESULT(dragonfly)
|
||||||
@@ -1029,6 +1124,26 @@ AC_MSG_CHECKING(lock-command)
|
|||||||
AC_MSG_RESULT($DEFAULT_LOCK_CMD)
|
AC_MSG_RESULT($DEFAULT_LOCK_CMD)
|
||||||
AC_SUBST(DEFAULT_LOCK_CMD)
|
AC_SUBST(DEFAULT_LOCK_CMD)
|
||||||
|
|
||||||
|
# Print a summary.
|
||||||
|
AC_MSG_NOTICE([])
|
||||||
|
if test "x$enable_asan" = xyes; then
|
||||||
|
AC_MSG_NOTICE([ASAN: on])
|
||||||
|
else
|
||||||
|
AC_MSG_NOTICE([ASAN: off])
|
||||||
|
fi
|
||||||
|
if test "x$enable_debug" = xyes; then
|
||||||
|
AC_MSG_NOTICE([debug: on])
|
||||||
|
else
|
||||||
|
AC_MSG_NOTICE([debug: off])
|
||||||
|
fi
|
||||||
|
AC_MSG_NOTICE([jemalloc: $jemalloc_version])
|
||||||
|
AC_MSG_NOTICE([libevent: $libevent_version])
|
||||||
|
AC_MSG_NOTICE([ncurses: $ncurses_version])
|
||||||
|
AC_MSG_NOTICE([systemd: $systemd_version])
|
||||||
|
AC_MSG_NOTICE([utempter: $utempter_version])
|
||||||
|
AC_MSG_NOTICE([utf8proc: $utf8proc_version])
|
||||||
|
AC_MSG_NOTICE([])
|
||||||
|
|
||||||
# Save our CFLAGS/CPPFLAGS/LDFLAGS for the Makefile and restore the old user
|
# Save our CFLAGS/CPPFLAGS/LDFLAGS for the Makefile and restore the old user
|
||||||
# variables.
|
# variables.
|
||||||
AC_SUBST(AM_CPPFLAGS)
|
AC_SUBST(AM_CPPFLAGS)
|
||||||
|
|||||||
26
format.c
26
format.c
@@ -124,6 +124,9 @@ format_job_cmp(struct format_job *fj1, struct format_job *fj2)
|
|||||||
/* Limit on time taken (milliseconds). */
|
/* Limit on time taken (milliseconds). */
|
||||||
#define FORMAT_TIME_LIMIT 100
|
#define FORMAT_TIME_LIMIT 100
|
||||||
|
|
||||||
|
/* How often to check the time in long loops. */
|
||||||
|
#define FORMAT_TIME_LOOP_CHECK 10000
|
||||||
|
|
||||||
/* Format expand flags. */
|
/* Format expand flags. */
|
||||||
#define FORMAT_EXPAND_TIME 0x1
|
#define FORMAT_EXPAND_TIME 0x1
|
||||||
#define FORMAT_EXPAND_NOJOBS 0x2
|
#define FORMAT_EXPAND_NOJOBS 0x2
|
||||||
@@ -4193,10 +4196,14 @@ found:
|
|||||||
|
|
||||||
/* Check if format has not taken too long. */
|
/* Check if format has not taken too long. */
|
||||||
static int
|
static int
|
||||||
format_check_time(struct format_expand_state *es)
|
format_check_time(struct format_expand_state *es, u_int *check)
|
||||||
{
|
{
|
||||||
uint64_t t = get_timer();
|
uint64_t t;
|
||||||
|
|
||||||
|
if (check != NULL && ++*check % FORMAT_TIME_LOOP_CHECK != 0)
|
||||||
|
return (1);
|
||||||
|
|
||||||
|
t = get_timer();
|
||||||
if (t - es->start_time < FORMAT_TIME_LIMIT)
|
if (t - es->start_time < FORMAT_TIME_LIMIT)
|
||||||
return (1);
|
return (1);
|
||||||
t -= es->start_time;
|
t -= es->start_time;
|
||||||
@@ -4211,10 +4218,11 @@ format_unescape(struct format_expand_state *es, const char *s)
|
|||||||
{
|
{
|
||||||
char *out, *cp;
|
char *out, *cp;
|
||||||
int brackets = 0;
|
int brackets = 0;
|
||||||
|
u_int check = 0;
|
||||||
|
|
||||||
cp = out = xmalloc(strlen(s) + 1);
|
cp = out = xmalloc(strlen(s) + 1);
|
||||||
for (; *s != '\0'; s++) {
|
for (; *s != '\0'; s++) {
|
||||||
if (!format_check_time(es)){
|
if (!format_check_time(es, &check)) {
|
||||||
free(out);
|
free(out);
|
||||||
return (xstrdup(""));
|
return (xstrdup(""));
|
||||||
}
|
}
|
||||||
@@ -4240,10 +4248,11 @@ format_strip(struct format_expand_state *es, const char *s)
|
|||||||
{
|
{
|
||||||
char *out, *cp;
|
char *out, *cp;
|
||||||
int brackets = 0;
|
int brackets = 0;
|
||||||
|
u_int check = 0;
|
||||||
|
|
||||||
cp = out = xmalloc(strlen(s) + 1);
|
cp = out = xmalloc(strlen(s) + 1);
|
||||||
for (; *s != '\0'; s++) {
|
for (; *s != '\0'; s++) {
|
||||||
if (!format_check_time(es)){
|
if (!format_check_time(es, &check)) {
|
||||||
free(out);
|
free(out);
|
||||||
return (xstrdup(""));
|
return (xstrdup(""));
|
||||||
}
|
}
|
||||||
@@ -4267,9 +4276,10 @@ static const char *
|
|||||||
format_skip1(struct format_expand_state *es, const char *s, const char *end)
|
format_skip1(struct format_expand_state *es, const char *s, const char *end)
|
||||||
{
|
{
|
||||||
int brackets = 0;
|
int brackets = 0;
|
||||||
|
u_int check = 0;
|
||||||
|
|
||||||
for (; *s != '\0'; s++) {
|
for (; *s != '\0'; s++) {
|
||||||
if (es != NULL && !format_check_time(es))
|
if (es != NULL && !format_check_time(es, &check))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
if (*s == '#' && s[1] == '{')
|
if (*s == '#' && s[1] == '{')
|
||||||
brackets++;
|
brackets++;
|
||||||
@@ -5059,7 +5069,7 @@ format_replace(struct format_expand_state *es, const char *key, size_t keylen,
|
|||||||
struct format_modifier *list, *cmp = NULL, *search = NULL;
|
struct format_modifier *list, *cmp = NULL, *search = NULL;
|
||||||
struct format_modifier **sub = NULL, *mexp = NULL, *fm;
|
struct format_modifier **sub = NULL, *mexp = NULL, *fm;
|
||||||
struct format_modifier *bool_op_n = NULL;
|
struct format_modifier *bool_op_n = NULL;
|
||||||
u_int i, count, nsub = 0, nrep;
|
u_int i, count, nsub = 0, nrep, check = 0;
|
||||||
struct format_expand_state next;
|
struct format_expand_state next;
|
||||||
|
|
||||||
/* Set sorting defaults. */
|
/* Set sorting defaults. */
|
||||||
@@ -5346,7 +5356,7 @@ format_replace(struct format_expand_state *es, const char *key, size_t keylen,
|
|||||||
else {
|
else {
|
||||||
value = xstrdup("");
|
value = xstrdup("");
|
||||||
for (i = 0; i < nrep; i++) {
|
for (i = 0; i < nrep; i++) {
|
||||||
if (!format_check_time(es)) {
|
if (!format_check_time(es, &check)) {
|
||||||
free(right);
|
free(right);
|
||||||
free(left);
|
free(left);
|
||||||
free(value);
|
free(value);
|
||||||
@@ -5626,7 +5636,7 @@ format_expand1(struct format_expand_state *es, const char *fmt)
|
|||||||
int ch, brackets;
|
int ch, brackets;
|
||||||
char expanded[8192];
|
char expanded[8192];
|
||||||
|
|
||||||
if (fmt == NULL || *fmt == '\0' || !format_check_time(es))
|
if (fmt == NULL || *fmt == '\0' || !format_check_time(es, NULL))
|
||||||
return (xstrdup(""));
|
return (xstrdup(""));
|
||||||
|
|
||||||
if (es->loop == FORMAT_LOOP_LIMIT) {
|
if (es->loop == FORMAT_LOOP_LIMIT) {
|
||||||
|
|||||||
4
grid.c
4
grid.c
@@ -1538,7 +1538,7 @@ grid_wrap_position(struct grid *gd, u_int px, u_int py, u_int *wx, u_int *wy)
|
|||||||
void
|
void
|
||||||
grid_unwrap_position(struct grid *gd, u_int *px, u_int *py, u_int wx, u_int wy)
|
grid_unwrap_position(struct grid *gd, u_int *px, u_int *py, u_int wx, u_int wy)
|
||||||
{
|
{
|
||||||
u_int yy, ay = 0;
|
u_int yy, ay = 0, ey = gd->hsize + gd->sy - 1;
|
||||||
|
|
||||||
for (yy = 0; yy < gd->hsize + gd->sy - 1; yy++) {
|
for (yy = 0; yy < gd->hsize + gd->sy - 1; yy++) {
|
||||||
if (ay == wy)
|
if (ay == wy)
|
||||||
@@ -1552,7 +1552,7 @@ grid_unwrap_position(struct grid *gd, u_int *px, u_int *py, u_int wx, u_int wy)
|
|||||||
* until we find the end or the line now containing wx.
|
* until we find the end or the line now containing wx.
|
||||||
*/
|
*/
|
||||||
if (wx == UINT_MAX) {
|
if (wx == UINT_MAX) {
|
||||||
while (gd->linedata[yy].flags & GRID_LINE_WRAPPED)
|
while (yy < ey && gd->linedata[yy].flags & GRID_LINE_WRAPPED)
|
||||||
yy++;
|
yy++;
|
||||||
wx = gd->linedata[yy].cellused;
|
wx = gd->linedata[yy].cellused;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
16
input.c
16
input.c
@@ -1953,16 +1953,16 @@ input_csi_dispatch_rm_private(struct input_ctx *ictx)
|
|||||||
case 2004:
|
case 2004:
|
||||||
screen_write_mode_clear(sctx, MODE_BRACKETPASTE);
|
screen_write_mode_clear(sctx, MODE_BRACKETPASTE);
|
||||||
break;
|
break;
|
||||||
|
case 2026:
|
||||||
|
screen_write_stop_sync(ictx->wp);
|
||||||
|
if (ictx->wp != NULL)
|
||||||
|
ictx->wp->flags |= PANE_REDRAW;
|
||||||
|
break;
|
||||||
case 2031:
|
case 2031:
|
||||||
screen_write_mode_clear(sctx, MODE_THEME_UPDATES);
|
screen_write_mode_clear(sctx, MODE_THEME_UPDATES);
|
||||||
if (ictx->wp != NULL)
|
if (ictx->wp != NULL)
|
||||||
ictx->wp->flags &= ~PANE_THEMECHANGED;
|
ictx->wp->flags &= ~PANE_THEMECHANGED;
|
||||||
break;
|
break;
|
||||||
case 2026: /* synchronized output */
|
|
||||||
screen_write_stop_sync(ictx->wp);
|
|
||||||
if (ictx->wp != NULL)
|
|
||||||
ictx->wp->flags |= PANE_REDRAW;
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
log_debug("%s: unknown '%c'", __func__, ictx->ch);
|
log_debug("%s: unknown '%c'", __func__, ictx->ch);
|
||||||
break;
|
break;
|
||||||
@@ -2065,7 +2065,7 @@ input_csi_dispatch_sm_private(struct input_ctx *ictx)
|
|||||||
ictx->wp->flags &= ~PANE_THEMECHANGED;
|
ictx->wp->flags &= ~PANE_THEMECHANGED;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2026: /* synchronized output */
|
case 2026:
|
||||||
screen_write_start_sync(ictx->wp);
|
screen_write_start_sync(ictx->wp);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -2822,10 +2822,10 @@ input_exit_rename(struct input_ctx *ictx)
|
|||||||
if (o != NULL)
|
if (o != NULL)
|
||||||
options_remove_or_default(o, -1, NULL);
|
options_remove_or_default(o, -1, NULL);
|
||||||
if (!options_get_number(w->options, "automatic-rename"))
|
if (!options_get_number(w->options, "automatic-rename"))
|
||||||
window_set_name(w, "", WINDOW_NAME_FORBID_EXT);
|
window_set_name(w, "", 1);
|
||||||
} else {
|
} else {
|
||||||
options_set_number(w->options, "automatic-rename", 0);
|
options_set_number(w->options, "automatic-rename", 0);
|
||||||
window_set_name(w, ictx->input_buf, WINDOW_NAME_FORBID_EXT);
|
window_set_name(w, ictx->input_buf, 1);
|
||||||
}
|
}
|
||||||
server_redraw_window_borders(w);
|
server_redraw_window_borders(w);
|
||||||
server_status_window(w);
|
server_status_window(w);
|
||||||
|
|||||||
20
layout.c
20
layout.c
@@ -359,12 +359,10 @@ layout_fix_panes(struct window *w, struct window_pane *skip)
|
|||||||
{
|
{
|
||||||
struct window_pane *wp;
|
struct window_pane *wp;
|
||||||
struct layout_cell *lc;
|
struct layout_cell *lc;
|
||||||
int status, scrollbars, sb_pos, sb_w, sb_pad;
|
int status, sb_w, sb_pad;
|
||||||
u_int sx, sy;
|
u_int sx, sy;
|
||||||
|
|
||||||
status = options_get_number(w->options, "pane-border-status");
|
status = options_get_number(w->options, "pane-border-status");
|
||||||
scrollbars = options_get_number(w->options, "pane-scrollbars");
|
|
||||||
sb_pos = options_get_number(w->options, "pane-scrollbars-position");
|
|
||||||
|
|
||||||
TAILQ_FOREACH(wp, &w->panes, entry) {
|
TAILQ_FOREACH(wp, &w->panes, entry) {
|
||||||
if ((lc = wp->layout_cell) == NULL || wp == skip)
|
if ((lc = wp->layout_cell) == NULL || wp == skip)
|
||||||
@@ -382,14 +380,14 @@ layout_fix_panes(struct window *w, struct window_pane *skip)
|
|||||||
sy--;
|
sy--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window_pane_show_scrollbar(wp, scrollbars)) {
|
if (window_pane_show_scrollbar(wp)) {
|
||||||
sb_w = wp->scrollbar_style.width;
|
sb_w = wp->scrollbar_style.width;
|
||||||
sb_pad = wp->scrollbar_style.pad;
|
sb_pad = wp->scrollbar_style.pad;
|
||||||
if (sb_w < 1)
|
if (sb_w < 1)
|
||||||
sb_w = 1;
|
sb_w = 1;
|
||||||
if (sb_pad < 0)
|
if (sb_pad < 0)
|
||||||
sb_pad = 0;
|
sb_pad = 0;
|
||||||
if (sb_pos == PANE_SCROLLBARS_LEFT) {
|
if (w->sb_pos == PANE_SCROLLBARS_LEFT) {
|
||||||
if ((int)sx - sb_w < PANE_MINIMUM) {
|
if ((int)sx - sb_w < PANE_MINIMUM) {
|
||||||
wp->xoff = wp->xoff +
|
wp->xoff = wp->xoff +
|
||||||
(int)sx - PANE_MINIMUM;
|
(int)sx - PANE_MINIMUM;
|
||||||
@@ -398,7 +396,7 @@ layout_fix_panes(struct window *w, struct window_pane *skip)
|
|||||||
sx = sx - sb_w - sb_pad;
|
sx = sx - sb_w - sb_pad;
|
||||||
wp->xoff = wp->xoff + sb_w + sb_pad;
|
wp->xoff = wp->xoff + sb_w + sb_pad;
|
||||||
}
|
}
|
||||||
} else /* sb_pos == PANE_SCROLLBARS_RIGHT */
|
} else /* w->sb_pos == PANE_SCROLLBARS_RIGHT */
|
||||||
if ((int)sx - sb_w - sb_pad < PANE_MINIMUM)
|
if ((int)sx - sb_w - sb_pad < PANE_MINIMUM)
|
||||||
sx = PANE_MINIMUM;
|
sx = PANE_MINIMUM;
|
||||||
else
|
else
|
||||||
@@ -438,16 +436,15 @@ layout_resize_check(struct window *w, struct layout_cell *lc,
|
|||||||
struct layout_cell *lcchild;
|
struct layout_cell *lcchild;
|
||||||
struct style *sb_style = &w->active->scrollbar_style;
|
struct style *sb_style = &w->active->scrollbar_style;
|
||||||
u_int available, minimum;
|
u_int available, minimum;
|
||||||
int status, scrollbars;
|
int status;
|
||||||
|
|
||||||
status = options_get_number(w->options, "pane-border-status");
|
status = options_get_number(w->options, "pane-border-status");
|
||||||
scrollbars = options_get_number(w->options, "pane-scrollbars");
|
|
||||||
|
|
||||||
if (lc->type == LAYOUT_WINDOWPANE) {
|
if (lc->type == LAYOUT_WINDOWPANE) {
|
||||||
/* Space available in this cell only. */
|
/* Space available in this cell only. */
|
||||||
if (type == LAYOUT_LEFTRIGHT) {
|
if (type == LAYOUT_LEFTRIGHT) {
|
||||||
available = lc->sx;
|
available = lc->sx;
|
||||||
if (scrollbars)
|
if (w->sb != PANE_SCROLLBARS_OFF)
|
||||||
minimum = PANE_MINIMUM + sb_style->width +
|
minimum = PANE_MINIMUM + sb_style->width +
|
||||||
sb_style->pad;
|
sb_style->pad;
|
||||||
else
|
else
|
||||||
@@ -1003,7 +1000,6 @@ layout_split_pane(struct window_pane *wp, enum layout_type type, int size,
|
|||||||
u_int sx, sy, xoff, yoff, size1, size2, minimum;
|
u_int sx, sy, xoff, yoff, size1, size2, minimum;
|
||||||
u_int new_size, saved_size, resize_first = 0;
|
u_int new_size, saved_size, resize_first = 0;
|
||||||
int full_size = (flags & SPAWN_FULLSIZE), status;
|
int full_size = (flags & SPAWN_FULLSIZE), status;
|
||||||
int scrollbars;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If full_size is specified, add a new cell at the top of the window
|
* If full_size is specified, add a new cell at the top of the window
|
||||||
@@ -1014,7 +1010,6 @@ layout_split_pane(struct window_pane *wp, enum layout_type type, int size,
|
|||||||
else
|
else
|
||||||
lc = wp->layout_cell;
|
lc = wp->layout_cell;
|
||||||
status = options_get_number(wp->window->options, "pane-border-status");
|
status = options_get_number(wp->window->options, "pane-border-status");
|
||||||
scrollbars = options_get_number(wp->window->options, "pane-scrollbars");
|
|
||||||
|
|
||||||
/* Copy the old cell size. */
|
/* Copy the old cell size. */
|
||||||
sx = lc->sx;
|
sx = lc->sx;
|
||||||
@@ -1025,7 +1020,7 @@ layout_split_pane(struct window_pane *wp, enum layout_type type, int size,
|
|||||||
/* Check there is enough space for the two new panes. */
|
/* Check there is enough space for the two new panes. */
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case LAYOUT_LEFTRIGHT:
|
case LAYOUT_LEFTRIGHT:
|
||||||
if (scrollbars) {
|
if (wp->window->sb != PANE_SCROLLBARS_OFF) {
|
||||||
minimum = PANE_MINIMUM * 2 + sb_style->width +
|
minimum = PANE_MINIMUM * 2 + sb_style->width +
|
||||||
sb_style->pad;
|
sb_style->pad;
|
||||||
} else
|
} else
|
||||||
@@ -1422,6 +1417,7 @@ layout_get_floating_cell(struct cmdq_item *item, struct args *args,
|
|||||||
w->last_new_pane_y = oy;
|
w->last_new_pane_y = oy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window_push_zoom(wp->window, 1, args_has(args, 'Z'));
|
||||||
lcnew = layout_floating_pane(w, sx, sy, ox, oy);
|
lcnew = layout_floating_pane(w, sx, sy, ox, oy);
|
||||||
return (lcnew);
|
return (lcnew);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -148,7 +148,6 @@ static const char* mode_tree_help_start[] = {
|
|||||||
"\r\033[1m T \033[0m\016x\017 \033[0mUntag all %1s\n",
|
"\r\033[1m T \033[0m\016x\017 \033[0mUntag all %1s\n",
|
||||||
"\r\033[1m C-t \033[0m\016x\017 \033[0mTag all %1s\n",
|
"\r\033[1m C-t \033[0m\016x\017 \033[0mTag all %1s\n",
|
||||||
"\r\033[1m C-s \033[0m\016x\017 \033[0mSearch forward\n",
|
"\r\033[1m C-s \033[0m\016x\017 \033[0mSearch forward\n",
|
||||||
"\r\033[1m C-r \033[0m\016x\017 \033[0mSearch backward\n",
|
|
||||||
"\r\033[1m n \033[0m\016x\017 \033[0mRepeat search forward\n",
|
"\r\033[1m n \033[0m\016x\017 \033[0mRepeat search forward\n",
|
||||||
"\r\033[1m N \033[0m\016x\017 \033[0mRepeat search backward\n",
|
"\r\033[1m N \033[0m\016x\017 \033[0mRepeat search backward\n",
|
||||||
"\r\033[1m f \033[0m\016x\017 \033[0mFilter %1s\n",
|
"\r\033[1m f \033[0m\016x\017 \033[0mFilter %1s\n",
|
||||||
|
|||||||
4
names.c
4
names.c
@@ -95,7 +95,7 @@ check_window_name(struct window *w)
|
|||||||
name = format_window_name(w);
|
name = format_window_name(w);
|
||||||
if (strcmp(name, w->name) != 0) {
|
if (strcmp(name, w->name) != 0) {
|
||||||
log_debug("@%u new name %s (was %s)", w->id, name, w->name);
|
log_debug("@%u new name %s (was %s)", w->id, name, w->name);
|
||||||
window_set_name(w, name, WINDOW_NAME_FORBID_EXT);
|
window_set_name(w, name, 1);
|
||||||
server_redraw_window_borders(w);
|
server_redraw_window_borders(w);
|
||||||
server_status_window(w);
|
server_status_window(w);
|
||||||
} else
|
} else
|
||||||
@@ -166,7 +166,7 @@ parse_window_name(const char *in)
|
|||||||
|
|
||||||
if (*name == '/')
|
if (*name == '/')
|
||||||
name = basename(name);
|
name = basename(name);
|
||||||
name = clean_name(name, WINDOW_NAME_FORBID);
|
name = clean_name(name, 0);
|
||||||
free(copy);
|
free(copy);
|
||||||
if (name == NULL)
|
if (name == NULL)
|
||||||
return (xstrdup(""));
|
return (xstrdup(""));
|
||||||
|
|||||||
@@ -1237,8 +1237,13 @@ options_push_changes(const char *name)
|
|||||||
if (strcmp(name, "pane-border-status") == 0 ||
|
if (strcmp(name, "pane-border-status") == 0 ||
|
||||||
strcmp(name, "pane-scrollbars") == 0 ||
|
strcmp(name, "pane-scrollbars") == 0 ||
|
||||||
strcmp(name, "pane-scrollbars-position") == 0) {
|
strcmp(name, "pane-scrollbars-position") == 0) {
|
||||||
RB_FOREACH(w, windows, &windows)
|
RB_FOREACH(w, windows, &windows) {
|
||||||
|
w->sb = options_get_number(w->options,
|
||||||
|
"pane-scrollbars");
|
||||||
|
w->sb_pos = options_get_number(w->options,
|
||||||
|
"pane-scrollbars-position");
|
||||||
layout_fix_panes(w, NULL);
|
layout_fix_panes(w, NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (strcmp(name, "pane-scrollbars-style") == 0) {
|
if (strcmp(name, "pane-scrollbars-style") == 0) {
|
||||||
RB_FOREACH(wp, window_pane_tree, &all_window_panes) {
|
RB_FOREACH(wp, window_pane_tree, &all_window_panes) {
|
||||||
|
|||||||
4
paste.c
4
paste.c
@@ -219,7 +219,7 @@ paste_rename(const char *oldname, const char *newname, char **cause)
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
name = clean_name(newname, "");
|
name = clean_name(newname, 0);
|
||||||
if (name == NULL) {
|
if (name == NULL) {
|
||||||
if (cause != NULL)
|
if (cause != NULL)
|
||||||
xasprintf(cause, "invalid buffer name: %s", newname);
|
xasprintf(cause, "invalid buffer name: %s", newname);
|
||||||
@@ -287,7 +287,7 @@ paste_set(char *data, size_t size, const char *name, char **cause)
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
newname = clean_name(name, "");
|
newname = clean_name(name, 0);
|
||||||
if (newname == NULL) {
|
if (newname == NULL) {
|
||||||
if (cause != NULL)
|
if (cause != NULL)
|
||||||
xasprintf(cause, "invalid buffer name: %s", name);
|
xasprintf(cause, "invalid buffer name: %s", name);
|
||||||
|
|||||||
4
popup.c
4
popup.c
@@ -110,7 +110,8 @@ popup_free(struct popup_data *pd)
|
|||||||
|
|
||||||
if (pd->job != NULL)
|
if (pd->job != NULL)
|
||||||
job_free(pd->job);
|
job_free(pd->job);
|
||||||
input_free(pd->ictx);
|
if (pd->ictx != NULL)
|
||||||
|
input_free(pd->ictx);
|
||||||
|
|
||||||
free(pd->or[0].ranges);
|
free(pd->or[0].ranges);
|
||||||
free(pd->or[1].ranges);
|
free(pd->or[1].ranges);
|
||||||
@@ -278,6 +279,7 @@ popup_check_cb(struct client* c, void *data, u_int px, u_int py, u_int nx)
|
|||||||
k++;
|
k++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
r->used = k;
|
||||||
return (r);
|
return (r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
13
proc.c
13
proc.c
@@ -31,6 +31,10 @@
|
|||||||
#include <ncurses.h>
|
#include <ncurses.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_JEMALLOC
|
||||||
|
#include <jemalloc/jemalloc.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "tmux.h"
|
#include "tmux.h"
|
||||||
|
|
||||||
struct tmuxproc {
|
struct tmuxproc {
|
||||||
@@ -180,6 +184,10 @@ proc_start(const char *name)
|
|||||||
{
|
{
|
||||||
struct tmuxproc *tp;
|
struct tmuxproc *tp;
|
||||||
struct utsname u;
|
struct utsname u;
|
||||||
|
#ifdef HAVE_JEMALLOC
|
||||||
|
const char *version;
|
||||||
|
size_t size = sizeof version;
|
||||||
|
#endif
|
||||||
|
|
||||||
log_open(name);
|
log_open(name);
|
||||||
setproctitle("%s (%s)", name, socket_path);
|
setproctitle("%s (%s)", name, socket_path);
|
||||||
@@ -194,6 +202,11 @@ proc_start(const char *name)
|
|||||||
#ifdef HAVE_UTF8PROC
|
#ifdef HAVE_UTF8PROC
|
||||||
log_debug("using utf8proc %s", utf8proc_version());
|
log_debug("using utf8proc %s", utf8proc_version());
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_JEMALLOC
|
||||||
|
if (mallctl("version", &version, &size, NULL, 0) != 0)
|
||||||
|
version = "(unknown version)";
|
||||||
|
log_debug("using jemalloc %s", version);
|
||||||
|
#endif
|
||||||
#ifdef NCURSES_VERSION
|
#ifdef NCURSES_VERSION
|
||||||
log_debug("using ncurses %s %06u", NCURSES_VERSION, NCURSES_VERSION_PATCH);
|
log_debug("using ncurses %s %06u", NCURSES_VERSION, NCURSES_VERSION_PATCH);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -123,31 +123,28 @@ static enum screen_redraw_border_type
|
|||||||
screen_redraw_pane_border(struct screen_redraw_ctx *ctx, struct window_pane *wp,
|
screen_redraw_pane_border(struct screen_redraw_ctx *ctx, struct window_pane *wp,
|
||||||
int px, int py)
|
int px, int py)
|
||||||
{
|
{
|
||||||
struct options *oo = wp->window->options;
|
struct window *w = wp->window;
|
||||||
|
struct options *oo = w->options;
|
||||||
int ex = wp->xoff + wp->sx, ey = wp->yoff + wp->sy;
|
int ex = wp->xoff + wp->sx, ey = wp->yoff + wp->sy;
|
||||||
int hsplit = 0, vsplit = 0, pane_status = ctx->pane_status;
|
int hsplit = 0, vsplit = 0, pane_status = ctx->pane_status;
|
||||||
int pane_scrollbars = ctx->pane_scrollbars, sb_w = 0;
|
int sb_w = 0;
|
||||||
int sb_pos, sx = wp->sx, sy = wp->sy, left, right;
|
int sx = wp->sx, sy = wp->sy, left, right;
|
||||||
enum layout_type split_type;
|
enum layout_type split_type;
|
||||||
|
|
||||||
if (pane_scrollbars != 0)
|
|
||||||
sb_pos = ctx->pane_scrollbars_pos;
|
|
||||||
else
|
|
||||||
sb_pos = 0;
|
|
||||||
|
|
||||||
/* Inside pane. */
|
/* Inside pane. */
|
||||||
if (px >= wp->xoff && px < ex && py >= wp->yoff && py < ey)
|
if (px >= wp->xoff && px < ex && py >= wp->yoff && py < ey)
|
||||||
return (SCREEN_REDRAW_INSIDE);
|
return (SCREEN_REDRAW_INSIDE);
|
||||||
|
|
||||||
/* Are scrollbars enabled? */
|
/* Are scrollbars enabled? */
|
||||||
if (window_pane_show_scrollbar(wp, pane_scrollbars))
|
if (window_pane_show_scrollbar(wp))
|
||||||
sb_w = wp->scrollbar_style.width + wp->scrollbar_style.pad;
|
sb_w = wp->scrollbar_style.width + wp->scrollbar_style.pad;
|
||||||
|
|
||||||
/* Floating pane borders. */
|
/* Floating pane borders. */
|
||||||
if (window_pane_is_floating(wp)) {
|
if (window_pane_is_floating(wp)) {
|
||||||
left = wp->xoff - 1;
|
left = wp->xoff - 1;
|
||||||
right = wp->xoff + sx;
|
right = wp->xoff + sx;
|
||||||
if (sb_pos == PANE_SCROLLBARS_LEFT)
|
if (w->sb != PANE_SCROLLBARS_OFF &&
|
||||||
|
w->sb_pos == PANE_SCROLLBARS_LEFT)
|
||||||
left -= sb_w;
|
left -= sb_w;
|
||||||
else
|
else
|
||||||
right += sb_w;
|
right += sb_w;
|
||||||
@@ -182,7 +179,8 @@ screen_redraw_pane_border(struct screen_redraw_ctx *ctx, struct window_pane *wp,
|
|||||||
* active window's border when there are two panes.
|
* active window's border when there are two panes.
|
||||||
*/
|
*/
|
||||||
if ((wp->yoff == 0 || py >= wp->yoff - 1) && py <= ey) {
|
if ((wp->yoff == 0 || py >= wp->yoff - 1) && py <= ey) {
|
||||||
if (sb_pos == PANE_SCROLLBARS_LEFT) {
|
if (w->sb != PANE_SCROLLBARS_OFF &&
|
||||||
|
w->sb_pos == PANE_SCROLLBARS_LEFT) {
|
||||||
if (wp->xoff - sb_w == 0 && px == sx + sb_w) {
|
if (wp->xoff - sb_w == 0 && px == sx + sb_w) {
|
||||||
if (!hsplit || (hsplit && py <= sy / 2))
|
if (!hsplit || (hsplit && py <= sy / 2))
|
||||||
return (SCREEN_REDRAW_BORDER_RIGHT);
|
return (SCREEN_REDRAW_BORDER_RIGHT);
|
||||||
@@ -194,7 +192,7 @@ screen_redraw_pane_border(struct screen_redraw_ctx *ctx, struct window_pane *wp,
|
|||||||
if (px == wp->xoff + sx + sb_w - 1)
|
if (px == wp->xoff + sx + sb_w - 1)
|
||||||
return (SCREEN_REDRAW_BORDER_RIGHT);
|
return (SCREEN_REDRAW_BORDER_RIGHT);
|
||||||
}
|
}
|
||||||
} else { /* sb_pos == PANE_SCROLLBARS_RIGHT or disabled */
|
} else { /* w->sb_pos == PANE_SCROLLBARS_RIGHT or disabled */
|
||||||
if (wp->xoff == 0 && px == sx + sb_w) {
|
if (wp->xoff == 0 && px == sx + sb_w) {
|
||||||
if (!hsplit || (hsplit && py <= sy / 2))
|
if (!hsplit || (hsplit && py <= sy / 2))
|
||||||
return (SCREEN_REDRAW_BORDER_RIGHT);
|
return (SCREEN_REDRAW_BORDER_RIGHT);
|
||||||
@@ -216,7 +214,8 @@ screen_redraw_pane_border(struct screen_redraw_ctx *ctx, struct window_pane *wp,
|
|||||||
if (wp->yoff != 0 && py == wp->yoff - 1 && px > sx / 2)
|
if (wp->yoff != 0 && py == wp->yoff - 1 && px > sx / 2)
|
||||||
return (SCREEN_REDRAW_BORDER_TOP);
|
return (SCREEN_REDRAW_BORDER_TOP);
|
||||||
} else {
|
} else {
|
||||||
if (sb_pos == PANE_SCROLLBARS_LEFT) {
|
if (w->sb != PANE_SCROLLBARS_OFF &&
|
||||||
|
w->sb_pos == PANE_SCROLLBARS_LEFT) {
|
||||||
if ((wp->xoff - sb_w == 0 || px >= wp->xoff - sb_w) &&
|
if ((wp->xoff - sb_w == 0 || px >= wp->xoff - sb_w) &&
|
||||||
(px <= ex || (sb_w != 0 && px < ex + sb_w))) {
|
(px <= ex || (sb_w != 0 && px < ex + sb_w))) {
|
||||||
if (pane_status != PANE_STATUS_BOTTOM &&
|
if (pane_status != PANE_STATUS_BOTTOM &&
|
||||||
@@ -225,7 +224,7 @@ screen_redraw_pane_border(struct screen_redraw_ctx *ctx, struct window_pane *wp,
|
|||||||
if (pane_status != PANE_STATUS_TOP && py == ey)
|
if (pane_status != PANE_STATUS_TOP && py == ey)
|
||||||
return (SCREEN_REDRAW_BORDER_BOTTOM);
|
return (SCREEN_REDRAW_BORDER_BOTTOM);
|
||||||
}
|
}
|
||||||
} else { /* sb_pos == PANE_SCROLLBARS_RIGHT */
|
} else { /* w->sb_pos == PANE_SCROLLBARS_RIGHT */
|
||||||
if ((wp->xoff == 0 || px >= wp->xoff) &&
|
if ((wp->xoff == 0 || px >= wp->xoff) &&
|
||||||
(px <= ex || (sb_w != 0 && px < ex + sb_w))) {
|
(px <= ex || (sb_w != 0 && px < ex + sb_w))) {
|
||||||
if (pane_status != PANE_STATUS_BOTTOM &&
|
if (pane_status != PANE_STATUS_BOTTOM &&
|
||||||
@@ -278,17 +277,15 @@ screen_redraw_cell_border(struct screen_redraw_ctx *ctx, struct window_pane *wp,
|
|||||||
struct client *c = ctx->c;
|
struct client *c = ctx->c;
|
||||||
struct window *w = c->session->curw->window;
|
struct window *w = c->session->curw->window;
|
||||||
struct window_pane *wp2;
|
struct window_pane *wp2;
|
||||||
int sx = w->sx, sy = w->sy, sb_w, sb_pos, n;
|
int sx = w->sx, sy = w->sy, sb_w, n;
|
||||||
|
|
||||||
if (ctx->pane_scrollbars != 0)
|
|
||||||
sb_pos = ctx->pane_scrollbars_pos;
|
|
||||||
else
|
|
||||||
sb_pos = 0;
|
|
||||||
sb_w = wp->scrollbar_style.width + wp->scrollbar_style.pad;
|
sb_w = wp->scrollbar_style.width + wp->scrollbar_style.pad;
|
||||||
|
|
||||||
/* For floating panes, only check the pane itself. */
|
/* For floating panes, only check the pane itself. */
|
||||||
if (window_pane_is_floating(wp)) {
|
if (window_pane_is_floating(wp)) {
|
||||||
n = screen_redraw_cell_border1(ctx, sb_pos, sb_w, wp, px, py);
|
n = screen_redraw_cell_border1(ctx,
|
||||||
|
w->sb != PANE_SCROLLBARS_OFF ? w->sb_pos : 0,
|
||||||
|
sb_w, wp, px, py);
|
||||||
if (n == -1)
|
if (n == -1)
|
||||||
return (0);
|
return (0);
|
||||||
return (n);
|
return (n);
|
||||||
@@ -311,7 +308,9 @@ screen_redraw_cell_border(struct screen_redraw_ctx *ctx, struct window_pane *wp,
|
|||||||
TAILQ_FOREACH(wp2, &w->z_index, zentry) {
|
TAILQ_FOREACH(wp2, &w->z_index, zentry) {
|
||||||
if (!window_pane_visible(wp2) || window_pane_is_floating(wp2))
|
if (!window_pane_visible(wp2) || window_pane_is_floating(wp2))
|
||||||
continue;
|
continue;
|
||||||
n = screen_redraw_cell_border1(ctx, sb_pos, sb_w, wp2, px, py);
|
n = screen_redraw_cell_border1(ctx,
|
||||||
|
w->sb != PANE_SCROLLBARS_OFF ? w->sb_pos : 0,
|
||||||
|
sb_w, wp2, px, py);
|
||||||
if (n != -1)
|
if (n != -1)
|
||||||
return (n);
|
return (n);
|
||||||
}
|
}
|
||||||
@@ -435,9 +434,9 @@ screen_redraw_check_cell(struct screen_redraw_ctx *ctx, int px, int py,
|
|||||||
struct window_pane *wp, *start;
|
struct window_pane *wp, *start;
|
||||||
int sx = w->sx, sy = w->sy;
|
int sx = w->sx, sy = w->sy;
|
||||||
int pane_status = ctx->pane_status;
|
int pane_status = ctx->pane_status;
|
||||||
int border, pane_scrollbars = ctx->pane_scrollbars;
|
int border;
|
||||||
int pane_status_line, tiled_only = 0, left, right;
|
int pane_status_line, tiled_only = 0, left, right;
|
||||||
int sb_pos = ctx->pane_scrollbars_pos, sb_w;
|
int sb_w;
|
||||||
|
|
||||||
*wpp = NULL;
|
*wpp = NULL;
|
||||||
|
|
||||||
@@ -452,7 +451,8 @@ screen_redraw_check_cell(struct screen_redraw_ctx *ctx, int px, int py,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
sb_w = wp->scrollbar_style.width + wp->scrollbar_style.pad;
|
sb_w = wp->scrollbar_style.width + wp->scrollbar_style.pad;
|
||||||
if (sb_pos == PANE_SCROLLBARS_LEFT) {
|
if (w->sb != PANE_SCROLLBARS_OFF &&
|
||||||
|
w->sb_pos == PANE_SCROLLBARS_LEFT) {
|
||||||
if ((px >= wp->xoff - 1 - sb_w &&
|
if ((px >= wp->xoff - 1 - sb_w &&
|
||||||
px <= wp->xoff + (int)wp->sx) &&
|
px <= wp->xoff + (int)wp->sx) &&
|
||||||
(py >= wp->yoff - 1 &&
|
(py >= wp->yoff - 1 &&
|
||||||
@@ -492,7 +492,8 @@ screen_redraw_check_cell(struct screen_redraw_ctx *ctx, int px, int py,
|
|||||||
*wpp = wp;
|
*wpp = wp;
|
||||||
|
|
||||||
sb_w = wp->scrollbar_style.width + wp->scrollbar_style.pad;
|
sb_w = wp->scrollbar_style.width + wp->scrollbar_style.pad;
|
||||||
if (sb_pos == PANE_SCROLLBARS_LEFT) {
|
if (w->sb != PANE_SCROLLBARS_OFF &&
|
||||||
|
w->sb_pos == PANE_SCROLLBARS_LEFT) {
|
||||||
if ((px < wp->xoff - 1 - sb_w ||
|
if ((px < wp->xoff - 1 - sb_w ||
|
||||||
px > wp->xoff + (int)wp->sx) &&
|
px > wp->xoff + (int)wp->sx) &&
|
||||||
(py < wp->yoff - 1 ||
|
(py < wp->yoff - 1 ||
|
||||||
@@ -524,7 +525,7 @@ screen_redraw_check_cell(struct screen_redraw_ctx *ctx, int px, int py,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Check if CELL_SCROLLBAR. */
|
/* Check if CELL_SCROLLBAR. */
|
||||||
if (window_pane_show_scrollbar(wp, pane_scrollbars)) {
|
if (window_pane_show_scrollbar(wp)) {
|
||||||
/*
|
/*
|
||||||
* Check if py could lie within a scrollbar. If the
|
* Check if py could lie within a scrollbar. If the
|
||||||
* pane is at the top then py == 0 to sy; if the pane
|
* pane is at the top then py == 0 to sy; if the pane
|
||||||
@@ -536,10 +537,10 @@ screen_redraw_check_cell(struct screen_redraw_ctx *ctx, int px, int py,
|
|||||||
(py >= wp->yoff &&
|
(py >= wp->yoff &&
|
||||||
py < wp->yoff + (int)wp->sy)) {
|
py < wp->yoff + (int)wp->sy)) {
|
||||||
/* Check if px lies within a scrollbar. */
|
/* Check if px lies within a scrollbar. */
|
||||||
if ((sb_pos == PANE_SCROLLBARS_RIGHT &&
|
if ((w->sb_pos == PANE_SCROLLBARS_RIGHT &&
|
||||||
(px >= wp->xoff + (int)wp->sx &&
|
(px >= wp->xoff + (int)wp->sx &&
|
||||||
px < wp->xoff + (int)wp->sx + sb_w)) ||
|
px < wp->xoff + (int)wp->sx + sb_w)) ||
|
||||||
(sb_pos == PANE_SCROLLBARS_LEFT &&
|
(w->sb_pos == PANE_SCROLLBARS_LEFT &&
|
||||||
(px >= wp->xoff - sb_w &&
|
(px >= wp->xoff - sb_w &&
|
||||||
px < wp->xoff)))
|
px < wp->xoff)))
|
||||||
return (CELL_SCROLLBAR);
|
return (CELL_SCROLLBAR);
|
||||||
@@ -593,13 +594,12 @@ screen_redraw_make_pane_status(struct client *c, struct window_pane *wp,
|
|||||||
struct style_line_entry *sle = &wp->border_status_line;
|
struct style_line_entry *sle = &wp->border_status_line;
|
||||||
char *expanded;
|
char *expanded;
|
||||||
int pane_status = rctx->pane_status, sb_w = 0;
|
int pane_status = rctx->pane_status, sb_w = 0;
|
||||||
int pane_scrollbars = rctx->pane_scrollbars;
|
|
||||||
int max_width;
|
int max_width;
|
||||||
u_int width, i, cell_type, px, py;
|
u_int width, i, cell_type, px, py;
|
||||||
struct screen_write_ctx ctx;
|
struct screen_write_ctx ctx;
|
||||||
struct screen old;
|
struct screen old;
|
||||||
|
|
||||||
if (window_pane_show_scrollbar(wp, pane_scrollbars))
|
if (window_pane_show_scrollbar(wp))
|
||||||
sb_w = wp->scrollbar_style.width + wp->scrollbar_style.pad;
|
sb_w = wp->scrollbar_style.width + wp->scrollbar_style.pad;
|
||||||
|
|
||||||
ft = format_create(c, NULL, FORMAT_PANE|wp->id, FORMAT_STATUS);
|
ft = format_create(c, NULL, FORMAT_PANE|wp->id, FORMAT_STATUS);
|
||||||
@@ -791,10 +791,6 @@ screen_redraw_set_context(struct client *c, struct screen_redraw_ctx *ctx)
|
|||||||
ctx->pane_status = options_get_number(wo, "pane-border-status");
|
ctx->pane_status = options_get_number(wo, "pane-border-status");
|
||||||
ctx->pane_lines = options_get_number(wo, "pane-border-lines");
|
ctx->pane_lines = options_get_number(wo, "pane-border-lines");
|
||||||
|
|
||||||
ctx->pane_scrollbars = options_get_number(wo, "pane-scrollbars");
|
|
||||||
ctx->pane_scrollbars_pos = options_get_number(wo,
|
|
||||||
"pane-scrollbars-position");
|
|
||||||
|
|
||||||
tty_window_offset(&c->tty, &ctx->ox, &ctx->oy, &ctx->sx, &ctx->sy);
|
tty_window_offset(&c->tty, &ctx->ox, &ctx->oy, &ctx->sx, &ctx->sy);
|
||||||
|
|
||||||
log_debug("%s: %s @%u ox=%u oy=%u sx=%u sy=%u %u/%d", __func__, c->name,
|
log_debug("%s: %s @%u ox=%u oy=%u sx=%u sy=%u %u/%d", __func__, c->name,
|
||||||
@@ -863,7 +859,7 @@ screen_redraw_pane(struct client *c, struct window_pane *wp,
|
|||||||
if (!redraw_scrollbar_only)
|
if (!redraw_scrollbar_only)
|
||||||
screen_redraw_draw_pane(&ctx, wp);
|
screen_redraw_draw_pane(&ctx, wp);
|
||||||
|
|
||||||
if (window_pane_show_scrollbar(wp, ctx.pane_scrollbars))
|
if (window_pane_show_scrollbar(wp))
|
||||||
screen_redraw_draw_pane_scrollbar(&ctx, wp);
|
screen_redraw_draw_pane_scrollbar(&ctx, wp);
|
||||||
|
|
||||||
tty_reset(&c->tty);
|
tty_reset(&c->tty);
|
||||||
@@ -1142,7 +1138,7 @@ screen_redraw_get_visible_ranges(struct window_pane *base_wp, int px,
|
|||||||
struct window *w;
|
struct window *w;
|
||||||
struct visible_range *ri;
|
struct visible_range *ri;
|
||||||
static struct visible_ranges sr = { NULL, 0, 0 };
|
static struct visible_ranges sr = { NULL, 0, 0 };
|
||||||
int found_self, sb, sb_w, sb_pos;
|
int found_self, sb_w;
|
||||||
int lb, rb, tb, bb, sx, ex;
|
int lb, rb, tb, bb, sx, ex;
|
||||||
u_int i, s;
|
u_int i, s;
|
||||||
|
|
||||||
@@ -1182,9 +1178,6 @@ screen_redraw_get_visible_ranges(struct window_pane *base_wp, int px,
|
|||||||
r->used = 1;
|
r->used = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
sb = options_get_number(w->options, "pane-scrollbars");
|
|
||||||
sb_pos = options_get_number(w->options, "pane-scrollbars-position");
|
|
||||||
|
|
||||||
found_self = 0;
|
found_self = 0;
|
||||||
TAILQ_FOREACH_REVERSE(wp, &w->z_index, window_panes_zindex, zentry) {
|
TAILQ_FOREACH_REVERSE(wp, &w->z_index, window_panes_zindex, zentry) {
|
||||||
if (wp == base_wp) {
|
if (wp == base_wp) {
|
||||||
@@ -1203,12 +1196,14 @@ screen_redraw_get_visible_ranges(struct window_pane *base_wp, int px,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
sb_w = wp->scrollbar_style.width + wp->scrollbar_style.pad;
|
sb_w = wp->scrollbar_style.width + wp->scrollbar_style.pad;
|
||||||
if (!window_pane_show_scrollbar(wp, sb))
|
if (!window_pane_show_scrollbar(wp))
|
||||||
sb_w = sb_pos = 0;
|
sb_w = 0;
|
||||||
|
|
||||||
for (i = 0; i < r->used; i++) {
|
for (i = 0; i < r->used; i++) {
|
||||||
ri = &r->ranges[i];
|
ri = &r->ranges[i];
|
||||||
if (sb_pos == PANE_SCROLLBARS_LEFT) {
|
if (ri->nx == 0)
|
||||||
|
continue;
|
||||||
|
if (w->sb_pos == PANE_SCROLLBARS_LEFT) {
|
||||||
if (wp->xoff > sb_w)
|
if (wp->xoff > sb_w)
|
||||||
lb = wp->xoff - 1 - sb_w;
|
lb = wp->xoff - 1 - sb_w;
|
||||||
else
|
else
|
||||||
@@ -1219,12 +1214,14 @@ screen_redraw_get_visible_ranges(struct window_pane *base_wp, int px,
|
|||||||
else
|
else
|
||||||
lb = 0;
|
lb = 0;
|
||||||
}
|
}
|
||||||
if (sb_pos == PANE_SCROLLBARS_LEFT)
|
if (w->sb_pos == PANE_SCROLLBARS_LEFT)
|
||||||
rb = wp->xoff + wp->sx;
|
rb = wp->xoff + wp->sx;
|
||||||
else /* PANE_SCROLLBARS_RIGHT or none. */
|
else /* PANE_SCROLLBARS_RIGHT or none. */
|
||||||
rb = wp->xoff + wp->sx + sb_w;
|
rb = wp->xoff + wp->sx + sb_w;
|
||||||
if (rb > (int)w->sx)
|
if (rb > (int)w->sx)
|
||||||
rb = w->sx - 1;
|
rb = w->sx - 1;
|
||||||
|
if (lb > rb)
|
||||||
|
continue;
|
||||||
|
|
||||||
sx = ri->px;
|
sx = ri->px;
|
||||||
ex = sx + ri->nx - 1;
|
ex = sx + ri->nx - 1;
|
||||||
@@ -1407,7 +1404,7 @@ screen_redraw_draw_pane_scrollbars(struct screen_redraw_ctx *ctx)
|
|||||||
log_debug("%s: %s @%u", __func__, c->name, w->id);
|
log_debug("%s: %s @%u", __func__, c->name, w->id);
|
||||||
|
|
||||||
TAILQ_FOREACH(wp, &w->panes, entry) {
|
TAILQ_FOREACH(wp, &w->panes, entry) {
|
||||||
if (window_pane_show_scrollbar(wp, ctx->pane_scrollbars) &&
|
if (window_pane_show_scrollbar(wp) &&
|
||||||
window_pane_visible(wp))
|
window_pane_visible(wp))
|
||||||
screen_redraw_draw_pane_scrollbar(ctx, wp);
|
screen_redraw_draw_pane_scrollbar(ctx, wp);
|
||||||
}
|
}
|
||||||
@@ -1420,8 +1417,8 @@ screen_redraw_draw_pane_scrollbar(struct screen_redraw_ctx *ctx,
|
|||||||
{
|
{
|
||||||
struct screen *s = wp->screen;
|
struct screen *s = wp->screen;
|
||||||
double percent_view;
|
double percent_view;
|
||||||
u_int sb = ctx->pane_scrollbars, total_height, sb_h = wp->sy;
|
u_int sb = wp->window->sb, total_height, sb_h = wp->sy;
|
||||||
u_int sb_pos = ctx->pane_scrollbars_pos, slider_h, slider_y;
|
u_int sb_pos = wp->window->sb_pos, slider_h, slider_y;
|
||||||
int sb_w = wp->scrollbar_style.width;
|
int sb_w = wp->scrollbar_style.width;
|
||||||
int sb_pad = wp->scrollbar_style.pad;
|
int sb_pad = wp->scrollbar_style.pad;
|
||||||
int cm_y, cm_size, xoff = wp->xoff;
|
int cm_y, cm_size, xoff = wp->xoff;
|
||||||
|
|||||||
10
screen.c
10
screen.c
@@ -249,10 +249,7 @@ screen_set_title(struct screen *s, const char *title, int untrusted)
|
|||||||
{
|
{
|
||||||
char *new_title;
|
char *new_title;
|
||||||
|
|
||||||
if (untrusted)
|
new_title = clean_name(title, untrusted);
|
||||||
new_title = clean_name(title, "#");
|
|
||||||
else
|
|
||||||
new_title = clean_name(title, "");
|
|
||||||
if (new_title == NULL)
|
if (new_title == NULL)
|
||||||
return (0);
|
return (0);
|
||||||
free(s->title);
|
free(s->title);
|
||||||
@@ -266,10 +263,7 @@ screen_set_path(struct screen *s, const char *path, int untrusted)
|
|||||||
{
|
{
|
||||||
char *new_path;
|
char *new_path;
|
||||||
|
|
||||||
if (untrusted)
|
new_path = clean_name(path, untrusted);
|
||||||
new_path = clean_name(path, "#");
|
|
||||||
else
|
|
||||||
new_path = clean_name(path, "");
|
|
||||||
if (new_path == NULL)
|
if (new_path == NULL)
|
||||||
return (0);
|
return (0);
|
||||||
free(s->path);
|
free(s->path);
|
||||||
|
|||||||
@@ -603,17 +603,14 @@ server_client_check_mouse_in_pane(struct window_pane *wp, int px, int py,
|
|||||||
u_int *sl_mpos)
|
u_int *sl_mpos)
|
||||||
{
|
{
|
||||||
struct window *w = wp->window;
|
struct window *w = wp->window;
|
||||||
struct options *wo = w->options;
|
|
||||||
struct window_pane *fwp;
|
struct window_pane *fwp;
|
||||||
int pane_status, sb, sb_pos, sb_w, sb_pad;
|
int pane_status, sb_w, sb_pad;
|
||||||
int pane_status_line, sl_top, sl_bottom;
|
int pane_status_line, sl_top, sl_bottom;
|
||||||
int bdr_bottom, bdr_top, bdr_left, bdr_right;
|
int bdr_bottom, bdr_top, bdr_left, bdr_right;
|
||||||
|
|
||||||
sb = options_get_number(wo, "pane-scrollbars");
|
pane_status = options_get_number(w->options, "pane-border-status");
|
||||||
sb_pos = options_get_number(wo, "pane-scrollbars-position");
|
|
||||||
pane_status = options_get_number(wo, "pane-border-status");
|
|
||||||
|
|
||||||
if (window_pane_show_scrollbar(wp, sb)) {
|
if (window_pane_show_scrollbar(wp)) {
|
||||||
sb_w = wp->scrollbar_style.width;
|
sb_w = wp->scrollbar_style.width;
|
||||||
sb_pad = wp->scrollbar_style.pad;
|
sb_pad = wp->scrollbar_style.pad;
|
||||||
} else {
|
} else {
|
||||||
@@ -628,7 +625,7 @@ server_client_check_mouse_in_pane(struct window_pane *wp, int px, int py,
|
|||||||
else
|
else
|
||||||
pane_status_line = -1; /* not used */
|
pane_status_line = -1; /* not used */
|
||||||
bdr_left = wp->xoff - 1;
|
bdr_left = wp->xoff - 1;
|
||||||
if (sb_pos == PANE_SCROLLBARS_LEFT)
|
if (w->sb_pos == PANE_SCROLLBARS_LEFT)
|
||||||
bdr_left -= sb_pad + sb_w;
|
bdr_left -= sb_pad + sb_w;
|
||||||
|
|
||||||
/* Check if point is within the pane or scrollbar. */
|
/* Check if point is within the pane or scrollbar. */
|
||||||
@@ -636,15 +633,15 @@ server_client_check_mouse_in_pane(struct window_pane *wp, int px, int py,
|
|||||||
py != pane_status_line && py != wp->yoff + (int)wp->sy) ||
|
py != pane_status_line && py != wp->yoff + (int)wp->sy) ||
|
||||||
(wp->yoff == 0 && py < (int)wp->sy) ||
|
(wp->yoff == 0 && py < (int)wp->sy) ||
|
||||||
(py >= wp->yoff && py < wp->yoff + (int)wp->sy)) &&
|
(py >= wp->yoff && py < wp->yoff + (int)wp->sy)) &&
|
||||||
((sb_pos == PANE_SCROLLBARS_RIGHT &&
|
((w->sb_pos == PANE_SCROLLBARS_RIGHT &&
|
||||||
px < wp->xoff + (int)wp->sx + sb_pad + sb_w) ||
|
px < wp->xoff + (int)wp->sx + sb_pad + sb_w) ||
|
||||||
(sb_pos == PANE_SCROLLBARS_LEFT &&
|
(w->sb_pos == PANE_SCROLLBARS_LEFT &&
|
||||||
px < wp->xoff + (int)wp->sx - sb_pad - sb_w))) {
|
px < wp->xoff + (int)wp->sx - sb_pad - sb_w))) {
|
||||||
/* Check if in the scrollbar. */
|
/* Check if in the scrollbar. */
|
||||||
if ((sb_pos == PANE_SCROLLBARS_RIGHT &&
|
if ((w->sb_pos == PANE_SCROLLBARS_RIGHT &&
|
||||||
(px >= wp->xoff + (int)wp->sx + sb_pad &&
|
(px >= wp->xoff + (int)wp->sx + sb_pad &&
|
||||||
px < wp->xoff + (int)wp->sx + sb_pad + sb_w)) ||
|
px < wp->xoff + (int)wp->sx + sb_pad + sb_w)) ||
|
||||||
(sb_pos == PANE_SCROLLBARS_LEFT &&
|
(w->sb_pos == PANE_SCROLLBARS_LEFT &&
|
||||||
(px >= wp->xoff - sb_pad - sb_w &&
|
(px >= wp->xoff - sb_pad - sb_w &&
|
||||||
px < wp->xoff - sb_pad))) {
|
px < wp->xoff - sb_pad))) {
|
||||||
/* Check where inside the scrollbar. */
|
/* Check where inside the scrollbar. */
|
||||||
@@ -674,7 +671,7 @@ server_client_check_mouse_in_pane(struct window_pane *wp, int px, int py,
|
|||||||
if ((w->flags & WINDOW_ZOOMED) &&
|
if ((w->flags & WINDOW_ZOOMED) &&
|
||||||
(~fwp->flags & PANE_ZOOMED))
|
(~fwp->flags & PANE_ZOOMED))
|
||||||
continue;
|
continue;
|
||||||
if (window_pane_show_scrollbar(fwp, sb)) {
|
if (window_pane_show_scrollbar(fwp)) {
|
||||||
sb_w = fwp->scrollbar_style.width;
|
sb_w = fwp->scrollbar_style.width;
|
||||||
sb_pad = fwp->scrollbar_style.pad;
|
sb_pad = fwp->scrollbar_style.pad;
|
||||||
} else {
|
} else {
|
||||||
@@ -684,7 +681,7 @@ server_client_check_mouse_in_pane(struct window_pane *wp, int px, int py,
|
|||||||
bdr_top = fwp->yoff - 1;
|
bdr_top = fwp->yoff - 1;
|
||||||
bdr_bottom = fwp->yoff + fwp->sy;
|
bdr_bottom = fwp->yoff + fwp->sy;
|
||||||
bdr_left = fwp->xoff - 1;
|
bdr_left = fwp->xoff - 1;
|
||||||
if (sb_pos == PANE_SCROLLBARS_LEFT) {
|
if (w->sb_pos == PANE_SCROLLBARS_LEFT) {
|
||||||
bdr_left -= sb_pad + sb_w;
|
bdr_left -= sb_pad + sb_w;
|
||||||
bdr_right = fwp->xoff + fwp->sx;
|
bdr_right = fwp->xoff + fwp->sx;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -438,6 +438,7 @@ server_destroy_session(struct session *s)
|
|||||||
{
|
{
|
||||||
struct client *c;
|
struct client *c;
|
||||||
struct session *s_new = NULL, *cs_new = NULL, *use_s;
|
struct session *s_new = NULL, *cs_new = NULL, *use_s;
|
||||||
|
struct sort_criteria sort_crit = { .order = SORT_NAME };
|
||||||
int detach_on_destroy;
|
int detach_on_destroy;
|
||||||
|
|
||||||
detach_on_destroy = options_get_number(s->options, "detach-on-destroy");
|
detach_on_destroy = options_get_number(s->options, "detach-on-destroy");
|
||||||
@@ -446,9 +447,11 @@ server_destroy_session(struct session *s)
|
|||||||
else if (detach_on_destroy == 2)
|
else if (detach_on_destroy == 2)
|
||||||
s_new = server_find_session(s, server_newer_detached_session);
|
s_new = server_find_session(s, server_newer_detached_session);
|
||||||
else if (detach_on_destroy == 3)
|
else if (detach_on_destroy == 3)
|
||||||
s_new = session_previous_session(s, NULL);
|
s_new = session_previous_session(s, &sort_crit);
|
||||||
else if (detach_on_destroy == 4)
|
else if (detach_on_destroy == 4)
|
||||||
s_new = session_next_session(s, NULL);
|
s_new = session_next_session(s, &sort_crit);
|
||||||
|
if (s_new == s)
|
||||||
|
s_new = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If no suitable new session was found above, then look for any
|
* If no suitable new session was found above, then look for any
|
||||||
|
|||||||
2
spawn.c
2
spawn.c
@@ -177,7 +177,7 @@ spawn_window(struct spawn_context *sc, char **cause)
|
|||||||
/* Set the name of the new window. */
|
/* Set the name of the new window. */
|
||||||
if (~sc->flags & SPAWN_RESPAWN) {
|
if (~sc->flags & SPAWN_RESPAWN) {
|
||||||
free(w->name);
|
free(w->name);
|
||||||
if (sc->name == NULL || *sc->name == '\0')
|
if (sc->name == NULL)
|
||||||
w->name = default_window_name(w);
|
w->name = default_window_name(w);
|
||||||
else {
|
else {
|
||||||
w->name = xstrdup(sc->name);
|
w->name = xstrdup(sc->name);
|
||||||
|
|||||||
2
status.c
2
status.c
@@ -630,7 +630,7 @@ status_message_redraw(struct client *c)
|
|||||||
status_prompt_area(c, &ax, &aw);
|
status_prompt_area(c, &ax, &aw);
|
||||||
|
|
||||||
ft = format_create_defaults(NULL, c, NULL, NULL, NULL);
|
ft = format_create_defaults(NULL, c, NULL, NULL, NULL);
|
||||||
memcpy(&gc, &grid_default_cell, sizeof gc);
|
style_apply(&gc, s->options, "message-style", ft);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set #{message} in the format tree. If styles should be ignored in
|
* Set #{message} in the format tree. If styles should be ignored in
|
||||||
|
|||||||
21
tmux.c
21
tmux.c
@@ -282,15 +282,15 @@ get_timer(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
clean_name(const char *name, const char* forbid)
|
clean_name(const char *name, int untrusted)
|
||||||
{
|
{
|
||||||
char *copy, *cp, *new_name;
|
char *copy, *cp, *new_name;
|
||||||
|
|
||||||
if (*name == '\0' || !utf8_isvalid(name))
|
if (!utf8_isvalid(name))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
copy = xstrdup(name);
|
copy = xstrdup(name);
|
||||||
for (cp = copy; *cp != '\0'; cp++) {
|
for (cp = copy; *cp != '\0'; cp++) {
|
||||||
if (strchr(forbid, *cp) != NULL)
|
if (untrusted && cp[0] == '#' && cp[1] == '(')
|
||||||
*cp = '_';
|
*cp = '_';
|
||||||
}
|
}
|
||||||
utf8_stravis(&new_name, copy, VIS_OCTAL|VIS_CSTYLE|VIS_TAB|VIS_NL);
|
utf8_stravis(&new_name, copy, VIS_OCTAL|VIS_CSTYLE|VIS_TAB|VIS_NL);
|
||||||
@@ -298,22 +298,11 @@ clean_name(const char *name, const char* forbid)
|
|||||||
return (new_name);
|
return (new_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Check a name given by a command: reject it if it is empty, not valid UTF-8,
|
|
||||||
* or contains a forbidden character. Other characters that clean_name would
|
|
||||||
* change (for example with utf8_stravis) are allowed and fixed silently.
|
|
||||||
*/
|
|
||||||
int
|
int
|
||||||
check_name(const char *name, const char *forbid)
|
check_name(const char *name)
|
||||||
{
|
{
|
||||||
const char *cp;
|
if (!utf8_isvalid(name))
|
||||||
|
|
||||||
if (*name == '\0' || !utf8_isvalid(name))
|
|
||||||
return (0);
|
return (0);
|
||||||
for (cp = name; *cp != '\0'; cp++) {
|
|
||||||
if (strchr(forbid, *cp) != NULL)
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
17
tmux.h
17
tmux.h
@@ -96,12 +96,6 @@ struct winlink;
|
|||||||
#define TMUX_LOCK_CMD "lock -np"
|
#define TMUX_LOCK_CMD "lock -np"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Forbidden characters in names. */
|
|
||||||
#define WINDOW_NAME_FORBID ":."
|
|
||||||
#define WINDOW_NAME_FORBID_EXT ":.#"
|
|
||||||
#define SESSION_NAME_FORBID ":."
|
|
||||||
#define SESSION_NAME_FORBID_EXT ":.#"
|
|
||||||
|
|
||||||
/* Minimum layout cell size, NOT including border lines. */
|
/* Minimum layout cell size, NOT including border lines. */
|
||||||
#define PANE_MINIMUM 1
|
#define PANE_MINIMUM 1
|
||||||
|
|
||||||
@@ -1396,6 +1390,9 @@ struct window {
|
|||||||
u_int last_new_pane_x;
|
u_int last_new_pane_x;
|
||||||
u_int last_new_pane_y;
|
u_int last_new_pane_y;
|
||||||
|
|
||||||
|
int sb;
|
||||||
|
int sb_pos;
|
||||||
|
|
||||||
struct utf8_data *fill_character;
|
struct utf8_data *fill_character;
|
||||||
int flags;
|
int flags;
|
||||||
#define WINDOW_BELL 0x1
|
#define WINDOW_BELL 0x1
|
||||||
@@ -2409,8 +2406,8 @@ int checkshell(const char *);
|
|||||||
void setblocking(int, int);
|
void setblocking(int, int);
|
||||||
char *shell_argv0(const char *, int);
|
char *shell_argv0(const char *, int);
|
||||||
uint64_t get_timer(void);
|
uint64_t get_timer(void);
|
||||||
char *clean_name(const char *, const char *);
|
char *clean_name(const char *, int);
|
||||||
int check_name(const char *, const char *);
|
int check_name(const char *);
|
||||||
const char *sig2name(int);
|
const char *sig2name(int);
|
||||||
const char *find_cwd(void);
|
const char *find_cwd(void);
|
||||||
const char *find_home(void);
|
const char *find_home(void);
|
||||||
@@ -3487,7 +3484,7 @@ void window_pane_stack_push(struct window_panes *,
|
|||||||
struct window_pane *);
|
struct window_pane *);
|
||||||
void window_pane_stack_remove(struct window_panes *,
|
void window_pane_stack_remove(struct window_panes *,
|
||||||
struct window_pane *);
|
struct window_pane *);
|
||||||
void window_set_name(struct window *, const char *, const char *);
|
void window_set_name(struct window *, const char *, int);
|
||||||
void window_add_ref(struct window *, const char *);
|
void window_add_ref(struct window *, const char *);
|
||||||
void window_remove_ref(struct window *, const char *);
|
void window_remove_ref(struct window *, const char *);
|
||||||
void winlink_clear_flags(struct winlink *);
|
void winlink_clear_flags(struct winlink *);
|
||||||
@@ -3501,7 +3498,7 @@ void window_pane_update_used_data(struct window_pane *,
|
|||||||
void window_set_fill_character(struct window *);
|
void window_set_fill_character(struct window *);
|
||||||
void window_pane_default_cursor(struct window_pane *);
|
void window_pane_default_cursor(struct window_pane *);
|
||||||
int window_pane_mode(struct window_pane *);
|
int window_pane_mode(struct window_pane *);
|
||||||
int window_pane_show_scrollbar(struct window_pane *, int);
|
int window_pane_show_scrollbar(struct window_pane *);
|
||||||
int window_pane_get_bg(struct window_pane *);
|
int window_pane_get_bg(struct window_pane *);
|
||||||
int window_pane_get_fg(struct window_pane *);
|
int window_pane_get_fg(struct window_pane *);
|
||||||
int window_pane_get_fg_control_client(struct window_pane *);
|
int window_pane_get_fg_control_client(struct window_pane *);
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ const struct window_mode window_client_mode = {
|
|||||||
|
|
||||||
struct window_client_itemdata {
|
struct window_client_itemdata {
|
||||||
struct client *c;
|
struct client *c;
|
||||||
|
char *ttyname;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct window_client_modedata {
|
struct window_client_modedata {
|
||||||
@@ -110,6 +111,7 @@ static void
|
|||||||
window_client_free_item(struct window_client_itemdata *item)
|
window_client_free_item(struct window_client_itemdata *item)
|
||||||
{
|
{
|
||||||
server_client_unref(item->c);
|
server_client_unref(item->c);
|
||||||
|
free(item->ttyname);
|
||||||
free(item);
|
free(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,6 +139,7 @@ window_client_build(void *modedata, struct sort_criteria *sort_crit,
|
|||||||
|
|
||||||
item = window_client_add_item(data);
|
item = window_client_add_item(data);
|
||||||
item->c = l[i];
|
item->c = l[i];
|
||||||
|
item->ttyname = xstrdup(l[i]->ttyname);
|
||||||
|
|
||||||
l[i]->references++;
|
l[i]->references++;
|
||||||
}
|
}
|
||||||
@@ -381,7 +384,7 @@ window_client_key(struct window_mode_entry *wme, struct client *c,
|
|||||||
break;
|
break;
|
||||||
case '\r':
|
case '\r':
|
||||||
item = mode_tree_get_current(mtd);
|
item = mode_tree_get_current(mtd);
|
||||||
mode_tree_run_command(c, NULL, data->command, item->c->ttyname);
|
mode_tree_run_command(c, NULL, data->command, item->ttyname);
|
||||||
finished = 1;
|
finished = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -254,6 +254,7 @@ window_tree_build_window(struct session *s, struct winlink *wl,
|
|||||||
u_int n, i;
|
u_int n, i;
|
||||||
int expanded;
|
int expanded;
|
||||||
struct format_tree *ft;
|
struct format_tree *ft;
|
||||||
|
uint64_t tag = FORMAT_NONE;
|
||||||
|
|
||||||
item = window_tree_add_item(data);
|
item = window_tree_add_item(data);
|
||||||
item->type = WINDOW_TREE_WINDOW;
|
item->type = WINDOW_TREE_WINDOW;
|
||||||
@@ -261,7 +262,9 @@ window_tree_build_window(struct session *s, struct winlink *wl,
|
|||||||
item->winlink = wl->idx;
|
item->winlink = wl->idx;
|
||||||
item->pane = -1;
|
item->pane = -1;
|
||||||
|
|
||||||
ft = format_create(NULL, NULL, FORMAT_PANE|wl->window->active->id, 0);
|
if (wl->window != NULL && wl->window->active != NULL)
|
||||||
|
tag = FORMAT_PANE|wl->window->active->id;
|
||||||
|
ft = format_create(NULL, NULL, tag, 0);
|
||||||
format_defaults(ft, NULL, s, wl, NULL);
|
format_defaults(ft, NULL, s, wl, NULL);
|
||||||
text = format_expand(ft, data->format);
|
text = format_expand(ft, data->format);
|
||||||
xasprintf(&name, "%u", wl->idx);
|
xasprintf(&name, "%u", wl->idx);
|
||||||
@@ -313,6 +316,7 @@ window_tree_build_session(struct session *s, void *modedata,
|
|||||||
u_int n, i, empty;
|
u_int n, i, empty;
|
||||||
int expanded;
|
int expanded;
|
||||||
struct format_tree *ft;
|
struct format_tree *ft;
|
||||||
|
uint64_t tag = FORMAT_NONE;
|
||||||
|
|
||||||
item = window_tree_add_item(data);
|
item = window_tree_add_item(data);
|
||||||
item->type = WINDOW_TREE_SESSION;
|
item->type = WINDOW_TREE_SESSION;
|
||||||
@@ -320,7 +324,9 @@ window_tree_build_session(struct session *s, void *modedata,
|
|||||||
item->winlink = -1;
|
item->winlink = -1;
|
||||||
item->pane = -1;
|
item->pane = -1;
|
||||||
|
|
||||||
ft = format_create(NULL, NULL, FORMAT_PANE|wl->window->active->id, 0);
|
if (wl != NULL && wl->window != NULL && wl->window->active != NULL)
|
||||||
|
tag = FORMAT_PANE|wl->window->active->id;
|
||||||
|
ft = format_create(NULL, NULL, tag, 0);
|
||||||
format_defaults(ft, NULL, s, NULL, NULL);
|
format_defaults(ft, NULL, s, NULL, NULL);
|
||||||
text = format_expand(ft, data->format);
|
text = format_expand(ft, data->format);
|
||||||
format_free(ft);
|
format_free(ft);
|
||||||
|
|||||||
26
window.c
26
window.c
@@ -321,6 +321,8 @@ window_create(u_int sx, u_int sy, u_int xpixel, u_int ypixel)
|
|||||||
w->ypixel = ypixel;
|
w->ypixel = ypixel;
|
||||||
|
|
||||||
w->options = options_create(global_w_options);
|
w->options = options_create(global_w_options);
|
||||||
|
w->sb = options_get_number(w->options, "pane-scrollbars");
|
||||||
|
w->sb_pos = options_get_number(w->options, "pane-scrollbars-position");
|
||||||
|
|
||||||
w->references = 0;
|
w->references = 0;
|
||||||
TAILQ_INIT(&w->winlinks);
|
TAILQ_INIT(&w->winlinks);
|
||||||
@@ -401,11 +403,11 @@ window_remove_ref(struct window *w, const char *from)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
window_set_name(struct window *w, const char *new_name, const char *forbid)
|
window_set_name(struct window *w, const char *new_name, int untrusted)
|
||||||
{
|
{
|
||||||
char *name;
|
char *name;
|
||||||
|
|
||||||
name = clean_name(new_name, forbid);
|
name = clean_name(new_name, untrusted);
|
||||||
if (name != NULL) {
|
if (name != NULL) {
|
||||||
free(w->name);
|
free(w->name);
|
||||||
w->name = name;
|
w->name = name;
|
||||||
@@ -1471,20 +1473,16 @@ window_pane_full_size_offset(struct window_pane *wp, int *xoff, int *yoff,
|
|||||||
u_int *sx, u_int *sy)
|
u_int *sx, u_int *sy)
|
||||||
{
|
{
|
||||||
struct window *w = wp->window;
|
struct window *w = wp->window;
|
||||||
int pane_scrollbars;
|
u_int sb_w;
|
||||||
u_int sb_w, sb_pos;
|
|
||||||
|
|
||||||
pane_scrollbars = options_get_number(w->options, "pane-scrollbars");
|
if (window_pane_show_scrollbar(wp))
|
||||||
sb_pos = options_get_number(w->options, "pane-scrollbars-position");
|
|
||||||
|
|
||||||
if (window_pane_show_scrollbar(wp, pane_scrollbars))
|
|
||||||
sb_w = wp->scrollbar_style.width + wp->scrollbar_style.pad;
|
sb_w = wp->scrollbar_style.width + wp->scrollbar_style.pad;
|
||||||
else
|
else
|
||||||
sb_w = 0;
|
sb_w = 0;
|
||||||
if (sb_pos == PANE_SCROLLBARS_LEFT) {
|
if (w->sb_pos == PANE_SCROLLBARS_LEFT) {
|
||||||
*xoff = wp->xoff - sb_w;
|
*xoff = wp->xoff - sb_w;
|
||||||
*sx = wp->sx + sb_w;
|
*sx = wp->sx + sb_w;
|
||||||
} else { /* sb_pos == PANE_SCROLLBARS_RIGHT */
|
} else { /* w->sb_pos == PANE_SCROLLBARS_RIGHT */
|
||||||
*xoff = wp->xoff;
|
*xoff = wp->xoff;
|
||||||
*sx = wp->sx + sb_w;
|
*sx = wp->sx + sb_w;
|
||||||
}
|
}
|
||||||
@@ -1899,12 +1897,14 @@ window_pane_mode(struct window_pane *wp)
|
|||||||
|
|
||||||
/* Return 1 if scrollbar is or should be displayed. */
|
/* Return 1 if scrollbar is or should be displayed. */
|
||||||
int
|
int
|
||||||
window_pane_show_scrollbar(struct window_pane *wp, int sb_option)
|
window_pane_show_scrollbar(struct window_pane *wp)
|
||||||
{
|
{
|
||||||
|
struct window *w = wp->window;
|
||||||
|
|
||||||
if (SCREEN_IS_ALTERNATE(&wp->base))
|
if (SCREEN_IS_ALTERNATE(&wp->base))
|
||||||
return (0);
|
return (0);
|
||||||
if (sb_option == PANE_SCROLLBARS_ALWAYS ||
|
if (w->sb == PANE_SCROLLBARS_ALWAYS ||
|
||||||
(sb_option == PANE_SCROLLBARS_MODAL &&
|
(w->sb == PANE_SCROLLBARS_MODAL &&
|
||||||
window_pane_mode(wp) != WINDOW_PANE_NO_MODE))
|
window_pane_mode(wp) != WINDOW_PANE_NO_MODE))
|
||||||
return (1);
|
return (1);
|
||||||
return (0);
|
return (0);
|
||||||
|
|||||||
Reference in New Issue
Block a user