mirror of
https://github.com/RGBCube/serenity
synced 2025-05-22 17:25:07 +00:00
less: Handle tabs in line wrapping
Before tabs were treated as a width of 1, which would cause issues with man page headers.
This commit is contained in:
parent
20a0572de8
commit
23e09eb7f4
1 changed files with 9 additions and 3 deletions
|
@ -75,9 +75,15 @@ static Vector<StringView> wrap_line(String const& string, size_t width)
|
||||||
if (*it == '\e')
|
if (*it == '\e')
|
||||||
in_ansi = true;
|
in_ansi = true;
|
||||||
|
|
||||||
if (!in_ansi)
|
if (!in_ansi) {
|
||||||
// FIXME: calculate the printed width of the character.
|
if (*it == '\t') {
|
||||||
offset++;
|
// Tabs are a special case, because their width is variable.
|
||||||
|
offset += (8 - (offset % 8));
|
||||||
|
} else {
|
||||||
|
// FIXME: calculate the printed width of the character.
|
||||||
|
offset++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (isalpha(*it))
|
if (isalpha(*it))
|
||||||
in_ansi = false;
|
in_ansi = false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue