mirror of
https://github.com/urbit/shrub.git
synced 2024-11-28 05:22:27 +03:00
Fix broken first-byte cases in ++lune
Was broken when first byte was a newline, and when first byte was the only byte.
This commit is contained in:
parent
e7f3836bcb
commit
db30dbfb00
@ -20,14 +20,26 @@
|
|||||||
return u3m_error("noeol");
|
return u3m_error("noeol");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pos_w == 0) {
|
||||||
|
if (u3r_byte(0, lub) == 10) {
|
||||||
|
return u3nc(u3_nul, lin);
|
||||||
|
} else {
|
||||||
|
return u3m_error("noeol");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
while (--pos_w) {
|
while (--pos_w) {
|
||||||
if (u3r_byte(pos_w, lub) == 10) {
|
if (u3r_byte(pos_w, lub) == 10) {
|
||||||
lin = u3nc(u3qc_cut(3, (pos_w + 1), (end_w - pos_w - 1), lub), lin);
|
lin = u3nc(u3qc_cut(3, (pos_w + 1), (end_w - pos_w - 1), lub), lin);
|
||||||
end_w = pos_w;
|
end_w = pos_w;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (u3r_byte(pos_w, lub) == 10) {
|
||||||
|
return u3nc(u3_nul,
|
||||||
|
u3nc(u3qc_cut(3, pos_w, (end_w - pos_w), lub), lin));
|
||||||
|
}
|
||||||
|
|
||||||
return u3nc(u3qc_cut(3, pos_w, (end_w - pos_w), lub), lin);
|
return u3nc(u3qc_cut(3, pos_w, (end_w - pos_w), lub), lin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user