Fix some long lines.

This commit is contained in:
nicm
2026-10-13 23:17:42 +00:00
committed by tmux update bot
parent e33c83c6ba
commit 61b695097e

View File

@@ -1,4 +1,4 @@
/* $OpenBSD: window-copy.c,v 1.437 2026/10/08 07:50:05 nicm Exp $ */ /* $OpenBSD: window-copy.c,v 1.438 2026/10/13 23:17:42 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -537,7 +537,8 @@ window_copy_sync_backing(struct window_mode_entry *wme)
if (collected > 0) { if (collected > 0) {
grid_free_lines(dg, 0, collected); grid_free_lines(dg, 0, collected);
memmove(&dg->linedata[0], &dg->linedata[collected], memmove(&dg->linedata[0], &dg->linedata[collected],
(old_hsize + sy - collected) * sizeof *dg->linedata); (old_hsize + sy - collected) *
sizeof *dg->linedata);
memset(&dg->linedata[old_hsize + sy - collected], 0, memset(&dg->linedata[old_hsize + sy - collected], 0,
collected * sizeof *dg->linedata); collected * sizeof *dg->linedata);
} }
@@ -556,7 +557,7 @@ window_copy_sync_backing(struct window_mode_entry *wme)
*/ */
dg->hsize = new_hsize; dg->hsize = new_hsize;
/* Copy the newly scrolled history, then refresh the viewport. */ /* Copy the newly scrolled history, then refresh the view. */
if (added > 0) if (added > 0)
grid_duplicate_lines(dg, kept, sg, kept, added); grid_duplicate_lines(dg, kept, sg, kept, added);
grid_duplicate_lines(dg, new_hsize, sg, new_hsize, sy); grid_duplicate_lines(dg, new_hsize, sg, new_hsize, sy);
@@ -2314,6 +2315,7 @@ window_copy_cmd_selection_mode(struct window_copy_cmd_state *cs)
{ {
struct window_mode_entry *wme = cs->wme; struct window_mode_entry *wme = cs->wme;
struct options *so = cs->s->options; struct options *so = cs->s->options;
struct options *oo = wme->wp->window->options;
struct window_copy_mode_data *data = wme->data; struct window_copy_mode_data *data = wme->data;
struct grid_reader gr; struct grid_reader gr;
const char *s = args_string(cs->wargs, 0); const char *s = args_string(cs->wargs, 0);
@@ -2333,7 +2335,8 @@ window_copy_cmd_selection_mode(struct window_copy_cmd_state *cs)
/* /*
* Set up the reset positions normally initialized by select-word or * Set up the reset positions normally initialized by select-word or
* select-line, including when changing the mode of an existing selection. * select-line, including when changing the mode of an existing
* selection.
*/ */
if (data->cursordrag == CURSORDRAG_SEL) { if (data->cursordrag == CURSORDRAG_SEL) {
fx = data->endselx; fx = data->endselx;
@@ -2360,8 +2363,7 @@ window_copy_cmd_selection_mode(struct window_copy_cmd_state *cs)
grid_reader_start(&gr, data->backing->grid, ex, ey); grid_reader_start(&gr, data->backing->grid, ex, ey);
if (data->selflag == SEL_WORD) { if (data->selflag == SEL_WORD) {
grid_reader_cursor_next_word_end(&gr, data->separators); grid_reader_cursor_next_word_end(&gr, data->separators);
if (options_get_number(wme->wp->window->options, "mode-keys") == if (options_get_number(oo, "mode-keys") == MODEKEY_VI)
MODEKEY_VI)
grid_reader_cursor_left(&gr, 1); grid_reader_cursor_left(&gr, 1);
} else } else
grid_reader_cursor_end_of_line(&gr, 1, 0); grid_reader_cursor_end_of_line(&gr, 1, 0);
@@ -5581,8 +5583,8 @@ window_copy_write_one(struct window_mode_entry *wme,
if (gc.flags & GRID_FLAG_PADDING) { if (gc.flags & GRID_FLAG_PADDING) {
if (ctx->s->cy == py && ctx->s->cx <= px + fx) { if (ctx->s->cy == py && ctx->s->cx <= px + fx) {
gc.flags &= ~GRID_FLAG_PADDING; gc.flags &= ~GRID_FLAG_PADDING;
screen_write_cursormove(ctx, px + fx, py, screen_write_cursormove(ctx, px + fx,
0); py, 0);
screen_write_putc(ctx, &gc, ' '); screen_write_putc(ctx, &gc, ' ');
} }
} else if (gc.flags & GRID_FLAG_TAB) { } else if (gc.flags & GRID_FLAG_TAB) {
@@ -5881,7 +5883,7 @@ window_copy_redraw_lines(struct window_mode_entry *wme, u_int py, u_int ny)
struct window_copy_mode_data *data = wme->data; struct window_copy_mode_data *data = wme->data;
struct screen *s = &data->screen; struct screen *s = &data->screen;
struct screen_write_ctx ctx; struct screen_write_ctx ctx;
u_int i; u_int i, off;
if (window_copy_line_number_width(wme) != 0) { if (window_copy_line_number_width(wme) != 0) {
screen_write_start(&ctx, &data->screen); screen_write_start(&ctx, &data->screen);
@@ -5901,9 +5903,8 @@ window_copy_redraw_lines(struct window_mode_entry *wme, u_int py, u_int ny)
screen_write_start_pane(&ctx, wp, NULL); screen_write_start_pane(&ctx, wp, NULL);
for (i = py; i < py + ny; i++) for (i = py; i < py + ny; i++)
window_copy_write_line(wme, &ctx, i); window_copy_write_line(wme, &ctx, i);
screen_write_cursormove(&ctx, off = window_copy_cursor_offset(wme, data->cx, screen_size_x(s));
window_copy_cursor_offset(wme, data->cx, screen_size_x(s)), data->cy, screen_write_cursormove(&ctx, off, data->cy, 0);
0);
screen_write_stop(&ctx); screen_write_stop(&ctx);
window_pane_scrollbar_redraw(wp); window_pane_scrollbar_redraw(wp);