diff options
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/file/file.c | 70 | ||||
-rw-r--r-- | usr.bin/tmux/cmd-queue.c | 8 | ||||
-rw-r--r-- | usr.bin/tmux/cmd-save-buffer.c | 4 | ||||
-rw-r--r-- | usr.bin/tmux/grid-reader.c | 19 | ||||
-rw-r--r-- | usr.bin/tmux/grid.c | 26 | ||||
-rw-r--r-- | usr.bin/tmux/proc.c | 21 | ||||
-rw-r--r-- | usr.bin/tmux/server-client.c | 186 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.1 | 10 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.h | 7 | ||||
-rw-r--r-- | usr.bin/tmux/window-copy.c | 8 |
10 files changed, 201 insertions, 158 deletions
diff --git a/usr.bin/file/file.c b/usr.bin/file/file.c index 9fb35dba3b6..8920ba48275 100644 --- a/usr.bin/file/file.c +++ b/usr.bin/file/file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: file.c,v 1.70 2024/01/16 13:07:29 claudio Exp $ */ +/* $OpenBSD: file.c,v 1.74 2024/11/21 13:35:20 claudio Exp $ */ /* * Copyright (c) 2015 Nicholas Marriott <nicm@openbsd.org> @@ -125,7 +125,7 @@ main(int argc, char **argv) struct imsgbuf ibuf; struct imsg imsg; struct input_msg msg; - struct input_ack *ack; + struct input_ack ack; pid_t pid, parent; tzset(); @@ -216,17 +216,18 @@ main(int argc, char **argv) if (cflag) goto wait_for_child; - imsg_init(&ibuf, pair[0]); + if (imsgbuf_init(&ibuf, pair[0]) == -1) + err(1, "imsgbuf_init"); + imsgbuf_allow_fdpass(&ibuf); for (idx = 0; idx < argc; idx++) { fd = prepare_message(&msg, idx, argv[idx]); send_message(&ibuf, &msg, sizeof msg, fd); if (read_message(&ibuf, &imsg, pid) == 0) break; - if (imsg.hdr.len != IMSG_HEADER_SIZE + sizeof *ack) - errx(1, "message too small"); - ack = imsg.data; - if (ack->idx != idx) + if (imsg_get_data(&imsg, &ack, sizeof ack) == -1) + err(1, "bad message"); + if (ack.idx != idx) errx(1, "index not expected"); imsg_free(&imsg); } @@ -288,32 +289,32 @@ send_message(struct imsgbuf *ibuf, void *msg, size_t msglen, int fd) { if (imsg_compose(ibuf, -1, -1, 0, fd, msg, msglen) != 1) err(1, "imsg_compose"); - if (imsg_flush(ibuf) != 0) - err(1, "imsg_flush"); + if (imsgbuf_flush(ibuf) != 0) + err(1, "imsgbuf_flush"); } static int read_message(struct imsgbuf *ibuf, struct imsg *imsg, pid_t from) { - int n; - - while ((n = imsg_read(ibuf)) == -1 && errno == EAGAIN) - /* nothing */ ; - if (n == -1) - err(1, "imsg_read"); - if (n == 0) - return (0); - - if ((n = imsg_get(ibuf, imsg)) == -1) - err(1, "imsg_get"); - if (n == 0) - return (0); - - if ((pid_t)imsg->hdr.pid != from) - errx(1, "PIDs don't match"); - - return (n); + while (1) { + switch (imsg_get(ibuf, imsg)) { + case -1: + err(1, "imsg_get"); + case 0: + break; + default: + if ((pid_t)imsg->hdr.pid != from) + errx(1, "PIDs don't match"); + return (1); + } + switch (imsgbuf_read(ibuf)) { + case -1: + err(1, "imsgbuf_read"); + case 0: + return (0); + } + } } static void @@ -365,7 +366,7 @@ child(int fd, pid_t parent, int argc, char **argv) struct magic *m; struct imsgbuf ibuf; struct imsg imsg; - struct input_msg *msg; + struct input_msg msg; struct input_ack ack; struct input_file inf; int i, idx; @@ -401,21 +402,22 @@ child(int fd, pid_t parent, int argc, char **argv) width = len; } - imsg_init(&ibuf, fd); + if (imsgbuf_init(&ibuf, fd) == -1) + err(1, "imsgbuf_init"); + imsgbuf_allow_fdpass(&ibuf); for (;;) { if (read_message(&ibuf, &imsg, parent) == 0) break; - if (imsg.hdr.len != IMSG_HEADER_SIZE + sizeof *msg) - errx(1, "message too small"); - msg = imsg.data; + if (imsg_get_data(&imsg, &msg, sizeof msg) == -1) + err(1, "bad message"); - idx = msg->idx; + idx = msg.idx; if (idx < 0 || idx >= argc) errx(1, "index out of range"); memset(&inf, 0, sizeof inf); inf.m = m; - inf.msg = msg; + inf.msg = &msg; inf.path = argv[idx]; inf.fd = imsg_get_fd(&imsg); diff --git a/usr.bin/tmux/cmd-queue.c b/usr.bin/tmux/cmd-queue.c index 81ed3de30a8..fdba8cd15c8 100644 --- a/usr.bin/tmux/cmd-queue.c +++ b/usr.bin/tmux/cmd-queue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-queue.c,v 1.117 2024/05/14 07:52:19 nicm Exp $ */ +/* $OpenBSD: cmd-queue.c,v 1.118 2024/11/22 12:58:05 nicm Exp $ */ /* * Copyright (c) 2013 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -835,9 +835,9 @@ cmdq_guard(struct cmdq_item *item, const char *guard, int flags) /* Show message from command. */ void -cmdq_print_data(struct cmdq_item *item, int parse, struct evbuffer *evb) +cmdq_print_data(struct cmdq_item *item, struct evbuffer *evb) { - server_client_print(item->client, parse, evb); + server_client_print(item->client, 1, evb); } /* Show message from command. */ @@ -855,7 +855,7 @@ cmdq_print(struct cmdq_item *item, const char *fmt, ...) evbuffer_add_vprintf(evb, fmt, ap); va_end(ap); - cmdq_print_data(item, 0, evb); + cmdq_print_data(item, evb); evbuffer_free(evb); } diff --git a/usr.bin/tmux/cmd-save-buffer.c b/usr.bin/tmux/cmd-save-buffer.c index 17905128aad..eb59e8a06aa 100644 --- a/usr.bin/tmux/cmd-save-buffer.c +++ b/usr.bin/tmux/cmd-save-buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-save-buffer.c,v 1.55 2022/12/07 09:44:44 nicm Exp $ */ +/* $OpenBSD: cmd-save-buffer.c,v 1.56 2024/11/22 12:58:05 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org> @@ -102,7 +102,7 @@ cmd_save_buffer_exec(struct cmd *self, struct cmdq_item *item) if (evb == NULL) fatalx("out of memory"); evbuffer_add(evb, bufdata, bufsize); - cmdq_print_data(item, 1, evb); + cmdq_print_data(item, evb); evbuffer_free(evb); return (CMD_RETURN_NORMAL); } diff --git a/usr.bin/tmux/grid-reader.c b/usr.bin/tmux/grid-reader.c index d1b1a4fb500..40c71a3ac36 100644 --- a/usr.bin/tmux/grid-reader.c +++ b/usr.bin/tmux/grid-reader.c @@ -1,4 +1,4 @@ -/* $OpenBSD: grid-reader.c,v 1.8 2024/10/25 15:00:18 nicm Exp $ */ +/* $OpenBSD: grid-reader.c,v 1.9 2024/11/20 20:54:02 nicm Exp $ */ /* * Copyright (c) 2020 Anindya Mukherjee <anindya49@hotmail.com> @@ -180,19 +180,14 @@ grid_reader_handle_wrap(struct grid_reader *gr, u_int *xx, u_int *yy) int grid_reader_in_set(struct grid_reader *gr, const char *set) { - struct grid_cell gc; - - grid_get_cell(gr->gd, gr->cx, gr->cy, &gc); - if (gc.flags & GRID_FLAG_PADDING) - return (0); - return (utf8_cstrhas(set, &gc.data)); + return (grid_in_set(gr->gd, gr->cx, gr->cy, set)); } /* Move cursor to the start of the next word. */ void grid_reader_cursor_next_word(struct grid_reader *gr, const char *separators) { - u_int xx, yy; + u_int xx, yy, width; /* Do not break up wrapped words. */ if (grid_get_line(gr->gd, gr->cy)->flags & GRID_LINE_WRAPPED) @@ -229,8 +224,8 @@ grid_reader_cursor_next_word(struct grid_reader *gr, const char *separators) } } while (grid_reader_handle_wrap(gr, &xx, &yy) && - grid_reader_in_set(gr, WHITESPACE)) - gr->cx++; + (width = grid_reader_in_set(gr, WHITESPACE))) + gr->cx += width; } /* Move cursor to the end of the next word. */ @@ -425,7 +420,9 @@ grid_reader_cursor_back_to_indentation(struct grid_reader *gr) xx = grid_line_length(gr->gd, py); for (px = 0; px < xx; px++) { grid_get_cell(gr->gd, px, py, &gc); - if (gc.data.size != 1 || *gc.data.data != ' ') { + if ((gc.data.size != 1 || *gc.data.data != ' ') && + ~gc.flags & GRID_FLAG_TAB && + ~gc.flags & GRID_FLAG_PADDING) { gr->cx = px; gr->cy = py; return; diff --git a/usr.bin/tmux/grid.c b/usr.bin/tmux/grid.c index 9dfab95a165..03ab901ab3e 100644 --- a/usr.bin/tmux/grid.c +++ b/usr.bin/tmux/grid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: grid.c,v 1.134 2024/11/08 08:51:36 nicm Exp $ */ +/* $OpenBSD: grid.c,v 1.135 2024/11/20 20:54:02 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -1561,3 +1561,27 @@ grid_line_length(struct grid *gd, u_int py) } return (px); } + +/* Check if character is in set. */ +int +grid_in_set(struct grid *gd, u_int px, u_int py, const char *set) +{ + struct grid_cell gc, tmp_gc; + u_int pxx; + + grid_get_cell(gd, px, py, &gc); + if (strchr(set, '\t')) { + if (gc.flags & GRID_FLAG_PADDING) { + pxx = px; + do + grid_get_cell(gd, --pxx, py, &tmp_gc); + while (pxx > 0 && tmp_gc.flags & GRID_FLAG_PADDING); + if (tmp_gc.flags & GRID_FLAG_TAB) + return (tmp_gc.data.width - (px - pxx)); + } else if (gc.flags & GRID_FLAG_TAB) + return (gc.data.width); + } + if (gc.flags & GRID_FLAG_PADDING) + return (0); + return (utf8_cstrhas(set, &gc.data)); +} diff --git a/usr.bin/tmux/proc.c b/usr.bin/tmux/proc.c index d001ba9c3d1..5c759a58166 100644 --- a/usr.bin/tmux/proc.c +++ b/usr.bin/tmux/proc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.c,v 1.24 2024/02/13 08:10:23 nicm Exp $ */ +/* $OpenBSD: proc.c,v 1.30 2024/11/21 13:35:20 claudio Exp $ */ /* * Copyright (c) 2015 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -77,8 +77,7 @@ proc_event_cb(__unused int fd, short events, void *arg) struct imsg imsg; if (!(peer->flags & PEER_BAD) && (events & EV_READ)) { - if (((n = imsg_read(&peer->ibuf)) == -1 && errno != EAGAIN) || - n == 0) { + if (imsgbuf_read(&peer->ibuf) != 1) { peer->dispatchcb(NULL, peer->arg); return; } @@ -105,13 +104,13 @@ proc_event_cb(__unused int fd, short events, void *arg) } if (events & EV_WRITE) { - if (msgbuf_write(&peer->ibuf.w) <= 0 && errno != EAGAIN) { + if (imsgbuf_write(&peer->ibuf) == -1) { peer->dispatchcb(NULL, peer->arg); return; } } - if ((peer->flags & PEER_BAD) && peer->ibuf.w.queued == 0) { + if ((peer->flags & PEER_BAD) && imsgbuf_queuelen(&peer->ibuf) == 0) { peer->dispatchcb(NULL, peer->arg); return; } @@ -152,7 +151,7 @@ proc_update_event(struct tmuxpeer *peer) event_del(&peer->event); events = EV_READ; - if (peer->ibuf.w.queued > 0) + if (imsgbuf_queuelen(&peer->ibuf) > 0) events |= EV_WRITE; event_set(&peer->event, peer->ibuf.fd, events, proc_event_cb, peer); @@ -218,7 +217,7 @@ proc_exit(struct tmuxproc *tp) struct tmuxpeer *peer; TAILQ_FOREACH(peer, &tp->peers, entry) - imsg_flush(&peer->ibuf); + imsgbuf_flush(&peer->ibuf); tp->exit = 1; } @@ -306,7 +305,9 @@ proc_add_peer(struct tmuxproc *tp, int fd, peer->dispatchcb = dispatchcb; peer->arg = arg; - imsg_init(&peer->ibuf, fd); + if (imsgbuf_init(&peer->ibuf, fd) == -1) + fatal("imsgbuf_init"); + imsgbuf_allow_fdpass(&peer->ibuf); event_set(&peer->event, fd, EV_READ, proc_event_cb, peer); if (getpeereid(fd, &peer->uid, &gid) != 0) @@ -326,7 +327,7 @@ proc_remove_peer(struct tmuxpeer *peer) log_debug("remove peer %p", peer); event_del(&peer->event); - imsg_clear(&peer->ibuf); + imsgbuf_clear(&peer->ibuf); close(peer->ibuf.fd); free(peer); @@ -341,7 +342,7 @@ proc_kill_peer(struct tmuxpeer *peer) void proc_flush_peer(struct tmuxpeer *peer) { - imsg_flush(&peer->ibuf); + imsgbuf_flush(&peer->ibuf); } void diff --git a/usr.bin/tmux/server-client.c b/usr.bin/tmux/server-client.c index 3f2a5fbd8c5..b65bfaed775 100644 --- a/usr.bin/tmux/server-client.c +++ b/usr.bin/tmux/server-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server-client.c,v 1.419 2024/11/15 14:09:04 nicm Exp $ */ +/* $OpenBSD: server-client.c,v 1.420 2024/11/21 07:34:38 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -33,6 +33,19 @@ #include "tmux.h" +enum mouse_where { + NOWHERE, + PANE, + STATUS, + STATUS_LEFT, + STATUS_RIGHT, + STATUS_DEFAULT, + BORDER, + SCROLLBAR_UP, + SCROLLBAR_SLIDER, + SCROLLBAR_DOWN +}; + static void server_client_free(int, short, void *); static void server_client_check_pane_resize(struct window_pane *); static void server_client_check_pane_buffer(struct window_pane *); @@ -570,18 +583,97 @@ server_client_exec(struct client *c, const char *cmd) free(msg); } +static enum mouse_where +server_client_check_mouse_in_pane(struct window_pane *wp, u_int px, u_int py, + u_int *sl_mpos) +{ + struct window *w = wp->window; + struct options *wo = w->options; + struct window_pane *fwp; + int pane_status, sb, sb_pos, sb_w, sb_pad; + u_int line, sl_top, sl_bottom; + + sb = options_get_number(wo, "pane-scrollbars"); + sb_pos = options_get_number(wo, "pane-scrollbars-position"); + pane_status = options_get_number(wo, "pane-border-status"); + sb_pos = options_get_number(wo, "pane-scrollbars-position"); + + if (window_pane_show_scrollbar(wp, sb)) { + sb_w = wp->scrollbar_style.width; + sb_pad = wp->scrollbar_style.pad; + } else { + sb_w = 0; + sb_pad = 0; + } + if (pane_status == PANE_STATUS_TOP) + line = wp->yoff - 1; + else if (pane_status == PANE_STATUS_BOTTOM) + line = wp->yoff + wp->sy; + + /* Check if point is within the pane or scrollbar. */ + if (((pane_status != PANE_STATUS_OFF && py != line) || + (wp->yoff == 0 && py < wp->sy) || + (py >= wp->yoff && py < wp->yoff + wp->sy)) && + ((sb_pos == PANE_SCROLLBARS_RIGHT && + px < wp->xoff + wp->sx + sb_pad + sb_w) || + (sb_pos == PANE_SCROLLBARS_LEFT && + px < wp->xoff + wp->sx - sb_pad - sb_w))) { + /* Check if in the scrollbar. */ + if ((sb_pos == PANE_SCROLLBARS_RIGHT && + (px >= wp->xoff + wp->sx + sb_pad && + px < wp->xoff + wp->sx + sb_pad + sb_w)) || + (sb_pos == PANE_SCROLLBARS_LEFT && + (px >= wp->xoff - sb_pad - sb_w && + px < wp->xoff - sb_pad))) { + /* Check where inside the scrollbar. */ + sl_top = wp->yoff + wp->sb_slider_y; + sl_bottom = (wp->yoff + wp->sb_slider_y + + wp->sb_slider_h - 1); + if (py < sl_top) + return (SCROLLBAR_UP); + else if (py >= sl_top && + py <= sl_bottom) { + *sl_mpos = (py - wp->sb_slider_y - wp->yoff); + return (SCROLLBAR_SLIDER); + } else /* py > sl_bottom */ + return (SCROLLBAR_DOWN); + } else { + /* Must be inside the pane. */ + return (PANE); + } + } else if (~w->flags & WINDOW_ZOOMED) { + /* Try the pane borders if not zoomed. */ + TAILQ_FOREACH(fwp, &w->panes, entry) { + if ((((sb_pos == PANE_SCROLLBARS_RIGHT && + fwp->xoff + fwp->sx + sb_pad + sb_w == px) || + (sb_pos == PANE_SCROLLBARS_LEFT && + fwp->xoff + fwp->sx == px)) && + fwp->yoff <= 1 + py && + fwp->yoff + fwp->sy >= py) || + (fwp->yoff + fwp->sy == py && + fwp->xoff <= 1 + px && + fwp->xoff + fwp->sx >= px)) + break; + } + if (fwp != NULL) { + wp = fwp; + return (BORDER); + } + } + return (NOWHERE); +} + /* Check for mouse keys. */ static key_code server_client_check_mouse(struct client *c, struct key_event *event) { struct mouse_event *m = &event->m; struct session *s = c->session, *fs; - struct options *wo = s->curw->window->options; + struct window *w = s->curw->window; struct winlink *fwl; struct window_pane *wp, *fwp; - u_int x, y, b, sx, sy, px, py, line = 0, sb_pos; - u_int sl_top, sl_bottom, sl_mpos = 0; - int ignore = 0, sb, sb_w, sb_pad, pane_status; + u_int x, y, b, sx, sy, px, py, sl_mpos = 0; + int ignore = 0; key_code key; struct timeval tv; struct style_range *sr; @@ -594,16 +686,7 @@ server_client_check_mouse(struct client *c, struct key_event *event) SECOND, DOUBLE, TRIPLE } type = NOTYPE; - enum { NOWHERE, - PANE, - STATUS, - STATUS_LEFT, - STATUS_RIGHT, - STATUS_DEFAULT, - BORDER, - SCROLLBAR_UP, - SCROLLBAR_SLIDER, - SCROLLBAR_DOWN } where = NOWHERE; + enum mouse_where where = NOWHERE; log_debug("%s mouse %02x at %u,%u (last %u,%u) (%d)", c->name, m->b, m->x, m->y, m->lx, m->ly, c->tty.mouse_drag_flag); @@ -770,84 +853,19 @@ have_event: tty_window_offset(&c->tty, &m->ox, &m->oy, &sx, &sy); log_debug("mouse window @%u at %u,%u (%ux%u)", - s->curw->window->id, m->ox, m->oy, sx, sy); + w->id, m->ox, m->oy, sx, sy); if (px > sx || py > sy) return (KEYC_UNKNOWN); px = px + m->ox; py = py + m->oy; /* Try inside the pane. */ - wp = window_get_active_at(s->curw->window, px, py); + wp = window_get_active_at(w, px, py); if (wp == NULL) return (KEYC_UNKNOWN); + where = server_client_check_mouse_in_pane(wp, px, py, + &sl_mpos); - /* Try the scrollbar next to a pane. */ - sb = options_get_number(wo, "pane-scrollbars"); - sb_pos = options_get_number(wo, - "pane-scrollbars-position"); - if (window_pane_show_scrollbar(wp, sb)) { - sb_w = wp->scrollbar_style.width; - sb_pad = wp->scrollbar_style.pad; - } else { - sb_w = 0; - sb_pad = 0; - } - pane_status = options_get_number(wo, - "pane-border-status"); - if (pane_status == PANE_STATUS_TOP) - line = wp->yoff - 1; - else if (pane_status == PANE_STATUS_BOTTOM) - line = wp->yoff + wp->sy; - - /* - * Check if py could lie within a scrollbar - * (but not within the padding). If the pane is - * at the top, then py is 0; if not then the - * top, then yoff to yoff + sy. - */ - if ((pane_status != PANE_STATUS_OFF && py != line) || - (wp->yoff == 0 && py < wp->sy) || - (py >= wp->yoff && py < wp->yoff + wp->sy)) { - sb_pos = options_get_number(wo, - "pane-scrollbars-position"); - if ((sb_pos == PANE_SCROLLBARS_RIGHT && - (px >= wp->xoff + wp->sx + sb_pad && - px < wp->xoff + wp->sx + sb_pad + sb_w)) || - (sb_pos == PANE_SCROLLBARS_LEFT && - (px >= wp->xoff - sb_pad - sb_w && - px < wp->xoff - sb_pad))) { - sl_top = wp->yoff + wp->sb_slider_y; - sl_bottom = (wp->yoff + - wp->sb_slider_y + - wp->sb_slider_h - 1); - if (py < sl_top) - where = SCROLLBAR_UP; - else if (py >= sl_top && - py <= sl_bottom) { - where = SCROLLBAR_SLIDER; - sl_mpos = (py - - wp->sb_slider_y - wp->yoff); - } else /* py > sl_bottom */ - where = SCROLLBAR_DOWN; - } else - where = PANE; - } else { - /* Try the pane borders if not zoomed. */ - if (~s->curw->window->flags & WINDOW_ZOOMED) { - TAILQ_FOREACH(wp, - &s->curw->window->panes, entry) { - if ((wp->xoff + wp->sx == px && - wp->yoff <= 1 + py && - wp->yoff + wp->sy >= py) || - (wp->yoff + wp->sy == py && - wp->xoff <= 1 + px && - wp->xoff + wp->sx >= px)) - break; - } - if (wp != NULL) - where = BORDER; - } - } if (where == PANE) { log_debug("mouse %u,%u on pane %%%u", x, y, wp->id); diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1 index 64bec7eb84c..352b1771e65 100644 --- a/usr.bin/tmux/tmux.1 +++ b/usr.bin/tmux/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.973 2024/11/15 14:09:04 nicm Exp $ +.\" $OpenBSD: tmux.1,v 1.975 2024/11/22 12:36:13 nicm Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> .\" @@ -14,7 +14,7 @@ .\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING .\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: November 15 2024 $ +.Dd $Mdocdate: November 22 2024 $ .Dt TMUX 1 .Os .Sh NAME @@ -2340,6 +2340,9 @@ will do nothing. The .Fl o flag jumps to the beginning of the command output instead of the shell prompt. +Finding the beginning of command output requires the shell to emit an escape +sequence (\e033]133;C\e033\e\e) to tell tmux where the output begins. +If the shell does not send these escape sequences, these commands do nothing. .Pp Copy commands may take an optional buffer prefix argument which is used to generate the buffer name (the default is @@ -4873,6 +4876,7 @@ section. .Pp .It Ic copy-mode-position-format Ar format Format of the position indicator in copy mode. +.Pp .It Xo Ic mode-keys .Op Ic vi | emacs .Xc @@ -7066,7 +7070,7 @@ If .Ar path is .Ql - , -the contents are read from stdin. +the contents are written to stdout. .It Xo Ic set-buffer .Op Fl aw .Op Fl b Ar buffer-name diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index 73985b8f8de..61e3ed26ea1 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.1243 2024/11/15 14:09:04 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.1245 2024/11/22 12:58:05 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -605,7 +605,7 @@ enum tty_code_code { }; /* Character classes. */ -#define WHITESPACE " " +#define WHITESPACE "\t " /* Mode keys. */ #define MODEKEY_EMACS 0 @@ -2682,7 +2682,7 @@ u_int cmdq_next(struct client *); struct cmdq_item *cmdq_running(struct client *); void cmdq_guard(struct cmdq_item *, const char *, int); void printflike(2, 3) cmdq_print(struct cmdq_item *, const char *, ...); -void cmdq_print_data(struct cmdq_item *, int, struct evbuffer *); +void cmdq_print_data(struct cmdq_item *, struct evbuffer *); void printflike(2, 3) cmdq_error(struct cmdq_item *, const char *, ...); /* cmd-wait-for.c */ @@ -2944,6 +2944,7 @@ void grid_reflow(struct grid *, u_int); void grid_wrap_position(struct grid *, u_int, u_int, u_int *, u_int *); void grid_unwrap_position(struct grid *, u_int *, u_int *, u_int, u_int); u_int grid_line_length(struct grid *, u_int); +int grid_in_set(struct grid *, u_int, u_int, const char *); /* grid-reader.c */ void grid_reader_start(struct grid_reader *, struct grid *, u_int, u_int); diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c index 078750f67f5..51ecb286ef7 100644 --- a/usr.bin/tmux/window-copy.c +++ b/usr.bin/tmux/window-copy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window-copy.c,v 1.366 2024/11/12 10:06:35 nicm Exp $ */ +/* $OpenBSD: window-copy.c,v 1.367 2024/11/20 20:54:02 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -5033,12 +5033,8 @@ window_copy_in_set(struct window_mode_entry *wme, u_int px, u_int py, const char *set) { struct window_copy_mode_data *data = wme->data; - struct grid_cell gc; - grid_get_cell(data->backing->grid, px, py, &gc); - if (gc.flags & GRID_FLAG_PADDING) - return (0); - return (utf8_cstrhas(set, &gc.data)); + return (grid_in_set(data->backing->grid, px, py, set)); } static u_int |