fix(workbench): drop trailing blank lines from CSV ResourceView

Avoid an empty last table row when files end with a newline.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
cflmyandCursor committed 2026-10-27 14:03:40 +08:00
1 parent 43eebe5671
commit a32638e935
1 file changed
+4 -1
+4 -1
View File
@@ -403,7 +403,10 @@ fn render_csv_view(
"message": format!("preview truncated at {max_bytes} bytes")
}));
}
let rows: Vec<&str> = text.lines().collect();
let mut rows: Vec<&str> = text.lines().collect();
while rows.last().is_some_and(|l| l.trim().is_empty()) {
rows.pop();
}
let shown = rows.len().min(CSV_MAX_ROWS + 1); // header + data
if rows.len() > CSV_MAX_ROWS + 1 {
diagnostics.push(json!({