Add a line numbers toggle to the editor controls menu (#26318)

Closes https://github.com/zed-industries/zed/issues/26305

<img
src="https://github.com/user-attachments/assets/795029ad-128a-471f-9adf-c0ef26319bbf"
width="400px" />

Release Notes:

- N/A
This commit is contained in:
Danilo Leal 2025-03-10 09:28:46 -03:00 committed by GitHub
parent 5ed144f9d2
commit ee05cc3ad9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 60 additions and 29 deletions

View file

@ -14303,6 +14303,13 @@ impl Editor {
EditorSettings::override_global(editor_settings, cx);
}
pub fn line_numbers_enabled(&self, cx: &App) -> bool {
if let Some(show_line_numbers) = self.show_line_numbers {
return show_line_numbers;
}
EditorSettings::get_global(cx).gutter.line_numbers
}
pub fn should_use_relative_line_numbers(&self, cx: &mut App) -> bool {
self.use_relative_line_numbers
.unwrap_or(EditorSettings::get_global(cx).relative_line_numbers)