Bug 489692

Summary: [WISH] Show changes in git in gutter
Product: [Applications] kate Reporter: Diego Gangl <diego>
Component: applicationAssignee: KWrite Developers <kwrite-bugs-null>
Status: CONFIRMED ---    
Severity: wishlist CC: 24f1002582, droidgoo, hackimos, kdedev, waqar.17a
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: All   
See Also: https://bugs.kde.org/show_bug.cgi?id=489696
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Diego Gangl 2024-07-03 18:37:25 UTC
SUMMARY

There's an option to mark which lines have changed or unsaved lines in the left side border, but this only accounts for the time the file has been open and edited in kate. This isn't super useful when working with a VCS, and it's often confusing since one might think there are uncommited changes but it's really a line that was changed at some point and it's already saved and commited. 

It would be nice to have the same highlights but showing what has changed in Git (or any VCS the project plugin supports).
Comment 1 TraceyC 2024-07-10 21:27:45 UTC
I can confirm the behavior described.

I'm using the following plugins:
    Project plugin (commit / status / branch compare / stashing / file history)
    Documents Plugin (file history)
    Git blame (git blame support)

I also have the setting enabled to highlight changed lines (saved / unsaved)
If I change a word in a line of a file, and then change it back and save, the line has a green highlight in the left hand bar
The file has not changed vs. what is merged in the git branch

In contrast, here's how VS Code handles it:
- Open a file that is up to date with the local and remote branches
- Delete a word from a line and save - the line has a blue highlight (changed vs. branch)
- Restore the word - highlight is removed even before the file is saved (same as branch)
- Add a new line and save - line has a green highlight (new line vs branch)
Comment 2 Waqar Ahmed 2024-07-19 07:06:04 UTC
Would need to be implemented in KTextEditor as an optional feature.
Comment 3 goo 2025-01-04 20:49:18 UTC
would it help with this issue if the settings were to split up saved and unsaved highlights?

it would be nice if there were a way to just not have the green saved highlight, but keep the red unsaved ones.
Comment 4 Rakshit Kumar Singh 2025-01-07 13:34:41 UTC
(In reply to goo from comment #3)
> would it help with this issue if the settings were to split up saved and
> unsaved highlights?
> 
> it would be nice if there were a way to just not have the green saved
> highlight, but keep the red unsaved ones.

Yup same issue I was facing https://discuss.kde.org/t/how-to-disable-green-change-indicators-in-kate-after-saving/27814

I tried to get my hands dirty and add that feature myself but currently stuck because `Configure Kate...` seems to be not part of the source repo. (I might be incorrect sorry)

Can someone guide me to it. I will try to make this feature in upcoming day.
Comment 5 Waqar Ahmed 2025-01-13 11:38:16 UTC
See the KateMainWindow::slotConfigure() function.
Comment 6 hakro 2025-04-29 11:38:49 UTC
I can confirm as well.
Enabling "Highlight changed and unsaved lines" has the weird behavior of still highlighting the line, even if you revert all changes. The only way to make it go away is to restart Kate.
I also think it would make sense to have the highlight match git changes, or at the very least, actually highlight unsaved changes, but not changed then reverted changes.
Git-modified files are already marked as such in the project explorer, it would be great to also have that extended to the individual lines.

Cheers
Comment 7 Waqar Ahmed 2025-04-29 16:04:00 UTC
> The only way to make it go away is to restart Kate.

You can press F5 to make them go away