Don't allow open excerpts in commit view for now (#27862)
Follow-up to https://github.com/zed-industries/zed/pull/27636 Release Notes: - N/A
This commit is contained in:
parent
133d3f052f
commit
b59967bbdf
2 changed files with 11 additions and 1 deletions
|
@ -17212,6 +17212,9 @@ impl Editor {
|
|||
}
|
||||
}
|
||||
|
||||
new_selections_by_buffer
|
||||
.retain(|buffer, _| Self::can_open_excerpts_in_file(buffer.read(cx).file()));
|
||||
|
||||
if new_selections_by_buffer.is_empty() {
|
||||
return;
|
||||
}
|
||||
|
@ -17280,6 +17283,12 @@ impl Editor {
|
|||
});
|
||||
}
|
||||
|
||||
// For now, don't allow opening excerpts in buffers that aren't backed by
|
||||
// regular project files.
|
||||
fn can_open_excerpts_in_file(file: Option<&Arc<dyn language::File>>) -> bool {
|
||||
file.map_or(true, |file| project::File::from_dyn(Some(file)).is_some())
|
||||
}
|
||||
|
||||
fn marked_text_ranges(&self, cx: &App) -> Option<Vec<Range<OffsetUtf16>>> {
|
||||
let snapshot = self.buffer.read(cx).read(cx);
|
||||
let (_, ranges) = self.text_highlights::<InputComposition>(cx)?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue