editor: Render boundary whitespace (#11954)

![image](https://github.com/zed-industries/zed/assets/1240491/3dd06e45-ae8e-49d5-984d-3d8bdf98d983)

Added support for only rendering whitespace that is on a
boundary, the logic of which is explained below:

- Any tab character
- Whitespace at the start and end of a line
- Whitespace that is directly adjacent to another whitespace


Release Notes:

- Added `boundary` whitespace rendering option
([#4290](https://github.com/zed-industries/zed/issues/4290)).




---------

Co-authored-by: Nicholas Cioli <nicholascioli@users.noreply.github.com>
This commit is contained in:
Nicholas Cioli 2024-06-05 07:02:55 -04:00 committed by GitHub
parent 63a8095879
commit 0289c312c9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 102 additions and 19 deletions

View file

@ -391,6 +391,13 @@ pub enum ShowWhitespaceSetting {
None,
/// Draw all invisible symbols.
All,
/// Draw whitespace only at boundaries.
///
/// 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)
/// - It is adjacent to a whitespace (left or right)
Boundary,
}
/// Controls which formatter should be used when formatting code.