mirror of
https://github.com/tmux/tmux.git
synced 2025-01-12 03:08:46 +00:00
Merge branch 'obsd-master'
This commit is contained in:
commit
52e3d960e7
2
client.c
2
client.c
@ -646,7 +646,7 @@ client_read_open(void *data, size_t datalen)
|
||||
struct msg_read_done reply;
|
||||
struct client_file find, *cf;
|
||||
const int flags = O_NONBLOCK|O_RDONLY;
|
||||
int error = 0;
|
||||
int error;
|
||||
|
||||
if (datalen < sizeof *msg)
|
||||
fatalx("bad MSG_READ_OPEN size");
|
||||
|
22
cmd-find.c
22
cmd-find.c
@ -1230,29 +1230,31 @@ no_pane:
|
||||
static struct client *
|
||||
cmd_find_current_client(struct cmdq_item *item, int quiet)
|
||||
{
|
||||
struct client *c;
|
||||
struct client *c = NULL, *found;
|
||||
struct session *s;
|
||||
struct window_pane *wp;
|
||||
struct cmd_find_state fs;
|
||||
|
||||
if (item->client != NULL && item->client->session != NULL)
|
||||
return (item->client);
|
||||
if (item != NULL)
|
||||
c = item->client;
|
||||
if (c != NULL && c->session != NULL)
|
||||
return (c);
|
||||
|
||||
c = NULL;
|
||||
if ((wp = cmd_find_inside_pane(item->client)) != NULL) {
|
||||
found = NULL;
|
||||
if (c != NULL && (wp = cmd_find_inside_pane(c)) != NULL) {
|
||||
cmd_find_clear_state(&fs, CMD_FIND_QUIET);
|
||||
fs.w = wp->window;
|
||||
if (cmd_find_best_session_with_window(&fs) == 0)
|
||||
c = cmd_find_best_client(fs.s);
|
||||
found = cmd_find_best_client(fs.s);
|
||||
} else {
|
||||
s = cmd_find_best_session(NULL, 0, CMD_FIND_QUIET);
|
||||
if (s != NULL)
|
||||
c = cmd_find_best_client(s);
|
||||
found = cmd_find_best_client(s);
|
||||
}
|
||||
if (c == NULL && !quiet)
|
||||
if (found == NULL && item != NULL && !quiet)
|
||||
cmdq_error(item, "no current client");
|
||||
log_debug("%s: no target, return %p", __func__, c);
|
||||
return (c);
|
||||
log_debug("%s: no target, return %p", __func__, found);
|
||||
return (found);
|
||||
}
|
||||
|
||||
/* Find the target client or report an error and return NULL. */
|
||||
|
@ -269,7 +269,7 @@ cmd_list_keys_exec(struct cmd *self, struct cmdq_item *item)
|
||||
tmpsize *= 2;
|
||||
tmp = xrealloc(tmp, tmpsize);
|
||||
}
|
||||
tmpused = strlcat(tmp, cp, tmpsize);
|
||||
strlcat(tmp, cp, tmpsize);
|
||||
tmpused = strlcat(tmp, " ", tmpsize);
|
||||
free(cp);
|
||||
|
||||
@ -279,7 +279,7 @@ cmd_list_keys_exec(struct cmd *self, struct cmdq_item *item)
|
||||
tmpsize *= 2;
|
||||
tmp = xrealloc(tmp, tmpsize);
|
||||
}
|
||||
tmpused = strlcat(tmp, cp, tmpsize);
|
||||
strlcat(tmp, cp, tmpsize);
|
||||
tmpused = strlcat(tmp, " ", tmpsize);
|
||||
free(cp);
|
||||
|
||||
|
@ -207,7 +207,8 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item)
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else
|
||||
dsx = 80;
|
||||
if (args_has(args, 'y')) {
|
||||
tmp = args_get(args, 'y');
|
||||
if (strcmp(tmp, "-") == 0) {
|
||||
@ -222,7 +223,8 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item)
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else
|
||||
dsy = 24;
|
||||
|
||||
/* Find new session size. */
|
||||
if (!detached && !is_control) {
|
||||
@ -233,13 +235,14 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item)
|
||||
} else {
|
||||
tmp = options_get_string(global_s_options, "default-size");
|
||||
if (sscanf(tmp, "%ux%u", &sx, &sy) != 2) {
|
||||
sx = 80;
|
||||
sy = 24;
|
||||
}
|
||||
if (args_has(args, 'x'))
|
||||
sx = dsx;
|
||||
if (args_has(args, 'y'))
|
||||
sy = dsy;
|
||||
} else {
|
||||
if (args_has(args, 'x'))
|
||||
sx = dsx;
|
||||
if (args_has(args, 'y'))
|
||||
sy = dsy;
|
||||
}
|
||||
}
|
||||
if (sx == 0)
|
||||
sx = 1;
|
||||
|
@ -152,7 +152,7 @@ cmd_send_keys_exec(struct cmd *self, struct cmdq_item *item)
|
||||
return (CMD_RETURN_ERROR);
|
||||
}
|
||||
if (wme != NULL && (args_has(args, 'X') || args->argc == 0)) {
|
||||
if (wme == NULL || wme->mode->command == NULL) {
|
||||
if (wme->mode->command == NULL) {
|
||||
cmdq_error(item, "not in a mode");
|
||||
return (CMD_RETURN_ERROR);
|
||||
}
|
||||
|
@ -211,11 +211,9 @@ cmd_show_options_all(struct cmd *self, struct cmdq_item *item, int scope,
|
||||
|
||||
if ((self->entry != &cmd_show_hooks_entry &&
|
||||
!args_has(self->args, 'H') &&
|
||||
oe != NULL &&
|
||||
(oe->flags & OPTIONS_TABLE_IS_HOOK)) ||
|
||||
(self->entry == &cmd_show_hooks_entry &&
|
||||
(oe == NULL ||
|
||||
(~oe->flags & OPTIONS_TABLE_IS_HOOK))))
|
||||
(~oe->flags & OPTIONS_TABLE_IS_HOOK)))
|
||||
continue;
|
||||
|
||||
o = options_get_only(oo, oe->name);
|
||||
|
@ -73,7 +73,6 @@ cmd_switch_client_exec(struct cmd *self, struct cmdq_item *item)
|
||||
return (CMD_RETURN_ERROR);
|
||||
s = item->target.s;
|
||||
wl = item->target.wl;
|
||||
w = wl->window;
|
||||
wp = item->target.wp;
|
||||
|
||||
if (args_has(args, 'r'))
|
||||
@ -115,6 +114,7 @@ cmd_switch_client_exec(struct cmd *self, struct cmdq_item *item)
|
||||
if (item->client == NULL)
|
||||
return (CMD_RETURN_NORMAL);
|
||||
if (wl != NULL && wp != NULL) {
|
||||
w = wl->window;
|
||||
if (window_push_zoom(w, args_has(self->args, 'Z')))
|
||||
server_redraw_window(w);
|
||||
window_redraw_active_switch(w, wp);
|
||||
|
6
format.c
6
format.c
@ -900,11 +900,12 @@ static void
|
||||
format_cb_pane_at_top(struct format_tree *ft, struct format_entry *fe)
|
||||
{
|
||||
struct window_pane *wp = ft->wp;
|
||||
struct window *w = wp->window;
|
||||
struct window *w;
|
||||
int status, flag;
|
||||
|
||||
if (wp == NULL)
|
||||
return;
|
||||
w = wp->window;
|
||||
|
||||
status = options_get_number(w->options, "pane-border-status");
|
||||
if (status == PANE_STATUS_TOP)
|
||||
@ -919,11 +920,12 @@ static void
|
||||
format_cb_pane_at_bottom(struct format_tree *ft, struct format_entry *fe)
|
||||
{
|
||||
struct window_pane *wp = ft->wp;
|
||||
struct window *w = wp->window;
|
||||
struct window *w;
|
||||
int status, flag;
|
||||
|
||||
if (wp == NULL)
|
||||
return;
|
||||
w = wp->window;
|
||||
|
||||
status = options_get_number(w->options, "pane-border-status");
|
||||
if (status == PANE_STATUS_BOTTOM)
|
||||
|
8
grid.c
8
grid.c
@ -1343,17 +1343,13 @@ grid_wrap_position(struct grid *gd, u_int px, u_int py, u_int *wx, u_int *wy)
|
||||
void
|
||||
grid_unwrap_position(struct grid *gd, u_int *px, u_int *py, u_int wx, u_int wy)
|
||||
{
|
||||
u_int yy, ax = 0, ay = 0;
|
||||
u_int yy, ay = 0;
|
||||
|
||||
for (yy = 0; yy < gd->hsize + gd->sy - 1; yy++) {
|
||||
if (ay == wy)
|
||||
break;
|
||||
if (gd->linedata[yy].flags & GRID_LINE_WRAPPED)
|
||||
ax += gd->linedata[yy].cellused;
|
||||
else {
|
||||
ax = 0;
|
||||
if (~gd->linedata[yy].flags & GRID_LINE_WRAPPED)
|
||||
ay++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -229,10 +229,8 @@ key_string_lookup_string(const char *string)
|
||||
key -= 64;
|
||||
else if (key == 32)
|
||||
key = 0;
|
||||
else if (key == '?')
|
||||
key = 127;
|
||||
else if (key == 63)
|
||||
key = KEYC_BSPACE;
|
||||
key = 127;
|
||||
else
|
||||
return (KEYC_UNKNOWN);
|
||||
modifiers &= ~KEYC_CTRL;
|
||||
|
3
regsub.c
3
regsub.c
@ -24,8 +24,7 @@
|
||||
#include "tmux.h"
|
||||
|
||||
static void
|
||||
regsub_copy(char **buf, size_t *len, const char *text, size_t start,
|
||||
size_t end)
|
||||
regsub_copy(char **buf, size_t *len, const char *text, size_t start, size_t end)
|
||||
{
|
||||
size_t add = end - start;
|
||||
|
||||
|
@ -604,10 +604,9 @@ have_event:
|
||||
wp = window_get_active_at(s->curw->window, px, py);
|
||||
if (wp != NULL)
|
||||
where = PANE;
|
||||
else
|
||||
return (KEYC_UNKNOWN);
|
||||
}
|
||||
|
||||
if (where == NOWHERE)
|
||||
return (KEYC_UNKNOWN);
|
||||
if (where == PANE)
|
||||
log_debug("mouse %u,%u on pane %%%u", x, y, wp->id);
|
||||
else if (where == BORDER)
|
||||
@ -1541,7 +1540,7 @@ server_client_reset_state(struct client *c)
|
||||
struct window_pane *wp = w->active, *loop;
|
||||
struct screen *s;
|
||||
struct options *oo = c->session->options;
|
||||
int mode, cursor = 0;
|
||||
int mode, cursor;
|
||||
u_int cx = 0, cy = 0, ox, oy, sx, sy;
|
||||
|
||||
if (c->flags & (CLIENT_CONTROL|CLIENT_SUSPENDED))
|
||||
|
1
tmux.h
1
tmux.h
@ -2471,7 +2471,6 @@ void screen_select_cell(struct screen *, struct grid_cell *,
|
||||
void screen_alternate_on(struct screen *, struct grid_cell *, int);
|
||||
void screen_alternate_off(struct screen *, struct grid_cell *, int);
|
||||
|
||||
|
||||
/* window.c */
|
||||
extern struct windows windows;
|
||||
extern struct window_pane_tree all_window_panes;
|
||||
|
@ -347,9 +347,8 @@ window_buffer_do_paste(void *modedata, void *itemdata, struct client *c,
|
||||
{
|
||||
struct window_buffer_modedata *data = modedata;
|
||||
struct window_buffer_itemdata *item = itemdata;
|
||||
struct paste_buffer *pb;
|
||||
|
||||
if ((pb = paste_get_name(item->name)) != NULL)
|
||||
if (paste_get_name(item->name) != NULL)
|
||||
mode_tree_run_command(c, NULL, data->command, item->name);
|
||||
}
|
||||
|
||||
|
@ -1055,14 +1055,15 @@ window_copy_cmd_history_bottom(struct window_copy_cmd_state *cs)
|
||||
{
|
||||
struct window_mode_entry *wme = cs->wme;
|
||||
struct window_copy_mode_data *data = wme->data;
|
||||
struct screen *s = data->backing;
|
||||
u_int oy;
|
||||
|
||||
oy = screen_hsize(data->backing) + data->cy - data->oy;
|
||||
oy = screen_hsize(s) + data->cy - data->oy;
|
||||
if (data->lineflag == LINE_SEL_RIGHT_LEFT && oy == data->endsely)
|
||||
window_copy_other_end(wme);
|
||||
|
||||
data->cy = screen_size_y(&data->screen) - 1;
|
||||
data->cx = window_copy_find_length(wme, data->cy);
|
||||
data->cx = window_copy_find_length(wme, screen_hsize(s) + data->cy);
|
||||
data->oy = 0;
|
||||
|
||||
if (data->searchmark != NULL && !data->timeout)
|
||||
@ -4151,7 +4152,6 @@ window_copy_cursor_previous_word_pos(struct window_mode_entry *wme,
|
||||
data->oy >=
|
||||
screen_hsize(data->backing) - 1))
|
||||
goto out;
|
||||
py--;
|
||||
|
||||
py = screen_hsize(data->backing) + data->cy -
|
||||
data->oy;
|
||||
@ -4360,7 +4360,7 @@ window_copy_start_drag(struct client *c, struct mouse_event *m)
|
||||
data->selflag = SEL_CHAR;
|
||||
switch (data->selflag) {
|
||||
case SEL_WORD:
|
||||
if (data->ws) {
|
||||
if (data->ws != NULL) {
|
||||
window_copy_update_cursor(wme, x, y);
|
||||
window_copy_cursor_previous_word_pos(wme,
|
||||
data->ws, 0, &x, &y);
|
||||
|
2
window.c
2
window.c
@ -1223,7 +1223,7 @@ window_pane_search(struct window_pane *wp, const char *term, int regex,
|
||||
}
|
||||
log_debug("%s: %s", __func__, line);
|
||||
if (!regex)
|
||||
found = (fnmatch(new, line, 0) == 0);
|
||||
found = (fnmatch(new, line, flags) == 0);
|
||||
else
|
||||
found = (regexec(&r, line, 0, NULL, 0) == 0);
|
||||
free(line);
|
||||
|
Loading…
Reference in New Issue
Block a user