Bug 200332 - find next: do not let the search loop
Summary: find next: do not let the search loop
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Unclassified
Component: search (show other bugs)
Version: unspecified
Platform: openSUSE RPMs Unspecified
: HI wishlist with 42 votes (vote)
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-15 17:55 UTC by Maciej Pilichowski
Modified: 2014-01-04 19:29 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.13


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Maciej Pilichowski 2009-07-15 17:55:15 UTC
Version:            (using KDE 4.2.90)
Installed from:    SuSE RPMs

Currently when you hit "find next" kate will show the first occurence after the last one. It is wrong because of several reasons:

a) backward compatibility MO
b) consistency in naming -- first last is not next to the last one, first word is not next to the last one, the first match should not be next to the last one
c) usefulness -- believe or not, but today I looped twice before realizing I am going in the circles -- because there was very long file I was looking at, and unknown to me

In short -- stop at the end, add visual indicator "no more matches".
Comment 1 Andreas Pakulat 2009-07-15 18:27:44 UTC
I completely disagree with your reasoning, however I do think there should be an option to wrap the search or not.
Comment 2 Maciej Pilichowski 2009-07-15 18:35:39 UTC
Option is ok with me, but the visual indicator should be displayed in both cases.
Comment 3 Maciej Pilichowski 2009-07-15 18:39:51 UTC
PS. Sorry for mini-comments. 

Konq. works in wrap mode but in such way:

match 1 -> match 2 -> no matches (info) -> match 1 -> match 2 -> no matches...

However Konq. indicator is very "shy" so it is easy to omit it.
Comment 4 Martin 2009-08-13 21:12:20 UTC
I confirm this bug too. Please, when will you resolve this bug, create new "warning window" with button OK (as in kate-KDE3). When I press key F3 for "find next" I am look on found text in editor and not to little text bellow editor how was it in previous version (kate-KDE4).
Comment 5 Adrián Chaves (Gallaecio) 2012-11-11 12:15:38 UTC
Still not configurable and with no warning in Kate 3.9.3, KDE SC 4.9.3.

The way I see, there should indeed be a check box to stop the search at the end of the file.

Regarding the notification, I am one of those that do want to let the search loop, but I do find myself often watching at the scrollbar, trying to guess whether I completed a loop or not. So I think it would be useful to get a notification.

However, I am not complely sure when the notification should appear. In fact, maybe we should have two different notifications:
- One when you are taken back to the beginning of the file during a search. To be noted that, while it might seem useful to get the notification when you get to the last search match of the file (so the next step will be to continue the search from the beginning), in cases where from the current position to the end of the file there are no matches, it would be useless, or even counterproductive.
- Another notification when you get back to the first match you found.

For example, if in a file with 4 instances of a word you start from the middle of the document, and you first match the 3rd instance:
- Next gets you to the 4th instance.
- Next gets you to the 1st instance, and the notification about reaching the end of the file and continuing the search from the beginning appears.
- Next gets you to the 2nd instance.
- Next gets you back to the 3rd instance, and a notification about having looped through all the instances in the document appears.

Also, I think these notification should be pasive notifications (http://kate-editor.org/2012/11/06/passive-notifications-in-kate-part/) that do not require user interaction, that is, they should dissapear automatically. In my opinion:
- They should have a button to close them manually, if you wish.
- Once they appear:
    - They should stay for at least around 3 seconds unless you click the button to dissmiss them, or another notification — not any notification, but one of those two types, reaching the end and completing the search loop — is to be shown. So, if you get the “reached the end” notification and in 1 or 2 seconds you continue the search until you reach the first instance you matched during the search, the notification about completing the search loop should replace the notification about reaching the end of the file right away. Also, if the first instance matched — when continuing the search from the beginning of the file — is the first instance you matched when you started the search, the notification about reaching the end of the file should not even appear, just the one about completing the search loop.
   - If those 3 seconds passes and you have not moved on in the search (went to the next or previous instance), the notification should stay there until you do continue the search, you close the search toolbar at the bottom of the view, or ou close the notification manually.
   - If within those first 3 seconds yo do continue the search, the notification should get dismissed automatically after those 3 seconds have passed, without requiring any interaction from you.
Comment 6 Lilian A. Moraru 2012-11-11 22:57:59 UTC
Okular implements this. If you search and go to the last found item in the list and press Next again, it tells you that there are not more matches and asks if you want to search again from the top.
Comment 7 Lars Winterfeld 2012-11-12 12:33:58 UTC
The following would be nice: if I press "next" after the last found place for the first time, Kate will not select the next anything new (but maybe notify me in some way). Only when i press "next" for the second time, move back to the top.
Comment 8 Adrián Chaves (Gallaecio) 2012-11-12 15:24:15 UTC
Maybe this: If you use the (hypothetical) setting not to continue from the begining, you would get a notification when you reach the last instance; that notification would provide a button to continue from the begining, ignoring the setting. If that button is pressed, you do. Not sure if it would be OK for everyone using the setting to get to the beginning after clicking Next twice; however, since I'm not using it myself, I don't really care.

Still, when allowing the search loop, I think you should still get the notification once you are back at the beginning of the file (first match from the beginning), instead of when you reach the last match in the file.
Comment 9 Lars Winterfeld 2012-11-12 15:33:16 UTC
In any case, it would be nice to be able to keep hitting F3 instead of having to click anything on the screen.
Comment 10 Ganton 2013-05-24 10:56:51 UTC
Like Lilian A. Moraru said: Okular implements this. If you search and go to the last found item in the list and press Next again, it tells you that there are not more matches and asks if you want to search again from the top.

That's right, warn the user (that the search will start again from the beginning of the file).
Comment 11 Michal Humpula 2014-01-04 19:29:48 UTC
Git commit 568a867358fae82d23bfd2a4a0f8eb2be975fcdb by Michal Humpula.
Committed on 01/01/2014 at 22:44.
Pushed by michalhumpula into branch 'master'.

display message when wrapping in search

REVIEW: 114806
FIXED-IN: 4.13

M  +7    -0    part/search/katesearchbar.cpp

http://commits.kde.org/kate/568a867358fae82d23bfd2a4a0f8eb2be975fcdb