co-authored by
Max Brunsfeld
parent
ec2e1c3045
commit
c9d7249305
@@ -18,7 +18,7 @@ use crate::{
|
||||
worktree::FileHandle,
|
||||
};
|
||||
use anyhow::{anyhow, Result};
|
||||
use gpui::{AppContext, Entity, ModelContext};
|
||||
use gpui::{Entity, ModelContext};
|
||||
use lazy_static::lazy_static;
|
||||
use rand::prelude::*;
|
||||
use std::{
|
||||
@@ -26,7 +26,7 @@ use std::{
|
||||
hash::BuildHasher,
|
||||
iter::{self, Iterator},
|
||||
ops::{AddAssign, Range},
|
||||
path::PathBuf,
|
||||
path::Path,
|
||||
str,
|
||||
sync::Arc,
|
||||
time::{Duration, Instant},
|
||||
@@ -429,11 +429,11 @@ impl Buffer {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn path(&self, app: &AppContext) -> Option<PathBuf> {
|
||||
self.file.as_ref().map(|file| file.path(app))
|
||||
pub fn path(&self) -> Option<&Arc<Path>> {
|
||||
self.file.as_ref().map(|file| file.path())
|
||||
}
|
||||
|
||||
pub fn entry_id(&self) -> Option<(usize, u64)> {
|
||||
pub fn entry_id(&self) -> Option<(usize, Arc<Path>)> {
|
||||
self.file.as_ref().map(|file| file.entry_id())
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ use std::{
|
||||
fmt::Write,
|
||||
iter::FromIterator,
|
||||
ops::Range,
|
||||
path::Path,
|
||||
sync::Arc,
|
||||
time::Duration,
|
||||
};
|
||||
@@ -1375,7 +1376,7 @@ impl workspace::ItemView for BufferView {
|
||||
}
|
||||
|
||||
fn title(&self, app: &AppContext) -> std::string::String {
|
||||
if let Some(path) = self.buffer.read(app).path(app) {
|
||||
if let Some(path) = self.buffer.read(app).path() {
|
||||
path.file_name()
|
||||
.expect("buffer's path is always to a file")
|
||||
.to_string_lossy()
|
||||
@@ -1385,7 +1386,7 @@ impl workspace::ItemView for BufferView {
|
||||
}
|
||||
}
|
||||
|
||||
fn entry_id(&self, app: &AppContext) -> Option<(usize, u64)> {
|
||||
fn entry_id(&self, app: &AppContext) -> Option<(usize, Arc<Path>)> {
|
||||
self.buffer.read(app).entry_id()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user