=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/window-copy.c,v retrieving revision 1.292 retrieving revision 1.293 diff -c -r1.292 -r1.293 *** src/usr.bin/tmux/window-copy.c 2020/06/02 08:17:27 1.292 --- src/usr.bin/tmux/window-copy.c 2020/06/02 19:10:26 1.293 *************** *** 1,4 **** ! /* $OpenBSD: window-copy.c,v 1.292 2020/06/02 08:17:27 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: window-copy.c,v 1.293 2020/06/02 19:10:26 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 3628,3633 **** --- 3628,3635 ---- buf = window_copy_match_at_cursor(data); if (buf != NULL) *len = strlen(buf); + else + *len = 0; return (buf); } *************** *** 3719,3724 **** --- 3721,3727 ---- /* Don't bother if no data. */ if (off == 0) { free(buf); + *len = 0 return (NULL); } if (keys == MODEKEY_EMACS || lastex <= ey_last) *************** *** 3753,3761 **** struct job *job; buf = window_copy_get_selection(wme, &len); - if (buf == NULL) - return; - if (cmd == NULL || *cmd == '\0') cmd = options_get_string(global_options, "copy-command"); if (cmd != NULL && *cmd != '\0') { --- 3756,3761 ---- *************** *** 3763,3769 **** -1, -1); bufferevent_write(job_get_event(job), buf, len); } ! window_copy_copy_buffer(wme, prefix, buf, len); } static void --- 3763,3770 ---- -1, -1); bufferevent_write(job_get_event(job), buf, len); } ! if (buf != NULL) ! window_copy_copy_buffer(wme, prefix, buf, len); } static void