1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-30 03:26:23 -04:00

Fix a bug in the plaintext renderer when handling tabs

Commit 3ce3f01f30 introduced a bug whereby
if a tab set the current position in the line to or greater than the number
of bytes remaining in the source, the line was split after the tab.
This commit is contained in:
Miciah Dashiel Butler Masters 2006-06-15 22:58:56 +00:00 committed by Miciah Dashiel Butler Masters
parent 81b4f8b917
commit bfc8b17d64

View File

@ -671,10 +671,12 @@ add_document_lines(struct plain_renderer *renderer)
int last_space = 0;
int tab_spaces = 0;
int step = 0;
int doc_width = int_min(renderer->max_width, length);
/* End of line detection: We handle \r, \r\n and \n types. */
for (width = 0; width + tab_spaces < doc_width; width++) {
for (width = 0;
width + tab_spaces < renderer->max_width
&& width < length;
width++) {
if (source[width] == ASCII_CR)
step++;
if (source[width + step] == ASCII_LF)