[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
hard to understand code for the representation of tab
From: |
Patrice Dumas |
Subject: |
hard to understand code for the representation of tab |
Date: |
Sat, 12 Oct 2024 21:15:10 +0200 |
Hello,
This is not important, but in the info code, in info/util.c in the
printed_representation function, which returns a pointer to string that
is the printed representation of character (or other logical unit) if it
were printed at a given screen column.
l 226 for tab there is a code that I do not understand at all,
*pchars = ((pl_chars + 8) & 0xf8) - pl_chars;
A bit more context for the variables:
pl_chars: size_t the string column the printed representation of character
should be printed at
rep: text buffer corresponding to the returned value
pchars: int gets the number of screen columns taken up by the return value
pbytes: int gets the number of bytes in returned string
here is more context for the code:
else if (*cur_ptr == '\t')
{
int i = 0;
*pchars = ((pl_chars + 8) & 0xf8) - pl_chars;
*pbytes = *pchars;
/* We must output spaces instead of the tab because a tab may
not clear characters already on the screen. */
for (i = 0; i < *pbytes; i++)
text_buffer_add_char (rep, ' ');
return text_buffer_base (rep);
}
--
Pat
- hard to understand code for the representation of tab,
Patrice Dumas <=