Give each paste buffer a size member instead of requiring them to be

zero-terminated.
This commit is contained in:
Nicholas Marriott
2009-09-07 18:50:45 +00:00
parent e97006b102
commit ccba613e5b
11 changed files with 62 additions and 47 deletions

View File

@@ -849,13 +849,16 @@ window_copy_copy_selection(struct window_pane *wp, struct client *c)
window_copy_copy_line(wp, &buf, &off, ey, 0, ex);
}
/* Terminate buffer, overwriting final \n. */
if (off != 0)
buf[off - 1] = '\0';
/* Don't bother if no data. */
if (off == 0) {
xfree(buf);
return;
}
off--; /* remove final \n */
/* Add the buffer to the stack. */
limit = options_get_number(&c->session->options, "buffer-limit");
paste_add(&c->session->buffers, buf, limit);
paste_add(&c->session->buffers, buf, off, limit);
}
void