aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-11-16 09:56:10 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-11-16 09:56:10 +0000
commitb31c18c7413222480c6d33ee2aa5ee4025902a35 (patch)
tree7bb5077f045eefcc16dfc39d9d6344a4ddfe2be6
parentcsi: implement CSI 0g and CSI 3g (diff)
selection: buffer may be empty if only empty cells where selected
-rw-r--r--selection.c6
1 files changed, 6 insertions, 0 deletions
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')