Draw scrollbar for long commit messages

This commit is contained in:
Timur Aliberdov 2020-10-07 00:47:20 +03:00 committed by Stephan Dilly
parent 32f9a3a4df
commit 7dc72380ce
3 changed files with 15 additions and 2 deletions

View File

@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
![push](assets/push.gif)
- scrollbar in long commit messages ([#308](https://github.com/extrawurst/gitui/issues/308))
### Changed
- do not highlight selection in diff view when not focused ([#270](https://github.com/extrawurst/gitui/issues/270))
- compact treeview [[@WizardOhio24](https://github.com/WizardOhio24)] ([#192](https://github.com/extrawurst/gitui/issues/192))

View File

@ -5,7 +5,7 @@ use crate::{
},
keys::SharedKeyConfig,
strings::{self, order},
ui::style::SharedTheme,
ui::{self, style::SharedTheme},
};
use anyhow::Result;
use asyncgit::{
@ -356,6 +356,17 @@ impl DrawableComponent for DetailsComponent {
chunks[1],
);
if self.focused {
ui::draw_scrollbar(
f,
chunks[1],
&self.theme,
self.get_number_of_lines(width as usize)
.saturating_sub(height as usize),
self.scroll_top.get(),
)
}
Ok(())
}
}

View File

@ -41,7 +41,7 @@ impl Widget for Scrollbar {
vertical: 1,
});
if area.height <= 4 {
if area.height < 4 {
return;
}