fix(reader): skip leading newlines after page split to prevent blank top/bottom
This commit is contained in:
@@ -438,11 +438,17 @@ pub fn calculate_pages(text: &str, chars_per_line: usize, lines_per_page: usize)
|
|||||||
split = i;
|
split = i;
|
||||||
}
|
}
|
||||||
if split < total {
|
if split < total {
|
||||||
pages.push(split);
|
// Skip leading newlines to prevent starting page with blank line
|
||||||
page_start = split;
|
while split < total && chars[split] == '\n' {
|
||||||
line_count = 0;
|
split += 1;
|
||||||
line_pos = 0;
|
}
|
||||||
i = split;
|
if split < total {
|
||||||
|
pages.push(split);
|
||||||
|
page_start = split;
|
||||||
|
line_count = 0;
|
||||||
|
line_pos = 0;
|
||||||
|
i = split;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user