diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2009-09-07 18:50:45 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2009-09-07 18:50:45 +0000 |
commit | ccba613e5b277e70e8261c04ecc37ff3ef14a217 (patch) | |
tree | 26ed2fcf88ae87e4e76e922df255e4fd62589e31 /window-copy.c | |
parent | e97006b102dd274dd8cc70c2aee13f6b09f69a41 (diff) | |
download | rtmux-ccba613e5b277e70e8261c04ecc37ff3ef14a217.tar.gz rtmux-ccba613e5b277e70e8261c04ecc37ff3ef14a217.tar.bz2 rtmux-ccba613e5b277e70e8261c04ecc37ff3ef14a217.zip |
Give each paste buffer a size member instead of requiring them to be
zero-terminated.
Diffstat (limited to 'window-copy.c')
-rw-r--r-- | window-copy.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/window-copy.c b/window-copy.c index f102092c..bacd6ad9 100644 --- a/window-copy.c +++ b/window-copy.c @@ -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 |