fix files loading text sometimes wrong (closes #119)

This commit is contained in:
Stephan Dilly 2020-06-12 16:59:13 +02:00
parent b80df36cdf
commit dd69d9b559
2 changed files with 14 additions and 13 deletions

View File

@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- reset file inside folder failed when running `gitui` in a subfolder too ([#118](https://github.com/extrawurst/gitui/issues/118))
- selection could disappear into collapsed folder ([#120](https://github.com/extrawurst/gitui/issues/120))
- `Files: loading` sometimes wrong ([#119](https://github.com/extrawurst/gitui/issues/119))
## [0.6.0] - 2020-06-09

View File

@ -48,11 +48,10 @@ impl CommitDetailsComponent {
}
}
fn get_files_title(&self) -> String {
let files_loading = self.git_commit_files.is_pending();
fn get_files_title(&self, loading: bool) -> String {
let files_count = self.file_tree.file_count();
if files_loading {
if loading {
strings::commit::DETAILS_FILES_LOADING_TITLE.to_string()
} else {
format!(
@ -77,17 +76,18 @@ impl CommitDetailsComponent {
{
if fetched_id == id {
self.file_tree.update(res.as_slice())?;
} else {
self.file_tree.clear()?;
self.git_commit_files.fetch(id)?;
}
} else {
self.file_tree.clear()?;
self.git_commit_files.fetch(id)?;
}
}
self.file_tree
.set_title(self.get_files_title(false));
self.file_tree.set_title(self.get_files_title());
return Ok(());
}
}
self.file_tree.clear()?;
self.git_commit_files.fetch(id)?;
self.file_tree.set_title(self.get_files_title(true));
} else {
self.file_tree.set_title(self.get_files_title(false));
}
Ok(())
}