do not highlight selection in diff when not focused (closes #270)

This commit is contained in:
Stephan Dilly 2020-09-02 11:11:17 +02:00
parent d179b6bb8b
commit 56959e6596
2 changed files with 11 additions and 4 deletions

View File

@ -10,6 +10,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- push to origin support ([#265](https://github.com/extrawurst/gitui/issues/265))
### Changed
- do not highlight selection in diff view when not focused ([#270](https://github.com/extrawurst/gitui/issues/270))
## [0.10.1] - 2020-09-01
### Fixed

View File

@ -349,8 +349,10 @@ impl DiffComponent {
let mut lines_added = 0_usize;
for (i, hunk) in diff.hunks.iter().enumerate() {
let hunk_selected =
self.selected_hunk.map_or(false, |s| s == i);
let hunk_selected = self.focused()
&& self
.selected_hunk
.map_or(false, |s| s == i);
if lines_added >= height as usize {
break;
@ -372,8 +374,10 @@ impl DiffComponent {
&mut res,
width,
line,
self.selection
.contains(line_cursor),
self.focused()
&& self
.selection
.contains(line_cursor),
hunk_selected,
i == hunk_len as usize - 1,
&self.theme,