From a2af13a1260b70e59a465debc890d40cd7103964 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Tue, 14 Jul 2020 17:06:04 +0200 Subject: [PATCH] selection: no need to try to detect multi-column chars at the end of the line This is handled by the generic foreach() functions, which now simply skips spacer cells. --- selection.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/selection.c b/selection.c index d5f8721c..f460607a 100644 --- a/selection.c +++ b/selection.c @@ -273,22 +273,7 @@ extract_one(struct terminal *term, struct row *row, struct cell *cell, /* New row - determine if we should insert a newline or not */ if (term->selection.kind == SELECTION_NORMAL) { - int width = max(1, wcwidth(cell->wc)); - - if (width > 1) { - /* Heuristict to handle force-wrapped multi-column - * characters */ - - /* - * TODO: maybe we should print a placeholder value to - * the empty cells at the end of the line when - * force-wrapping? Then extract() could simply skip - * those cells - */ - ctx->empty_count -= min(width, ctx->empty_count); - } - - else if (ctx->last_row->linebreak || + if (ctx->last_row->linebreak || ctx->empty_count > 0 || cell->wc == 0) {