`Writer::write_str` does an infinite loop if a line is longer than line_len
```rust
while self.current_line + line.len() >= self.cfg.line_len {
let offset = if let Some(last_ws) = line[..self.cfg.line_len - self.current_line]
.chars()
.rev()
.position(|c| c.is_whitespace())
{
// found a nice whitespace to break on!
self.writer.write_str(&line[..last_ws])?;
last_ws
} else {
0
};
self.writer.write_char('\n')?;
self.write_newline()?;
self.writer.write_str(" ")?;
self.current_line += 1;
line = &line[offset..];
}
```
if there's no whitespace in `line[..self.cfg.line_len - self.current_line]` we uh, advance by zero, write a newline, then try again. i held down `z` for a while to see if the new 16550 code does anything weird on faster inputs and noticed uh, this.
on one hand, https://github.com/hawkw/mycelium/issues/493, on the other hand, the wrapping probably makes sense for non-serial-port readers (like, it's better to wrap smartly in the framebuffer than dumbly?)
关闭于 2025-09-20 0 条评论