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
This commit is contained in:
Daniel Eklöf 2025-10-11 10:05:26 +02:00
parent 7ed36c1033
commit 96605bf52f
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 5 additions and 2 deletions

View file

@ -98,8 +98,11 @@
* URL labels misplaces when URL contains double-width characters * URL labels misplaces when URL contains double-width characters
([#2179][2179]). ([#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 [2179]: https://codeberg.org/dnkl/foot/issues/2179
[2194]: https://codeberg.org/dnkl/foot/issues/2194
### Security ### Security

View file

@ -256,8 +256,8 @@ extract_one(const struct terminal *term, const struct row *row,
} }
} }
xassert(next_tab_stop >= col); if (next_tab_stop > col)
ctx->tab_spaces_left = next_tab_stop - col; ctx->tab_spaces_left = next_tab_stop - col - 1;
} }
} }