Bug 499268

Summary: text editors "wrap around" when moving between bookmarks and reaching first/last bookamrk
Product: [Frameworks and Libraries] frameworks-ktexteditor Reporter: Péter Ujfalusi <peter.ujfalusi>
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: 6.10.0   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Péter Ujfalusi 2025-01-29 08:40:50 UTC
SUMMARY
Since commit https://invent.kde.org/frameworks/ktexteditor/-/commit/87b2184be467e5f2747c7583b77675b57710f875 the text editor behavior changed and now it unconditionally cycles between the bookmarks.
If the cursor is at the first bookmark and using <ALT>+<PGUP> the cursor moves to the _last_ bookmark instead of staying where it is as there is no previous bookmark in text file.
Similarly at the last bookmark pressing <ALT>+<PGDOWN> will jump to the _first_ bookmark instead of staying as there is no next bookmark in document.

The commit is made in response to https://bugs.kde.org/show_bug.cgi?id=472354, so it looks like there is at least one person who prefers this operation...

I have been holding on to older ktexteditor with Krusader, but it got ported to KF6, so now it's editor also cycles without an option to restore the old behavior.

STEPS TO REPRODUCE
1.  Open a text file
2. Place several bookmarks
3. Try to find the _first_ or _last_ bookmark with keyboard navigation (ALT+ PGUP/DOWN)

OBSERVED RESULT
Instead of stopping at the first/last bookmark the cursor cycles back at the other end, one cannot just blindly smash the PGUP/DOWN to reach the first/last bookmark but needs to carefully watch the line numbers/position to determine which one is the first or last one.

This is extremely annoying when working with large log files with mostly identical locations bookmarked and trying to identify changes and then figure out where that places is compared to the first/last bookmark.

EXPECTED RESULT
No wrap around happens at the first/last bookmark.

SOFTWARE/OS VERSIONS
ktexteditor since commit 87b2184be467e5f2747c7583b77675b57710f875

ADDITIONAL INFORMATION
Since the change to wrap around was made in response to a request, it might be best to have an option to 'do not wrap around when moving between bookmarks' so users can select what best fits their use?
Comment 1 Bug Janitor Service 2025-01-29 09:00:34 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/780
Comment 2 Waqar Ahmed 2025-01-29 09:15:17 UTC
Git commit 5ac3cf4d7e732444027ec36851e2f741bc4d502b by Waqar Ahmed.
Committed on 29/01/2025 at 08:59.
Pushed by waqar into branch 'master'.

Allow disabling 'cycle through bookmarks' behaviour

M  +3    -0    src/dialogs/katedialogs.cpp
M  +7    -0    src/dialogs/navigationconfigwidget.ui
M  +2    -2    src/utils/katebookmarks.cpp
M  +6    -0    src/utils/katebookmarks.h
M  +1    -0    src/utils/kateconfig.cpp
M  +1    -0    src/utils/kateconfig.h
M  +1    -0    src/view/kateview.cpp

https://invent.kde.org/frameworks/ktexteditor/-/commit/5ac3cf4d7e732444027ec36851e2f741bc4d502b
Comment 3 Péter Ujfalusi 2025-01-29 09:46:25 UTC
(In reply to Waqar Ahmed from comment #2)
> Git commit 5ac3cf4d7e732444027ec36851e2f741bc4d502b by Waqar Ahmed.
> Committed on 29/01/2025 at 08:59.
> Pushed by waqar into branch 'master'.
> 
> Allow disabling 'cycle through bookmarks' behaviour
> 
> M  +3    -0    src/dialogs/katedialogs.cpp
> M  +7    -0    src/dialogs/navigationconfigwidget.ui
> M  +2    -2    src/utils/katebookmarks.cpp
> M  +6    -0    src/utils/katebookmarks.h
> M  +1    -0    src/utils/kateconfig.cpp
> M  +1    -0    src/utils/kateconfig.h
> M  +1    -0    src/view/kateview.cpp
> 
> https://invent.kde.org/frameworks/ktexteditor/-/commit/
> 5ac3cf4d7e732444027ec36851e2f741bc4d502b

built the ktexteditor from git which includes this commit and quickly tested it by:
LD_LIBRARY_PATH=bin/ kate

and the new 'Allow to cycle through bookmarks' works great, it is set by default and moving between bookmarks wraps but after removing the checkmark it stops as it used to.

Thank you, I really appreciate it!