Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ mdterm README.md | less -R
| `Y` | Copy entire document to clipboard |
| `c` | Copy nearest code block to clipboard |
| `Tab` / `Shift+Tab` | Switch between files |
| `F1` | Help screen |
| `h` / `?` / `F1` | Help screen |
| `q` / `Ctrl+C` | Quit |

### Slide Mode (`--slides`)
Expand Down
11 changes: 4 additions & 7 deletions src/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2471,10 +2471,8 @@ mod tests {
let addr = listener.local_addr().ok()?;
let base = format!("http://127.0.0.1:{}", addr.port());
std::thread::spawn(move || {
for stream in listener.incoming() {
if let Ok(stream) = stream {
let _ = (handler)(stream);
}
for stream in listener.incoming().flatten() {
(handler)(stream);
}
});
Some((base, addr))
Expand Down Expand Up @@ -2511,9 +2509,8 @@ mod tests {
let n = stream.read(&mut buf).unwrap_or(0);
let req = String::from_utf8_lossy(&buf[..n]);
if req.contains("GET /redirect") {
let resp = format!(
"HTTP/1.1 302 Found\r\nLocation: /image.png\r\nContent-Length: 0\r\n\r\n"
);
let resp =
"HTTP/1.1 302 Found\r\nLocation: /image.png\r\nContent-Length: 0\r\n\r\n";
let _ = stream.write_all(resp.as_bytes());
} else {
let body = png.clone();
Expand Down
10 changes: 5 additions & 5 deletions src/markdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -574,8 +574,8 @@ impl<'a> Renderer<'a> {
flex_remaining -= 1;
if flex_remaining == 0 {
*w = remaining;
} else if flex_natural > 0 {
let share = (*w * flex_available / flex_natural).max(3);
} else if let Some(share) = (*w * flex_available).checked_div(flex_natural) {
let share = share.max(3);
*w = share;
remaining = remaining.saturating_sub(share);
}
Expand Down Expand Up @@ -1733,7 +1733,7 @@ mod tests {
fn unordered_list_has_bullets() {
let input = "- item one\n- item two";
let (lines, _) = render_test(input);
let texts: Vec<String> = lines.iter().map(|l| line_text(l)).collect();
let texts: Vec<String> = lines.iter().map(line_text).collect();
let bullet_lines: Vec<_> = texts.iter().filter(|t| t.contains('•')).collect();
assert_eq!(bullet_lines.len(), 2);
}
Expand All @@ -1742,7 +1742,7 @@ mod tests {
fn ordered_list_has_numbers() {
let input = "1. first\n2. second";
let (lines, _) = render_test(input);
let texts: Vec<String> = lines.iter().map(|l| line_text(l)).collect();
let texts: Vec<String> = lines.iter().map(line_text).collect();
assert!(texts.iter().any(|t| t.contains("1.")));
assert!(texts.iter().any(|t| t.contains("2.")));
}
Expand All @@ -1753,7 +1753,7 @@ mod tests {
fn blockquote_produces_styled_output() {
let input = "> quoted text";
let (lines, _) = render_test(input);
let texts: Vec<String> = lines.iter().map(|l| line_text(l)).collect();
let texts: Vec<String> = lines.iter().map(line_text).collect();
assert!(texts.iter().any(|t| t.contains("quoted text")));
}

Expand Down
8 changes: 4 additions & 4 deletions src/style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ mod tests {
assert!(line.display_width() <= 4);
}
// All characters preserved
let all: String = wrapped.iter().map(|l| line_text(l)).collect();
let all: String = wrapped.iter().map(line_text).collect();
assert_eq!(all, "abcdefghij");
}

Expand Down Expand Up @@ -419,7 +419,7 @@ mod tests {
line.display_width()
);
}
let all: String = wrapped.iter().map(|l| line_text(l)).collect();
let all: String = wrapped.iter().map(line_text).collect();
assert_eq!(all, "你好世界测试");
}

Expand All @@ -435,7 +435,7 @@ mod tests {
for line in &wrapped {
assert!(line.display_width() <= 4);
}
let all: String = wrapped.iter().map(|l| line_text(l)).collect();
let all: String = wrapped.iter().map(line_text).collect();
assert_eq!(all, "🎉🎊🎈");
}

Expand Down Expand Up @@ -467,7 +467,7 @@ mod tests {
"first span should preserve bold style"
);
// All text should be preserved across wrapped lines
let all_text: String = wrapped.iter().map(|l| line_text(l)).collect();
let all_text: String = wrapped.iter().map(line_text).collect();
assert!(all_text.contains("bold"));
assert!(all_text.contains("normal"));
assert!(all_text.contains("text"));
Expand Down
Loading
Loading