Skip to content

Commit

Permalink
do not highlight selection in diff when not focused (closes #270)
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephan Dilly committed Sep 2, 2020
1 parent d179b6b commit 56959e6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 8 additions & 4 deletions src/components/diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
Expand Down

0 comments on commit 56959e6

Please sign in to comment.