diff --git a/selection.c b/selection.c index 2a05b853..23eb4450 100644 --- a/selection.c +++ b/selection.c @@ -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')