diff --git a/README.md b/README.md index 26ec8664..b61bb792 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,6 @@ GITUI_LOGGING=true gitui # todo for 0.1 (first release) -* [ ] fix: diff broken at end of file * [ ] fix: reset unstaged file also resets staged hunks * [ ] better help command * [ ] -> fix: dont show scroll option when any popup open @@ -67,4 +66,7 @@ GITUI_LOGGING=true gitui * https://github.com/jesseduffield/lazygit * https://github.com/jonas/tig -* https://github.com/git-up/GitUp (would be nice to comeup with a way to have the map view available in a terminal tool) \ No newline at end of file +* https://github.com/git-up/GitUp (would be nice to comeup with a way to have the map view available in a terminal tool) + + +asdad \ No newline at end of file diff --git a/src/components/diff.rs b/src/components/diff.rs index 1bb18a09..b66e277a 100644 --- a/src/components/diff.rs +++ b/src/components/diff.rs @@ -133,6 +133,7 @@ impl DiffComponent { Color::Reset }) .fg(Color::DarkGray); + if end_of_hunk { text.push(Text::Styled( Cow::from(symbols::line::BOTTOM_LEFT), @@ -170,11 +171,15 @@ impl DiffComponent { let filled = if selected { format!( "{:w$}\n", - line.content.trim_end(), + line.content.trim_matches('\n'), w = width as usize ) } else { - line.content.clone() + if line.content.matches('\n').count() == 1 { + line.content.clone() + } else { + format!("{}\n", line.content.trim_matches('\n')) + } }; let content = Cow::from(filled);