Merge pull request #1462 from zed-industries/crash-on-goto-diagnostic

Fix two crashes related to diagnostics and bugs in mouse-based columnar selection
This commit is contained in:
Max Brunsfeld 2022-08-03 12:04:56 -07:00 committed by GitHub
commit 6e76bd32da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 116 additions and 110 deletions

View file

@ -238,8 +238,10 @@ impl Line {
None
}
// If round_to_closest, find the closest index to the given x position
// If !round_to_closest, find the largest index before the given x position
pub fn len(&self) -> usize {
self.layout.len
}
pub fn index_for_x(&self, x: f32) -> Option<usize> {
if x >= self.layout.width {
None