selection: buffer may be empty if only empty cells where selected

This commit is contained in:
Daniel Eklöf 2019-11-16 10:56:10 +01:00
parent 9840291100
commit b31c18c741
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -108,6 +108,12 @@ extract_selection(const struct terminal *term)
start_col = 0;
}
if (idx == 0) {
/* Selection of empty cells only */
buf[idx] = '\0';
return buf;
}
assert(idx > 0);
assert(idx < buf_size);
if (buf[idx - 1] == '\n')