Bug 462523 - Duplication of "Untilted" document after every restore session of Plasma
Summary: Duplication of "Untilted" document after every restore session of Plasma
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: sessions (show other bugs)
Version: unspecified
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-12-01 23:30 UTC by Piotr Mierzwinski
Modified: 2024-09-13 16:56 UTC (History)
4 users (show)

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


Attachments
kate_duplicate_Untilted (13.42 KB, image/png)
2022-12-01 23:30 UTC, Piotr Mierzwinski
Details
kate_duplicate_Untilted-quick_open (25.44 KB, image/png)
2022-12-13 22:08 UTC, Piotr Mierzwinski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Piotr Mierzwinski 2022-12-01 23:30:13 UTC
Created attachment 154210 [details]
kate_duplicate_Untilted

SUMMARY
Since couple days I noticed that kate duplicates "Untilted" file after every restore session of Plasma. Of course it ("Untilted") is empty, because restore with last content doesn't work (bug reported).

STEPS TO REPRODUCE
1. Set restore session in Plasma
2. start Kate, and create your session
3. open couple files
4. click New to get "Untilted"
5. Put any text to "Untilted"
6. log out or restart PC

OBSERVED RESULT
Untilted is duplicated every start of Plasma restoring its session

EXPECTED RESULT
Only that number of "Untilted" how much was opened before logging out of Plasma

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 5.26.80
KDE Frameworks Version: 5.101.0
Qt Version: 5.15.7

ADDITIONAL INFORMATION
Operating System: KDE neon Unstable Edition
Graphics Platform: X11

$ apt show kate
Package: kate
Version: 4:22.08.3+p22.04+tunstable+git20221201.0102-0

In "About" I can see: "Kate, Version 23.03.70"
Comment 1 Piotr Mierzwinski 2022-12-08 12:13:10 UTC
After one of recent  updates issue disappeared.
Comment 2 Piotr Mierzwinski 2022-12-09 09:56:34 UTC
Today I logged in and again met described issue.
Please notice I had empty "Untilted" document "restored" by Kate in session. This is in quotation because function doesn't work if session of Plasma is restored. Every day I login in to Plasma  Kate "restores" empty document "Untilted"  no matter if before I put in this document something or not.
Comment 3 valdikss 2022-12-09 11:52:54 UTC
(In reply to Piotr Mierzwinski from comment #2)

Try to press "quick open" button (the first button on the right from the tabs). Do you see any documents there, which are not listed as tabs?
Comment 4 Piotr Mierzwinski 2022-12-13 22:08:25 UTC
Created attachment 154571 [details]
kate_duplicate_Untilted-quick_open
Comment 5 Piotr Mierzwinski 2022-12-13 22:09:47 UTC
(In reply to valdikss from comment #3)
> (In reply to Piotr Mierzwinski from comment #2)
> 
> Try to press "quick open" button (the first button on the right from the
> tabs). Do you see any documents there, which are not listed as tabs?

I forgot to mention that I don't use tabs. They are hidden. I use documents view only, so in my Kate is turned on plugin "Document Tree View" with "View mode: List View".
In list you suggested - "Quick Open" - I can see the same documents as in documents view. Please check attached screen shot.

BTW. Today I reproduced issue again. 
After login I had only one "Untilted" (empty of course, due to this doesn't work), so I put here some text, logged off and logged in. In result I got duplicated "Untilted" (both empty) - in attached screen shot you can see it.
Comment 6 Piotr Mierzwinski 2023-05-15 17:18:46 UTC
Only wanted to add that I reproduced issue in Arch Linux, with current stable Plasma, 
Plasma 5.27.5, KFrameworks: 5.106.0, Qt:5.15.9.
Comment 7 Piotr Mierzwinski 2023-10-31 16:14:47 UTC
Still doesn't work in 23.11.70
Comment 8 vujo 2024-04-09 16:22:32 UTC
I just noticed this page because... I, too, have been keeping such a bug report since April 16, 2023 - https://bugs.kde.org/show_bug.cgi?id=468573
I have been confirming the problem for more than a year on FreeBSD and on various Linux distributions.

In one chat they told me this:
I was told that this problem occurs if you are in a document without a name when you close Kate.
Therefore, after closing and opening, Kate does not know this document and creates a new one.
A related issue is that if an untitled document is selected when closing, then the next time you open Kate you will have the new untitled document selected instead of navigating to any of the saved documents.
Comment 10 vujo 2024-09-09 14:43:31 UTC
(In reply to Christoph Cullmann from comment #9)
> https://invent.kde.org/utilities/kate/-/merge_requests/1578

Thank you very much!
Comment 11 Christoph Cullmann 2024-09-10 09:04:10 UTC
Git commit bb268e2be0ff118c277d2e5bffb98b6e00ece3ea by Christoph Cullmann.
Committed on 10/09/2024 at 09:03.
Pushed by cullmann into branch 'master'.

fix session restore of tabs/views of untitled documents

will allow us to restore the right tabs even for untitled documents
and avoids that we create new untitled documents on session restore
Related: bug 464703, bug 462112, bug 468573

M  +22   -1    apps/lib/katedocmanager.cpp
M  +9    -0    apps/lib/katedocmanager.h
M  +37   -16   apps/lib/kateviewspace.cpp

https://invent.kde.org/utilities/kate/-/commit/bb268e2be0ff118c277d2e5bffb98b6e00ece3ea
Comment 12 Christoph Cullmann 2024-09-13 16:56:52 UTC
Git commit be856dbb927f2c4082218bc4e0360eb677c9c44f by Christoph Cullmann.
Committed on 13/09/2024 at 16:56.
Pushed by cullmann into branch 'release/24.08'.

fix session restore of tabs/views of untitled documents

will allow us to restore the right tabs even for untitled documents
and avoids that we create new untitled documents on session restore
Related: bug 464703, bug 462112, bug 468573


(cherry picked from commit bb268e2be0ff118c277d2e5bffb98b6e00ece3ea)

1866ba36 store the id from the session we did load/save
06c49bc4 write out the id of the document and not the url
2da4f29e read both the new session stored with id and the old with url

Co-authored-by: Christoph Cullmann <christoph@cullmann.io>

M  +22   -1    apps/lib/katedocmanager.cpp
M  +9    -0    apps/lib/katedocmanager.h
M  +37   -16   apps/lib/kateviewspace.cpp

https://invent.kde.org/utilities/kate/-/commit/be856dbb927f2c4082218bc4e0360eb677c9c44f