editor: Push em
width calculations down into EditorSnapshot::gutter_dimensions
(#24062)
This PR removes the `em_width` and `em_advance` parameters to `EditorSnapshot::gutter_dimensions` in favor of computing the values inside of it. In practice all of the callers were passing in the same values, and there isn't a circumstance where we would want to pass in different values. `gutter_dimensions` has also been modified to return `Option<GutterDimensions>` instead of `GutterDimensions` so that we can remove some `.unwrap`s when interacting with the text system. Release Notes: - N/A
This commit is contained in:
parent
17872260e6
commit
52a3013d73
3 changed files with 30 additions and 29 deletions
|
@ -45,6 +45,9 @@ actions!(
|
|||
]
|
||||
);
|
||||
|
||||
/// The length of a Git short SHA.
|
||||
pub const SHORT_SHA_LENGTH: usize = 7;
|
||||
|
||||
#[derive(Clone, Copy, Eq, Hash, PartialEq)]
|
||||
pub struct Oid(libgit::Oid);
|
||||
|
||||
|
@ -64,7 +67,7 @@ impl Oid {
|
|||
|
||||
/// Returns this [`Oid`] as a short SHA.
|
||||
pub fn display_short(&self) -> String {
|
||||
self.to_string().chars().take(7).collect()
|
||||
self.to_string().chars().take(SHORT_SHA_LENGTH).collect()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue