Document global debug.json usage and fix REPL error copy (#40836)
## Overview - document how to keep a per-user debug.json so global launch tasks show up everywhere (Fixes #39849) - sanitize REPL terminal text before copying so error blocks can be copied and opened in buffers (Fixes #40207) ## Design Decisions - reused the existing user debug file (paths::debug_scenarios_file) and pointed docs at the zed::OpenDebugTasks command to stay aligned with the settings UX - extract a sanitize helper inside TerminalOutput::full_text to strip \r/null padding while keeping indentation intact, then join the cleaned lines so clipboard and buffers get readable text ## Testing - Not run (cargo is unavailable in this environment) Fixes #39849. Fixes #40207.
This commit is contained in:
@@ -198,7 +198,16 @@ impl TerminalOutput {
|
||||
}
|
||||
|
||||
fn full_text(&self) -> String {
|
||||
let mut full_text = String::new();
|
||||
fn sanitize(mut line: String) -> Option<String> {
|
||||
line.retain(|ch| ch != '\u{0}' && ch != '\r');
|
||||
if line.trim().is_empty() {
|
||||
return None;
|
||||
}
|
||||
let trimmed = line.trim_end_matches([' ', '\t']);
|
||||
Some(trimmed.to_owned())
|
||||
}
|
||||
|
||||
let mut lines = Vec::new();
|
||||
|
||||
// Get the total number of lines, including history
|
||||
let total_lines = self.handler.grid().total_lines();
|
||||
@@ -210,11 +219,8 @@ impl TerminalOutput {
|
||||
let line_index = Line(-(line as i32) - 1);
|
||||
let start = Point::new(line_index, Column(0));
|
||||
let end = Point::new(line_index, Column(self.handler.columns() - 1));
|
||||
let line_content = self.handler.bounds_to_string(start, end);
|
||||
|
||||
if !line_content.trim().is_empty() {
|
||||
full_text.push_str(&line_content);
|
||||
full_text.push('\n');
|
||||
if let Some(cleaned) = sanitize(self.handler.bounds_to_string(start, end)) {
|
||||
lines.push(cleaned);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,15 +229,18 @@ impl TerminalOutput {
|
||||
let line_index = Line(line as i32);
|
||||
let start = Point::new(line_index, Column(0));
|
||||
let end = Point::new(line_index, Column(self.handler.columns() - 1));
|
||||
let line_content = self.handler.bounds_to_string(start, end);
|
||||
|
||||
if !line_content.trim().is_empty() {
|
||||
full_text.push_str(&line_content);
|
||||
full_text.push('\n');
|
||||
if let Some(cleaned) = sanitize(self.handler.bounds_to_string(start, end)) {
|
||||
lines.push(cleaned);
|
||||
}
|
||||
}
|
||||
|
||||
full_text
|
||||
if lines.is_empty() {
|
||||
String::new()
|
||||
} else {
|
||||
let mut full_text = lines.join("\n");
|
||||
full_text.push('\n');
|
||||
full_text
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user