diff options
-rw-r--r-- | share/man/man5/ruby-module.5 | 8 | ||||
-rw-r--r-- | sys/arch/riscv64/riscv64/pmap.c | 9 | ||||
-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/server-client.c | 186 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.1 | 6 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.h | 5 | ||||
-rw-r--r-- | usr.bin/tmux/window-copy.c | 8 |
8 files changed, 155 insertions, 112 deletions
diff --git a/share/man/man5/ruby-module.5 b/share/man/man5/ruby-module.5 index 56174f00d2b..0e74622f2df 100644 --- a/share/man/man5/ruby-module.5 +++ b/share/man/man5/ruby-module.5 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ruby-module.5,v 1.47 2024/06/20 22:43:16 jeremy Exp $ +.\" $OpenBSD: ruby-module.5,v 1.48 2024/11/21 06:12:23 jeremy Exp $ .\" .\" Copyright (c) 2011-2015, 2023 Jeremy Evans <jeremy@openbsd.org> .\" Copyright (c) 2008, 2011 Marc Espie <espie@openbsd.org> @@ -25,7 +25,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: June 20 2024 $ +.Dd $Mdocdate: November 21 2024 $ .Dt RUBY-MODULE 5 .Os .Sh NAME @@ -66,7 +66,7 @@ those via .Ev CONFIGURE_STYLE Ns = Ns Qq ruby gem and .Ev CONFIGURE_STYLE Ns = Ns Qq ruby gem ext -both add ruby31, ruby32, and ruby33 +both add ruby32 and ruby33 .Ev FLAVOR Ns s to the port. They also cause the @@ -82,7 +82,7 @@ To specify a version for a gem port, use a specific such as ruby32 to use Ruby 3.2. To specify the Ruby version to use for a non Ruby-gem port, set .Ev MODRUBY_REV -to 3.1, 3.2, or 3.3. +to 3.2 or 3.3. .Pp To ensure that dependencies use the same Ruby implementation as the current port, all Ruby gem dependencies specified in the port diff --git a/sys/arch/riscv64/riscv64/pmap.c b/sys/arch/riscv64/riscv64/pmap.c index 67247ca7346..15615e48efc 100644 --- a/sys/arch/riscv64/riscv64/pmap.c +++ b/sys/arch/riscv64/riscv64/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.42 2024/09/04 07:54:51 mglocker Exp $ */ +/* $OpenBSD: pmap.c,v 1.43 2024/11/20 22:25:38 kettenis Exp $ */ /* * Copyright (c) 2019-2020 Brian Bamsch <bbamsch@google.com> @@ -792,12 +792,19 @@ pmap_copy_page(struct vm_page *srcpg, struct vm_page *dstpg) paddr_t dstpa = VM_PAGE_TO_PHYS(dstpg); vaddr_t srcva = copy_src_page + cpu_number() * PAGE_SIZE; vaddr_t dstva = copy_dst_page + cpu_number() * PAGE_SIZE; + int s; + /* + * XXX The buffer flipper (incorrectly?) uses pmap_copy_page() + * (from uvm_pagerealloc_multi()) from interrupt context! + */ + s = splbio(); pmap_kenter_pa(srcva, srcpa, PROT_READ); pmap_kenter_pa(dstva, dstpa, PROT_READ|PROT_WRITE); memcpy((void *)dstva, (void *)srcva, PAGE_SIZE); pmap_kremove_pg(srcva); pmap_kremove_pg(dstva); + splx(s); } void 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/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..a68443d2d97 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.974 2024/11/21 07:37:21 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 21 2024 $ .Dt TMUX 1 .Os .Sh NAME @@ -7066,7 +7066,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..80a42c257b7 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.1244 2024/11/20 20:54:02 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 @@ -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 |