| Summary: | KWrite remembers cursor position when closing the file and opening it again | ||
|---|---|---|---|
| Product: | [Applications] kate | Reporter: | Gleb Popov <6yearold> |
| Component: | kwrite | Assignee: | KWrite Developers <kwrite-bugs-null> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | christoph, kde, null |
| Priority: | NOR | ||
| Version First Reported In: | 22.08.1 | ||
| Target Milestone: | --- | ||
| Platform: | Other | ||
| OS: | FreeBSD | ||
| Latest Commit: | https://invent.kde.org/utilities/kate/commit/5dac26e2b7747aab9a97a4eb516a83990d2122ed | Version Fixed/Implemented In: | |
| Sentry Crash Report: | |||
|
Description
Gleb Popov
2022-09-19 06:23:01 UTC
Another interesting finding. The bug manifests itself until I open some other file. That means that following scenario works fine. 1. Open a text file 2. Move the cursor 3. Close it 4. Open a different file 5. Close it too 6. Open the first one. The cursor is reset to the beginning of the file. What's more interesting, omitting step 5 brings the bug back. That's likely because of https://kate-editor.org/post/2022/2022-03-31-kate-ate-kwrite/ And, it seems, there is no way to prevent the "eaten" KWrite from remembering the cursor position. Now, Kate does have an option for that (Session -> Session Elements -> Include window configuration), but it also affects things like window size and position. There should be a separate option for the cursor, methinks. (In reply to Hasshu from comment #2) > That's likely because of > https://kate-editor.org/post/2022/2022-03-31-kate-ate-kwrite/ > > And, it seems, there is no way to prevent the "eaten" KWrite from > remembering the cursor position. Now, Kate does have an option for that > (Session -> Session Elements -> Include window configuration), but it also > affects things like window size and position. > > There should be a separate option for the cursor, methinks. "Session -> Session Elements -> Include window configuration" doesn't affect my problem. Even with this option disabled KWrite remembers cursor position. Interestingly, the blog post you mention says that KWrite does not have sessions at all. Doesn't that mean that Kate's session settings should have no effect on KWrite? (In reply to Gleb Popov from comment #3) > "Session -> Session Elements -> Include window configuration" doesn't affect > my problem. Even with this option disabled KWrite remembers cursor position. > > Interestingly, the blog post you mention says that KWrite does not have > sessions at all. Doesn't that mean that Kate's session settings should have > no effect on KWrite? It seems that my choice of words was a bit confusing. To rephrase: KWrite has become more similar to Kate, which includes remembering cursor position, and there appears to be no way to disable that (at all); such behavior can be disabled within Kate (for Kate only) via an option, but that would disable some other things as well. As such, I believe that both Kate and KWrite should have a dedicated option to never remember cursor position. I'd request that restoration of the cursor position be a *variable* that can be configured per file mode. I can see it being useful for some filetypes, but it is extra annoying when I use KWrite as my $GIT_EDITOR and I start typing a Git commit message, only to discover that my cursor started up somewhere down in the comment block below the blank first line. An alternative/additional suggestion would be to restore the cursor position upon load *only if* the file modification time matches what it was when the cursor position was saved. If the file had been modified in the interim, then the saved cursor position likely is garbage and should be disregarded. (In reply to Matt Whitlock from comment #5) > ... it is extra annoying when I use KWrite as my $GIT_EDITOR and I start typing a Git commit message, only to discover that my cursor started up somewhere down in the comment block below the blank first line. +1, I messed up an interactive rebase in the same way. Git commit aa1808649eaddf52ec309d4873c324b0dd48a810 by Christoph Cullmann. Committed on 29/10/2022 at 17:32. Pushed by cullmann into branch 'master'. avoid that KWrite stores/restores view config the setting is not there in the config dialog by design the default value was not well choosen just skip this for KWrite M +2 -2 apps/lib/session/katesessionmanager.cpp https://invent.kde.org/utilities/kate/commit/aa1808649eaddf52ec309d4873c324b0dd48a810 You are right, the idea was that this doesn't happen, but I failed to see that the default is just wrong for KWrite. (In reply to Christoph Cullmann from comment #8) > You are right, the idea was that this doesn't happen, but I failed to see > that the default is just wrong for KWrite. Thanks for the update! Git commit 5dac26e2b7747aab9a97a4eb516a83990d2122ed by Christoph Cullmann. Committed on 03/11/2022 at 19:24. Pushed by cullmann into branch 'master'. skip only store/save of view manager internals for KWrite Related: bug 461355 M +10 -4 apps/lib/kateviewmanager.cpp https://invent.kde.org/utilities/kate/commit/5dac26e2b7747aab9a97a4eb516a83990d2122ed |