Bug 473362 - word-diff markers in git diff are vertically misaligned
Summary: word-diff markers in git diff are vertically misaligned
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: general (show other bugs)
Version: 23.04.3
Platform: openSUSE Linux
: NOR minor
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-08-14 13:02 UTC by Robert Riemann
Modified: 2023-08-14 15:24 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 23.08
Sentry Crash Report:


Attachments
screenshot showing the problem (815.53 KB, image/png)
2023-08-14 13:02 UTC, Robert Riemann
Details
test.md that I commited first (4.94 KB, text/markdown)
2023-08-14 13:47 UTC, Robert Riemann
Details
test.md with some changes to reproduce the problem in kate diff view (4.95 KB, text/markdown)
2023-08-14 13:47 UTC, Robert Riemann
Details

Note You need to log in before you can comment on or make changes to this bug.
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