Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam
2026-04-26 21:12:23 +01:00
5 changed files with 34 additions and 23 deletions

21
file.c
View File

@@ -804,7 +804,7 @@ file_read_cancel(struct client_files *files, struct imsg *imsg)
}
/* Handle a write ready message (server). */
void
int
file_write_ready(struct client_files *files, struct imsg *imsg)
{
struct msg_write_ready *msg = imsg->data;
@@ -812,19 +812,20 @@ file_write_ready(struct client_files *files, struct imsg *imsg)
struct client_file find, *cf;
if (msglen != sizeof *msg)
fatalx("bad MSG_WRITE_READY size");
return (-1);
find.stream = msg->stream;
if ((cf = RB_FIND(client_files, files, &find)) == NULL)
return;
return (0);
if (msg->error != 0) {
cf->error = msg->error;
file_fire_done(cf);
} else
file_push(cf);
return (0);
}
/* Handle read data message (server). */
void
int
file_read_data(struct client_files *files, struct imsg *imsg)
{
struct msg_read_data *msg = imsg->data;
@@ -834,10 +835,10 @@ file_read_data(struct client_files *files, struct imsg *imsg)
size_t bsize = msglen - sizeof *msg;
if (msglen < sizeof *msg)
fatalx("bad MSG_READ_DATA size");
return (-1);
find.stream = msg->stream;
if ((cf = RB_FIND(client_files, files, &find)) == NULL)
return;
return (0);
log_debug("file %d read %zu bytes", cf->stream, bsize);
if (cf->error == 0 && !cf->closed) {
@@ -847,10 +848,11 @@ file_read_data(struct client_files *files, struct imsg *imsg)
} else
file_fire_read(cf);
}
return (0);
}
/* Handle a read done message (server). */
void
int
file_read_done(struct client_files *files, struct imsg *imsg)
{
struct msg_read_done *msg = imsg->data;
@@ -858,12 +860,13 @@ file_read_done(struct client_files *files, struct imsg *imsg)
struct client_file find, *cf;
if (msglen != sizeof *msg)
fatalx("bad MSG_READ_DONE size");
return (-1);
find.stream = msg->stream;
if ((cf = RB_FIND(client_files, files, &find)) == NULL)
return;
return (0);
log_debug("file %d read done", cf->stream);
cf->error = msg->error;
file_fire_done(cf);
return (0);
}

View File

@@ -949,8 +949,8 @@ screen_redraw_draw_pane(struct screen_redraw_ctx *ctx, struct window_pane *wp)
struct colour_palette *palette = &wp->palette;
struct grid_cell defaults;
struct visible_ranges *r;
struct visible_range *rr;
u_int i, j, k, top, x, y, width;
struct visible_range *rr = NULL;
u_int i, j, k, top, x, y, width, used;
if (wp->base.mode & MODE_SYNC)
screen_write_stop_sync(wp);
@@ -997,11 +997,15 @@ screen_redraw_draw_pane(struct screen_redraw_ctx *ctx, struct window_pane *wp)
tty_default_colours(&defaults, wp);
r = tty_check_overlay_range(tty, x, y, width);
for (k = 0; k < r->used; k++) {
rr = &r->ranges[k];
if (rr->nx != 0) {
tty_draw_line(tty, s, rr->px - wp->xoff, j,
rr->nx, rr->px, y, &defaults, palette);
used = r->used;
rr = xreallocarray(rr, used, sizeof *rr);
memcpy(rr, r->ranges, used * sizeof *rr);
for (k = 0; k < used; k++) {
if (rr[k].nx != 0) {
tty_draw_line(tty, s, rr[k].px - wp->xoff, j,
rr[k].nx, rr[k].px, y, &defaults, palette);
}
}
}
@@ -1009,6 +1013,7 @@ screen_redraw_draw_pane(struct screen_redraw_ctx *ctx, struct window_pane *wp)
#ifdef ENABLE_SIXEL
tty_draw_images(c, wp, s);
#endif
free(rr);
}
/* Draw the panes scrollbars */

View File

@@ -2235,13 +2235,16 @@ server_client_dispatch(struct imsg *imsg, void *arg)
goto bad;
break;
case MSG_WRITE_READY:
file_write_ready(&c->files, imsg);
if (file_write_ready(&c->files, imsg) != 0)
goto bad;
break;
case MSG_READ:
file_read_data(&c->files, imsg);
if (file_read_data(&c->files, imsg) != 0)
goto bad;
break;
case MSG_READ_DONE:
file_read_done(&c->files, imsg);
if (file_read_done(&c->files, imsg) != 0)
goto bad;
break;
}

6
tmux.h
View File

@@ -2994,9 +2994,9 @@ void file_write_data(struct client_files *, struct imsg *);
void file_write_close(struct client_files *, struct imsg *);
void file_read_open(struct client_files *, struct tmuxpeer *, struct imsg *,
int, int, client_file_cb, void *);
void file_write_ready(struct client_files *, struct imsg *);
void file_read_data(struct client_files *, struct imsg *);
void file_read_done(struct client_files *, struct imsg *);
int file_write_ready(struct client_files *, struct imsg *);
int file_read_data(struct client_files *, struct imsg *);
int file_read_done(struct client_files *, struct imsg *);
void file_read_cancel(struct client_files *, struct imsg *);
/* server.c */

View File

@@ -411,7 +411,7 @@ window_set_name(struct window *w, const char *new_name)
name = clean_name(new_name, "#");
if (name != NULL) {
free(w->name);
utf8_stravis(&w->name, new_name, VIS_OCTAL|VIS_CSTYLE|VIS_TAB|VIS_NL);
w->name = name;
notify_window("window-renamed", w);
}
}