mirror of
https://github.com/extrawurst/gitui.git
synced 2024-11-23 03:32:30 +03:00
fix wrong file loaded in tree view
This commit is contained in:
parent
82f5496b04
commit
4fb523b9b1
@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## Unreleased
|
||||
|
||||
## Fixed
|
||||
- wrong file with same name shown in file tree ([#748](https://github.com/extrawurst/gitui/issues/748))
|
||||
|
||||
## [0.16.0] - 2021-05-28
|
||||
|
||||
**merge branch, merge commit**
|
||||
|
@ -148,20 +148,22 @@ impl RevisionFilesComponent {
|
||||
|
||||
fn selection_changed(&mut self) {
|
||||
//TODO: retrieve TreeFile from tree datastructure
|
||||
if let Some(file) = self.tree.selected_file().map(|file| {
|
||||
file.full_path()
|
||||
.strip_prefix("./")
|
||||
.unwrap_or_default()
|
||||
.to_string()
|
||||
}) {
|
||||
if let Some(item) = self
|
||||
.files
|
||||
.iter()
|
||||
.find(|f| f.path.ends_with(Path::new(&file)))
|
||||
if let Some(file) = self
|
||||
.tree
|
||||
.selected_file()
|
||||
.map(|file| file.full_path().to_string())
|
||||
{
|
||||
let path = Path::new(&file);
|
||||
if let Some(item) =
|
||||
self.files.iter().find(|f| f.path == path)
|
||||
{
|
||||
self.current_file.load_file(file, item);
|
||||
if let Ok(path) = path.strip_prefix("./") {
|
||||
return self.current_file.load_file(
|
||||
path.to_string_lossy().to_string(),
|
||||
item,
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
self.current_file.clear();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user