aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2025-10-11 08:05:26 +0000
committerDaniel Eklöf <daniel@ekloef.se>2025-10-11 08:13:10 +0000
commit96605bf52fa3794ee2f13739831ad92229b4b3a3 (patch)
tree9028516c6c9d610dfb3aac44d3af7be30939745a
parentconfig: add colors.dim-blend-towards=black|white (diff)
extract: number of spaces after the tab shouldn't include the tab cell itself
This fixes an off by one, where we sometimes "ate" an extra space when extracting contents with tabs. This happened if the tab (and its subsequent spaces) were followed by an additional space. Closes #2194
-rw-r--r--CHANGELOG.md3
-rw-r--r--extract.c4
2 files changed, 5 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 76183459..3935889a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -98,8 +98,11 @@
* URL labels misplaces when URL contains double-width characters
([#2179][2179]).
+* One space too much consumed when copying (or pipe:ing) contents with
+ tabs ([#2194][2194])
[2179]: https://codeberg.org/dnkl/foot/issues/2179
+[2194]: https://codeberg.org/dnkl/foot/issues/2194
### Security
diff --git a/extract.c b/extract.c
index 31c32248..cd9a0c95 100644
--- a/extract.c
+++ b/extract.c
@@ -256,8 +256,8 @@ extract_one(const struct terminal *term, const struct row *row,
}
}
- xassert(next_tab_stop >= col);
- ctx->tab_spaces_left = next_tab_stop - col;
+ if (next_tab_stop > col)
+ ctx->tab_spaces_left = next_tab_stop - col - 1;
}
}