Skip to content

Commit

Permalink
Merge branch 'obsd-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasAdam committed Apr 27, 2023
2 parents 0ff991b + 8f34504 commit 9d8131c
Show file tree
Hide file tree
Showing 12 changed files with 170 additions and 110 deletions.
6 changes: 3 additions & 3 deletions file.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ file_fire_read(struct client_file *cf)
int
file_can_print(struct client *c)
{
if (c == NULL)
return (0);
if (c->session != NULL && (~c->flags & CLIENT_CONTROL))
if (c == NULL ||
(c->flags & CLIENT_ATTACHED) ||
(c->flags & CLIENT_CONTROL))
return (0);
return (1);
}
Expand Down
15 changes: 15 additions & 0 deletions format.c
Original file line number Diff line number Diff line change
Expand Up @@ -1885,6 +1885,18 @@ format_cb_pane_input_off(struct format_tree *ft)
return (NULL);
}

/* Callback for pane_unseen_changes. */
static void *
format_cb_pane_unseen_changes(struct format_tree *ft)
{
if (ft->wp != NULL) {
if (ft->wp->flags & PANE_UNSEENCHANGES)
return (xstrdup("1"));
return (xstrdup("0"));
}
return (NULL);
}

/* Callback for pane_last. */
static void *
format_cb_pane_last(struct format_tree *ft)
Expand Down Expand Up @@ -2953,6 +2965,9 @@ static const struct format_table_entry format_table[] = {
{ "pane_tty", FORMAT_TABLE_STRING,
format_cb_pane_tty
},
{ "pane_unseen_changes", FORMAT_TABLE_STRING,
format_cb_pane_unseen_changes
},
{ "pane_width", FORMAT_TABLE_STRING,
format_cb_pane_width
},
Expand Down
4 changes: 4 additions & 0 deletions input.c
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,10 @@ input_parse_buffer(struct window_pane *wp, u_char *buf, size_t len)
window_update_activity(wp->window);
wp->flags |= PANE_CHANGED;

/* Flag new input while in a mode. */
if (!TAILQ_EMPTY(&wp->modes))
wp->flags |= PANE_UNSEENCHANGES;

/* NULL wp if there is a mode set as don't want to update the tty. */
if (TAILQ_EMPTY(&wp->modes))
screen_write_start_pane(sctx, wp, &wp->base);
Expand Down
6 changes: 6 additions & 0 deletions screen-write.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@ screen_write_set_client_cb(struct tty_ctx *ttyctx, struct client *c)
{
struct window_pane *wp = ttyctx->arg;

if (ttyctx->allow_invisible_panes) {
if (session_has(c->session, wp->window))
return (1);
return (0);
}

if (c->session->curw->window != wp->window)
return (0);
if (wp->layout_cell == NULL)
Expand Down
2 changes: 0 additions & 2 deletions status.c
Original file line number Diff line number Diff line change
Expand Up @@ -1471,8 +1471,6 @@ status_prompt_key(struct client *c, key_code key)
return (0);

append_key:
if (key <= 0x1f || (key >= KEYC_BASE && key < KEYC_BASE_END))
return (0);
if (key <= 0x7f)
utf8_set(&tmp, key);
else if (KEYC_IS_UNICODE(key))
Expand Down
6 changes: 5 additions & 1 deletion tmux.1
Original file line number Diff line number Diff line change
Expand Up @@ -1281,7 +1281,10 @@ behave like
.Ic attach-session
if
.Ar session-name
already exists; in this case,
already exists;
if
.Fl A
is given,
.Fl D
behaves like
.Fl d
Expand Down Expand Up @@ -5260,6 +5263,7 @@ The following variables are available, where appropriate:
.It Li "pane_title" Ta "#T" Ta "Title of pane (can be set by application)"
.It Li "pane_top" Ta "" Ta "Top of pane"
.It Li "pane_tty" Ta "" Ta "Pseudo terminal of pane"
.It Li "pane_unseen_changes" Ta "" Ta "1 if there were changes in pane while in mode"
.It Li "pane_width" Ta "" Ta "Width of pane"
.It Li "pid" Ta "" Ta "Server PID"
.It Li "rectangle_toggle" Ta "" Ta "1 if rectangle selection is activated"
Expand Down
2 changes: 1 addition & 1 deletion tmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ main(int argc, char **argv)
cfg_quiet = 0;
break;
case 'V':
printf("%s %s\n", getprogname(), getversion());
printf("tmux %s\n", getversion());
exit(0);
case 'l':
flags |= CLIENT_LOGIN;
Expand Down
31 changes: 17 additions & 14 deletions tmux.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,9 @@ struct winlink;
#define KEYC_IS_UNICODE(key) \
(((key) & KEYC_MASK_KEY) > 0x7f && \
(((key) & KEYC_MASK_KEY) < KEYC_BASE || \
((key) & KEYC_MASK_KEY) >= KEYC_BASE_END))
((key) & KEYC_MASK_KEY) >= KEYC_BASE_END) && \
(((key) & KEYC_MASK_KEY) < KEYC_USER || \
((key) & KEYC_MASK_KEY) >= KEYC_USER + KEYC_NUSER))

/* Multiple click timeout. */
#define KEYC_CLICK_TIMEOUT 300
Expand Down Expand Up @@ -1049,6 +1051,7 @@ struct window_pane {
#define PANE_STATUSDRAWN 0x400
#define PANE_EMPTY 0x800
#define PANE_STYLECHANGED 0x1000
#define PANE_UNSEENCHANGES 0x2000

int argc;
char **argv;
Expand Down Expand Up @@ -2297,12 +2300,12 @@ void tty_margin_off(struct tty *);
void tty_cursor(struct tty *, u_int, u_int);
void tty_clipboard_query(struct tty *);
void tty_putcode(struct tty *, enum tty_code_code);
void tty_putcode1(struct tty *, enum tty_code_code, int);
void tty_putcode2(struct tty *, enum tty_code_code, int, int);
void tty_putcode3(struct tty *, enum tty_code_code, int, int, int);
void tty_putcode_ptr1(struct tty *, enum tty_code_code, const void *);
void tty_putcode_ptr2(struct tty *, enum tty_code_code, const void *,
const void *);
void tty_putcode_i(struct tty *, enum tty_code_code, int);
void tty_putcode_ii(struct tty *, enum tty_code_code, int, int);
void tty_putcode_iii(struct tty *, enum tty_code_code, int, int, int);
void tty_putcode_s(struct tty *, enum tty_code_code, const char *);
void tty_putcode_ss(struct tty *, enum tty_code_code, const char *,
const char *);
void tty_puts(struct tty *, const char *);
void tty_putc(struct tty *, u_char);
void tty_putn(struct tty *, const void *, size_t, u_int);
Expand Down Expand Up @@ -2366,15 +2369,15 @@ int tty_term_read_list(const char *, int, char ***, u_int *,
void tty_term_free_list(char **, u_int);
int tty_term_has(struct tty_term *, enum tty_code_code);
const char *tty_term_string(struct tty_term *, enum tty_code_code);
const char *tty_term_string1(struct tty_term *, enum tty_code_code, int);
const char *tty_term_string2(struct tty_term *, enum tty_code_code, int,
const char *tty_term_string_i(struct tty_term *, enum tty_code_code, int);
const char *tty_term_string_ii(struct tty_term *, enum tty_code_code, int,
int);
const char *tty_term_string3(struct tty_term *, enum tty_code_code, int,
const char *tty_term_string_iii(struct tty_term *, enum tty_code_code, int,
int, int);
const char *tty_term_ptr1(struct tty_term *, enum tty_code_code,
const void *);
const char *tty_term_ptr2(struct tty_term *, enum tty_code_code,
const void *, const void *);
const char *tty_term_string_s(struct tty_term *, enum tty_code_code,
const char *);
const char *tty_term_string_ss(struct tty_term *, enum tty_code_code,
const char *, const char *);
int tty_term_number(struct tty_term *, enum tty_code_code);
int tty_term_flag(struct tty_term *, enum tty_code_code);
const char *tty_term_describe(struct tty_term *, enum tty_code_code);
Expand Down
7 changes: 4 additions & 3 deletions tty-keys.c
Original file line number Diff line number Diff line change
Expand Up @@ -1008,7 +1008,8 @@ tty_keys_extended_key(struct tty *tty, const char *buf, size_t len,

/*
* Handle mouse key input. Returns 0 for success, -1 for failure, 1 for partial
* (probably a mouse sequence but need more data).
* (probably a mouse sequence but need more data), -2 if an invalid mouse
* sequence.
*/
static int
tty_keys_mouse(struct tty *tty, const char *buf, size_t len, size_t *size,
Expand Down Expand Up @@ -1069,7 +1070,7 @@ tty_keys_mouse(struct tty *tty, const char *buf, size_t len, size_t *size,
if (b < MOUSE_PARAM_BTN_OFF ||
x < MOUSE_PARAM_POS_OFF ||
y < MOUSE_PARAM_POS_OFF)
return (-1);
return (-2);
b -= MOUSE_PARAM_BTN_OFF;
x -= MOUSE_PARAM_POS_OFF;
y -= MOUSE_PARAM_POS_OFF;
Expand Down Expand Up @@ -1111,7 +1112,7 @@ tty_keys_mouse(struct tty *tty, const char *buf, size_t len, size_t *size,

/* Check and return the mouse input. */
if (x < 1 || y < 1)
return (-1);
return (-2);
x--;
y--;
b = sgr_b;
Expand Down
47 changes: 36 additions & 11 deletions tty-term.c
Original file line number Diff line number Diff line change
Expand Up @@ -766,35 +766,60 @@ tty_term_string(struct tty_term *term, enum tty_code_code code)
}

const char *
tty_term_string1(struct tty_term *term, enum tty_code_code code, int a)
tty_term_string_i(struct tty_term *term, enum tty_code_code code, int a)
{
return (tparm((char *) tty_term_string(term, code), a, 0, 0, 0, 0, 0, 0, 0, 0));
const char *x = tty_term_string(term, code), *s;

s = tparm((char *)x, a);
if (s == NULL)
fatalx("could not expand %s", tty_term_codes[code].name);
return (s);
}

const char *
tty_term_string2(struct tty_term *term, enum tty_code_code code, int a, int b)
tty_term_string_ii(struct tty_term *term, enum tty_code_code code, int a, int b)
{
return (tparm((char *) tty_term_string(term, code), a, b, 0, 0, 0, 0, 0, 0, 0));
const char *x = tty_term_string(term, code), *s;

s = tparm((char *)x, a, b);
if (s == NULL)
fatalx("could not expand %s", tty_term_codes[code].name);
return (s);
}

const char *
tty_term_string3(struct tty_term *term, enum tty_code_code code, int a, int b,
tty_term_string_iii(struct tty_term *term, enum tty_code_code code, int a, int b,
int c)
{
return (tparm((char *) tty_term_string(term, code), a, b, c, 0, 0, 0, 0, 0, 0));
const char *x = tty_term_string(term, code), *s;

s = tparm((char *)x, a, b, c);
if (s == NULL)
fatalx("could not expand %s", tty_term_codes[code].name);
return (s);
}

const char *
tty_term_ptr1(struct tty_term *term, enum tty_code_code code, const void *a)
tty_term_string_s(struct tty_term *term, enum tty_code_code code, const char *a)
{
return (tparm((char *) tty_term_string(term, code), (long)a, 0, 0, 0, 0, 0, 0, 0, 0));
const char *x = tty_term_string(term, code), *s;

s = tparm((char *)x, (long)a);
if (s == NULL)
fatalx("could not expand %s", tty_term_codes[code].name);
return (s);
}

const char *
tty_term_ptr2(struct tty_term *term, enum tty_code_code code, const void *a,
const void *b)
tty_term_string_ss(struct tty_term *term, enum tty_code_code code, const char *a,
const char *b)
{
return (tparm((char *) tty_term_string(term, code), (long)a, (long)b, 0, 0, 0, 0, 0, 0, 0));
const char *x = tty_term_string(term, code), *s;

s = tparm((char *)x, (long)a, (long)b);
if (s == NULL)
fatalx("could not expand %s", tty_term_codes[code].name);
return (s);
}

int
Expand Down
Loading

0 comments on commit 9d8131c

Please sign in to comment.