Bug 473362

Summary: word-diff markers in git diff are vertically misaligned
Product: [Applications] kate Reporter: Robert Riemann <robert>
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: minor CC: waqar.17a
Priority: NOR    
Version First Reported In: 23.04.3   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 23.08
Sentry Crash Report:
Attachments: screenshot showing the problem
test.md that I commited first
test.md with some changes to reproduce the problem in kate diff view

Description Robert Riemann 2023-08-14 13:02:08 UTC
Created attachment 160948 [details]
screenshot showing the problem

SUMMARY

The git diff view of Kate marks (a) lines with a change with a light color tone and (b) words with a change within that line with a stronger color tone.

However, that background color for (b) words increasingly to low with the number of softbreaks in that line. While words before the first softbreak are vertically well aligned, the background color mark after several soft breaks is too low and even placed under the actual line.


STEPS TO REPRODUCE
1. create a git repository with some random text in file test.md
2. commit that test.md
2. change a word at the end of a very long line in test.md
3. view the git diff of test.md in Kate and check the word diff color background

Additional info: I use as font JetBrains Mono (https://www.jetbrains.com/lp/mono/)
Comment 1 Waqar Ahmed 2023-08-14 13:27:40 UTC
Hi,

can you share the text files that you used?
Comment 2 Robert Riemann 2023-08-14 13:47:11 UTC
Created attachment 160949 [details]
test.md that I commited first
Comment 3 Robert Riemann 2023-08-14 13:47:48 UTC
Created attachment 160950 [details]
test.md with some changes to reproduce the problem in kate diff view
Comment 4 Waqar Ahmed 2023-08-14 14:40:39 UTC
Git commit d6f41fea4db80b8b1dc47b1ee240756febb53f5f by Waqar Ahmed.
Committed on 14/08/2023 at 16:40.
Pushed by waqar into branch 'master'.

Use QFontMetrics::lineSpacing to calculate the line y offset

M  +2    -2    apps/lib/diff/diffeditor.cpp

https://invent.kde.org/utilities/kate/-/commit/d6f41fea4db80b8b1dc47b1ee240756febb53f5f
Comment 5 Waqar Ahmed 2023-08-14 14:41:40 UTC
Git commit 705aaac1b8624f529049af6e18a9c76d725237b0 by Waqar Ahmed.
Committed on 14/08/2023 at 16:41.
Pushed by waqar into branch 'release/23.08'.

Use QFontMetrics::lineSpacing to calculate the line y offset
(cherry picked from commit d6f41fea4db80b8b1dc47b1ee240756febb53f5f)

M  +2    -2    apps/lib/diff/diffeditor.cpp

https://invent.kde.org/utilities/kate/-/commit/705aaac1b8624f529049af6e18a9c76d725237b0