editor: Add trailing whitespace rendering (#32329)

Closes #5237

- Adds "trailing" option for "show_whitespaces" in settings.json
- Supports importing this setting from vscode

The option in question will render only whitespace characters that
appear after every non-whitespace character in a given line.

Release Notes:

- Added trailing whitespace rendering
This commit is contained in:
JonasKaplan
2025-06-09 20:48:49 +00:00
committed by GitHub
parent f0345df479
commit f0ce62ead8
2 changed files with 15 additions and 1 deletions
+11
View File
@@ -7329,6 +7329,17 @@ impl LineWithInvisibles {
paint(window, cx);
}),
ShowWhitespaceSetting::Trailing => {
let mut previous_start = self.len;
for ([start, end], paint) in invisible_iter.rev() {
if previous_start != end {
break;
}
previous_start = start;
paint(window, cx);
}
}
// For a whitespace to be on a boundary, any of the following conditions need to be met:
// - It is a tab
// - It is adjacent to an edge (start or end)