From 6902c22a779aeb3389843a36ee41af2ab633bb07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sat, 16 May 2020 22:29:53 +0200 Subject: [PATCH] selection: copy: insert line break if either cell is empty --- CHANGELOG.md | 3 +++ selection.c | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d35b902..0b6470e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,9 @@ * Background transparency to only be used with the default background color. +* Copy to clipboard/primary selection to insert a line break if either + the last cell on the previous line or the first cell on the next + line is empty. ### Deprecated ### Removed diff --git a/selection.c b/selection.c index 59cab9a7..3928e4cb 100644 --- a/selection.c +++ b/selection.c @@ -232,7 +232,8 @@ extract_one(struct terminal *term, struct row *row, struct cell *cell, if (ctx->last_row != NULL && row != ctx->last_row && ((term->selection.kind == SELECTION_NORMAL && - ctx->last_row->linebreak) || + (ctx->last_row->linebreak || + ctx->empty_count > 0 || cell->wc == 0)) || term->selection.kind == SELECTION_BLOCK)) { /* Last cell was the last column in the selection */