Make minimum width for line numbers in gutter configurable (#31959)
Closes #7334 # Changes This PR makes the minimum width allocated for line numbers in the side gutter configurable in units of character width via the `"line_number_base_width"` attribute in `gutter` settings. Set the previously hard coded value of `4` as default. Together with other settings (`"folds"`, `"breakpoints"`,...) this gives the user control over the gutter width. If the number of lines exceedes the base width, the number of digits in the largest line number is chosen instead. This is consistent with previous behaviour. Screenshot for reference: <img width="1104" alt="Screenshot 2025-06-03 at 12 15 29" src="https://github.com/user-attachments/assets/77c869ad-164b-4b74-8e39-8be43d740ad4" /> P.S.: This is my first time contributing to zed (yay!🎉). Let me know if i'm missing something. Release Notes: - Make minimum line number width in gutter configurable
This commit is contained in:
@@ -150,6 +150,7 @@ impl Minimap {
|
||||
|
||||
#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
|
||||
pub struct Gutter {
|
||||
pub min_line_number_digits: usize,
|
||||
pub line_numbers: bool,
|
||||
pub runnables: bool,
|
||||
pub breakpoints: bool,
|
||||
@@ -609,6 +610,10 @@ pub struct GutterContent {
|
||||
///
|
||||
/// Default: true
|
||||
pub line_numbers: Option<bool>,
|
||||
/// Minimum number of characters to reserve space for in the gutter.
|
||||
///
|
||||
/// Default: 4
|
||||
pub min_line_number_digits: Option<usize>,
|
||||
/// Whether to show runnable buttons in the gutter.
|
||||
///
|
||||
/// Default: true
|
||||
|
||||
Reference in New Issue
Block a user