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:
1 parent
43eebe5671
commit
a32638e935
1 file changed
+4
-1
@@ -403,7 +403,10 @@ fn render_csv_view(
|
|||||||
"message": format!("preview truncated at {max_bytes} bytes")
|
"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
|
let shown = rows.len().min(CSV_MAX_ROWS + 1); // header + data
|
||||||
if rows.len() > CSV_MAX_ROWS + 1 {
|
if rows.len() > CSV_MAX_ROWS + 1 {
|
||||||
diagnostics.push(json!({
|
diagnostics.push(json!({
|
||||||
|
|||||||
Reference in new issue
Block a user