Bug 468573 - After restarting Kate, empty tabs appear "Untitled (2)", "Untitled (3)"...
Summary: After restarting Kate, empty tabs appear "Untitled (2)", "Untitled (3)"...
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: sessions (show other bugs)
Version: 23.08.5
Platform: FreeBSD Ports FreeBSD
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-04-16 13:31 UTC by vujo
Modified: 2024-10-27 00:18 UTC (History)
7 users (show)

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


Attachments
My settings Session (102.59 KB, image/jpeg)
2023-04-16 13:31 UTC, vujo
Details
kate-duplicated_tabs (20.65 KB, image/png)
2024-04-19 21:56 UTC, Piotr Mierzwinski
Details
kate_duplicate_Untilted (13.42 KB, image/png)
2024-04-19 22:05 UTC, Piotr Mierzwinski
Details
kate lost session (20.88 KB, image/png)
2024-10-10 22:31 UTC, Piotr Mierzwinski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description vujo 2023-04-16 13:31:55 UTC
Created attachment 158145 [details]
My settings Session

Hello.

STEP TO REPRODUCE
Settings: Session -> "Newly-created unsaved files"
1. Open Kate
2. File -> New (a new "Untitled" tab will appear)
3. Enter some text, for example "test message"
4. File -> Quit
5. Open Kate

OBSERVED RESULT
Another new clutch "Untitled (2)" has appeared, which is empty.
The previous tab "Untitled" contains our "test message" text.
If you repeat step 4 and 5:
4. File -> Quit
5. Open Kate
Then another empty tab "Untitled (3)" will appear, and so on.

EXPECTED RESULT
Empty tabs "Untitled (2)" ... "Untitled (3)" should not appear after restarting Kate.

SOFTWARE/OS VERSIONS
HardenedBSD 13.2 STABLE
GhostBSD-22.06.18 (FreeBSD 13.1)
KDE Plasma Version: 5.103
KDE Framework Version: 5.104.0
Qt Version: 5.15.8

ADDITIONAL INFORMATION
Settings: Session -> "Newly-created unsaved files"
Comment 1 _rs 2023-04-26 08:47:38 UTC
Bug is still there in the latest stable 23.04.0
Comment 2 vujo 2023-05-17 12:34:08 UTC
I confirm the problem on 23.04.0
Comment 3 vujo 2023-05-17 14:58:58 UTC
Tested on other distributions.

Problem not reproduced:
  - Kubuntu 22.04.2 (kubuntu-22.04.2-desktop-amd64.iso)
    Kate 21.12.3 (sudo apt install kate)

  - Lubuntu 22.10 (lubuntu-22.10-desktop-amd64.iso)
    Kate 22.08.2 (sudo apt install kate)

The problem has been reproduced:
  - Ubuntu-23.04 (ubuntu-23.04-desktop-amd64.iso)
    Kate 22.12.3 (sudo apt install kate)
    Kate 23.04.1 (sudo snap install kate --classic)
Comment 4 vujo 2023-08-12 11:21:05 UTC
I confirm the problem on Kate 23.04.1
FreeBSD 13.2-STABLE
Comment 5 vujo 2023-08-12 12:22:20 UTC
I forgot to add that in order to reproduce the problem correctly, you need to save the session.
Correct steps to reproduce the problem:

1) run Kate
2) Sessions -> Save Session -> "myName"
3) Settings -> Configure Kate -> Session ->
check the box "Load last used session"
check the box "Newly-created unsaved files"
check the box "Files with unsaved changes"
uncheck "Show welcome view for new windows"
-> OK
4) File -> New
5) Enter text: "test"
6) File -> Quit
7) run Kate

Repeat
6) File -> Quit
7) run Kate
Comment 6 vujo 2023-08-14 07:45:01 UTC
I confirm the problem on Kate 23.04.3
FreeBSD 13.2-STABLE
Comment 7 Kristian Rink 2023-11-16 11:26:17 UTC
Seems not related to FreeBSD. Same here (kate 22.12.3, Kubuntu 23.04).
Comment 8 vujo 2023-11-16 13:49:10 UTC
(In reply to Kristian Rink from comment #7)
> Seems not related to FreeBSD. Same here (kate 22.12.3, Kubuntu 23.04).

Yes, the problem is reproducible on different platforms.
Are you reproducing this problem?
Comment 9 Kristian Rink 2023-11-16 14:04:38 UTC
Yes I do.
Comment 10 vujo 2023-11-16 15:06:30 UTC
(In reply to Kristian Rink from comment #9)
> Yes I do.

Can you write your OS and version of kate?
Comment 11 Kristian Rink 2023-11-17 13:12:31 UTC
(In reply to vujo from comment #10)
> (In reply to Kristian Rink from comment #9)
> > Yes I do.
> 
> Can you write your OS and version of kate?

Hmm. kate 22.12.3, Kubuntu 23.04 - I think I already provided that above...?
Comment 12 Florine W. Dekker 2024-03-06 14:04:32 UTC
I can also reproduce the bug in Kate 23.08.1 on Debian Testing.
Comment 13 Florine W. Dekker 2024-03-06 14:11:34 UTC
Additionally, it looks like there's actually new "Untitled" files being created, since the number of files in the session increases each time Kate is restarted. The old files can be found using "Quick Open" (in menu as "Go > Quick Open", or use "Ctrl + Alt + O").
Comment 14 vujo 2024-03-06 14:40:02 UTC
I confirm the problem on Kate 23.08.4
FreeBSD 13.2-RELEASE-p4
Comment 15 vujo 2024-03-07 08:52:06 UTC
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 16 Sebastian 2024-04-09 14:03:19 UTC
Seeing the same issue on current Kubuntu 23.10 with Kate 23.08.1 as well as with newest Kate 23.08.4 snap.

The functionality to restore tabs with content for untitled documents was one of the great features of Kate, sad to see this not working anymore since about a year.
Comment 17 Piotr Mierzwinski 2024-04-19 21:56:16 UTC
Created attachment 168697 [details]
kate-duplicated_tabs

Confirm the problem. I attachment screen shot with my duplicated tabs.
I need to add, that I found this issue at December 2022, so almost 1.5 year ago, so in Plasma 5.x.
it's sad that till today nothing changed.
Comment 18 Piotr Mierzwinski 2024-04-19 22:05:12 UTC
Created attachment 168698 [details]
kate_duplicate_Untilted

Another screenshot ("kate_duplicate_Untilted") coming from Plasma 5:

KDE Plasma Version: 5.26.80
KDE Frameworks Version: 5.101.0
Qt Version: 5.15.7

$ 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 19 Christoph Cullmann 2024-09-09 13:19:26 UTC
https://invent.kde.org/utilities/kate/-/merge_requests/1578
Comment 20 Christoph Cullmann 2024-09-10 09:04:18 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 462523

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 21 Christoph Cullmann 2024-09-13 16:56:44 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 462523


(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
Comment 22 Piotr Mierzwinski 2024-10-10 22:31:58 UTC
Created attachment 174659 [details]
kate lost session

I had session calling mySession2 with 2 regular files and on "untilted". As you can see on the screenshot there are 3 "untilted" it happened after another restart. Additionally I cannot close last one document clicking appearing close button after hover of mouse on item of list in document view

KDE Neon unstable, updated today
Comment 23 Piotr Mierzwinski 2024-10-10 22:36:03 UTC
I don't quick Kate manually, only plasma kills it, because I turned on "restore session" in Plasma
Below check content of my session directory

piotr@Dell:~/.local/share/kate/stash/mySession2.katesession$ ls -l
total 28
-rw-rw-r-- 1 piotr piotr  20 sep 19 02:32 'Document 0'
-rw-rw-r-- 1 piotr piotr 152 sep 19 02:32 'Document 0~'
-rw-rw-r-- 1 piotr piotr  18 oct  4 02:06 'Document 2'
-rw-rw-r-- 1 piotr piotr  95 oct  3 00:35 'Document 2~'
-rw-rw-r-- 1 piotr piotr  13 sep 19 02:33 'Document 3'
-rw-rw-r-- 1 piotr piotr 364 sep 19 02:32 'Document 3~'
-rw-rw-r-- 1 piotr piotr 122 aug 31 03:41 'Document 4'
Comment 24 Piotr Mierzwinski 2024-10-27 00:18:22 UTC
When Plasma kill and restore Kate happens the same. We meet several "Untilted" in "Documents" view.