Kinda fix pager(1) man bullet points.

This commit is contained in:
Jonas 'Sortie' Termansen 2024-01-06 17:05:42 +00:00
parent f248b826f8
commit 08d03b2190
1 changed files with 17 additions and 5 deletions

View File

@ -333,18 +333,30 @@ static void push_wchar(wchar_t wc)
{ {
if ( incoming_line_width ) if ( incoming_line_width )
incoming_line_width--; incoming_line_width--;
while ( line->content_used && size_t index = line->content_used;
(line->content[line->content_used-1] & 0xC0) == 0x80 ) const char* unbold = "\e[22m";
line->content_used--; if ( strlen(unbold) <= index &&
if ( line->content_used ) !memcmp(unbold, line->content + index - strlen(unbold), strlen(unbold)) )
index -= strlen(unbold);
while ( index && (line->content[index-1] & 0xC0) == 0x80 )
index--;
const char* bold = "\e[1m";
if ( strlen(bold) <= index &&
!memcmp(bold, line->content + index - strlen(bold), strlen(bold)) )
{ {
char c = line->content[--line->content_used]; index -= strlen(bold);
next_bold = true;
}
if ( index )
{
char c = line->content[index - 1];
if ( c == '_' ) if ( c == '_' )
next_underline = true; next_underline = true;
else if ( c == ' ' ) else if ( c == ' ' )
next_bold = false; next_bold = false;
else else
next_bold = true; next_bold = true;
line_push_char(line, '\b');
} }
return; return;
} }