fix: ignore blank lines in reflow prefix detection
This commit is contained in:
parent
f55885c48e
commit
919c87e988
1 changed files with 2 additions and 2 deletions
|
|
@ -64,10 +64,10 @@ fn detect_prefix(text: []const u8) Prefix {
|
||||||
const line1 = lines.next() orelse return .{};
|
const line1 = lines.next() orelse return .{};
|
||||||
var prefix: []const u8 = line1;
|
var prefix: []const u8 = line1;
|
||||||
var count: usize = 0;
|
var count: usize = 0;
|
||||||
while (lines.next()) |line| {
|
while (lines.next()) |line| if (line.len > 0) {
|
||||||
prefix = lcp(prefix, line);
|
prefix = lcp(prefix, line);
|
||||||
count += 1;
|
count += 1;
|
||||||
}
|
};
|
||||||
if (count < 1) return .{
|
if (count < 1) return .{
|
||||||
.len = 0,
|
.len = 0,
|
||||||
.first = &.{},
|
.first = &.{},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue