Bug 448655 - Bookmarks are lost after the file is reloaded from "Documents modified on Disk" window
Summary: Bookmarks are lost after the file is reloaded from "Documents modified on Dis...
Status: CONFIRMED
Alias: None
Product: kate
Classification: Applications
Component: general (other bugs)
Version First Reported In: 21.12.1
Platform: Slackware Linux
: NOR wishlist
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
: 407602 (view as bug list)
Depends on:
Blocks:
 
Reported: 2022-01-17 13:36 UTC by Dmitri Koulikoff
Modified: 2022-10-03 20:05 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitri Koulikoff 2022-01-17 13:36:26 UTC
SUMMARY

Bookmarks are lost after the file is reloaded from "Documents modified on Disk" window


STEPS TO REPRODUCE
1. Open or create a non-empty file
2. Place a bookmark on it with Ctrl+B somewhere in the middle.
3. Place cursor somewhere higher
4. Open this file with any other editor and update its content.
5. Return to the first Kate and press "Reload" in the "Documents modified on Disk" window.

OBSERVED RESULT

The bookmark is disappeared.

EXPECTED RESULT

The bookmark must be present.

SOFTWARE/OS VERSIONS
Operating System: Slackware 15.0-rc3
KDE Plasma Version: 5.23.5
KDE Frameworks Version: 5.90.0
Qt Version: 5.15.3
Kernel Version: 5.15.15 (64-bit)
Graphics Platform: X11
Processors: 12 × Intel® Core™ i7-9750H CPU @ 2.60GHz
Memory: 31.1 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics 630

ADDITIONAL INFORMATION
Comment 1 Christoph Cullmann 2022-01-17 17:33:26 UTC
They are only restored if the text lines for the marks have not changed.
e.g. if you insert a new line at the beginning of the document externally, all marks will vanish.
If you just append lines, all should stay.
This is handled in bool KTextEditor::DocumentPrivate::documentReload()
Comment 2 Dmitri Koulikoff 2022-01-17 18:34:43 UTC
(In reply to Christoph Cullmann from comment #1)
> They are only restored if the text lines for the marks have not changed.
> e.g. if you insert a new line at the beginning of the document externally,
> all marks will vanish.
> If you just append lines, all should stay.
> This is handled in bool KTextEditor::DocumentPrivate::documentReload()

The lines with the bookmarks I'm losing never change.  Even if a line is changed the bookmark must not be lost, since a diff is available.
Comment 3 Christoph Cullmann 2022-01-17 19:10:44 UTC
Hi,

the algorithm is as described below.

And no, there is no diff available as that is not implemented in the editor.

Naturally one can improve this by implementing a more versatile detection how to move the bookmarks, but that must be done.

At the moment, if lines move, their bookmarks are lost.

You are free to improve this behavior or find somebody how does that.

And this is no grave bug, sorry, not each and every behavior that doesn't fit your needs is a grave issue.
For others it is inconvenient if bookmarks end up on wrong lines.
Comment 4 Dmitri Koulikoff 2022-01-17 20:47:32 UTC
(In reply to Christoph Cullmann from comment #3)
> Hi,
> 
> the algorithm is as described below.
> 
> And no, there is no diff available as that is not implemented in the editor.

  The diffs are available at the moment I press "Reload" since below is a button "See the diff".
> 
> Naturally one can improve this by implementing a more versatile detection
> how to move the bookmarks, but that must be done.

  I could but I have no time.
> 
> At the moment, if lines move, their bookmarks are lost.

  It is very easy to implement not to do that. Just leave them where they are.
> 
> You are free to improve this behavior or find somebody how does that.

  Thanks, If I had time or a guy I'd do that, but I do not.
> 
> And this is no grave bug, sorry, not each and every behavior that doesn't
> fit your needs is a grave issue.

  This is really a grave bug as I have to restore 100 bookmarks every week. Is not it?

> For others it is inconvenient if bookmarks end up on wrong lines.

It is much better than losing them completely. Make a poll.
Comment 5 Waqar Ahmed 2022-10-03 20:05:56 UTC
*** Bug 407602 has been marked as a duplicate of this bug. ***