The future of search and replace in Kate 2007-08-06
I plan to start working on the new search and replace dialog for Kate on the evening of 2007-08-08. It’s actually not a dialog but a search bar showing up at the bottom of the document. I think the original concept behind this was to approach the problem that the search dialog is always in the way. (The other approach I have seen addressing this is the search dialog “intelligently” jumping around… terrible! See it live in Visual Studio 2005…) So a search bar at the bottom – I think it was Anders Lund introducing it(?) – is in my eyes a good solution to that problem.
That search bar was originally planned to offer incremental searching only but we – mainly Robert Buchholz – then realized that offering only incremental searching takes away power known from the past like the search history for example. It’s just not possible to make some things go with incremental searching smoothly. So the current plan is to actually bring you two different bars: One as an incremental 1:1 clone of the search bar of Firefox and the other one being a powerful non-incremental Search/Replace tool similar to the old Search/Replace dialog… but also in the form of a bar. The engine inside will also be more powerful but more details on that at a later time…
I would love to hear some more ideas and feedback about this search bar thing. Best way to do this probably is writing to the kwrite-devel mailing list or leaving a comment right here at the blog. Please read the detailed plan before doing so. Thanks for your attention, I hope you enjoy your trip
PS: Sorry for spamming you Planet KDE readers with my previous Windows-related post by mistake. I hope it was fun at least

This work, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-No Derivative Works 3.0 Germany License.


“The engine inside will also be more powerful”
aint you satisfied with kfind/kreplace?
there are other apps that use it, so please avoid duplication if possible
With “The engine inside will also be more powerful” I meant stuff like support for multi-line patterns and escape sequences in the replacement text.
I do not plan to duplicate KReplace but I currently do not plan using KReplace either. The idea is to have a “Replace” and “Replace all” button. That together with “Find next” should give the same power as KReplace. Also the KReplace dialog would again be a dialog in the way when searching.
My thoughts:
Registering (easy as it was) for a site just to post a comment is stupid – you should at least allow moderated comments with a captcha.
“* Has next and previous buttons, with “next” on the left”
How illogical. Most people read left to right, so things that are ‘next’ are on the right. Also I think the icons should be up/down arrows rather than left right – 2 matches on the same line are much less common than matches above/below each other.
“* Search always starts from cursor”
Good. KDE 3 always annoyed me when searching in a selection, and it asked if you wanted to start from the cursor.
“* “>” button right to each edit control
with stuff like “\n” and “.” or to launch
KRegexpEditor if installed”
Just a suggestion – for non regex modes, why not use the return symbol (or something that is in common fonts) to avoid confusing people with ‘\n’ (only geeks have even heard of escape sequences).
“* Wrap around (to not have to ask)”
I can’t see why you’d need to ask. I would have thought you always wrap around unless you have ‘from cursor’ and use replace all.
> Registering (easy as it was) for a site just
> to post a comment is stupid – you should at
> least allow moderated comments with a captcha.
I didn’t write this blogging software and I
have to fight tons of Spam. Even if this
is not the most user-friendly solution I don’t
think it’s bad enough to call it stupid.
> “* Has next and previous buttons, with “next†on the leftâ€
> How illogical. Most people read left to right, so things
> that are ‘next’ are on the right. Also I think the icons
> should be up/down arrows rather than left right – 2 matches
> on the same line are much less common than matches above/below
> each other.
It’s not necessarily illogical: It’s exactly what Firefox
is doing and they do it because you need “Next” 90% of the
time (not “Prev”) so they put it as close as possible.
I agree about the button icons: Firefox does that as well.
> Just a suggestion – for non regex modes, why not use the
> return symbol (or something that is in common fonts) to
> avoid confusing people with ‘\n’ (only geeks have even
> heard of escape sequences).
I don’t think using characters that do not appear on the
user’s keyboard is a good idea. I guess non-geeks will
not even try to search for multi-line stuff from a single
pattern edit box.
> “* Wrap around (to not have to ask)â€
> I can’t see why you’d need to ask. I would have thought
> you always wrap around unless you have ‘from cursor’
> and use replace all.
The question is whether you want (A) to find any match
whereever it is or (B) a match from here on or further
down. The Firefoxy bar will give (A) only while
the power search will do (A) or (B) for you.
IMHO, one of the best search interfaces
is the one used by Adobe (Acrobat) Reader.
The nicest thing about it is, that you see (in the right panel) lots of other matches, not just the current occurence of the searched pattern.
You can thus quickly jump to the right place(with little scrlling) if needed, and you see also the context, which helps you to jump there.
Such an interface might be really good especially for replace – you would see, what are you about to replace – also the other occurances, which might help you to prevent a mistake.
“Also the KReplace dialog would again be a dialog in the way when searching.”
i didnt say anything about KReplaceDialog. I just asked if you’re planning to write alternative GUI for KReplace (maybe making some changes to KReplace itself).
Anyways, it would be cool if your class were generic enough to be used in other apps (e.g.: searching/replacing on multiple pages — like in okular, kword, and KAider has similar concept of msgen/msgtarget pairs too…)
@timmmm
I turned on forced registration some time before I installed Spam Karma 2. I thought about the whole thing again and turned off registration again. Let’s see how that works.
@jankoh
I like Adode Reader’s interface, too. Maybe we can add this feature later. Let’s go for the two less-space-taking dialogs first.
@shaforostoff
I had a closer look at KFind and KReplace and it seems to me that it can only work with linear string input (Kate works with vectors of lines), and does not support references in the replacement text when replacing with regular expressions. (Did I overlook it?) Another problem we recently fixed for KatePart which KFind/KReplace still has is the fixed coupling to QRegExp in the API. KatePart only works with QStrings in the API so it would be possible to use another Regex engine for the backend if desired. To summarize I think bringing these two worlds together will be a major extra task. If you think we should go for that I will need your help with it.
@shaforostoff
Update: Leaving KFind as is but offer the Firefoxy bar as a kdeui dialog for it might be possible. I plan to talk to Eike Hein of Konversion about this.
kate already has incremental search implemented as a plugin. it shows as a toolbar. maybe you just need to add support of toolbars at the bottom, write another plugin or builtin function as you wish an voilá!
[...] sping thought about that problem and decided to work at. A couple of days later he showed mockups. The first mockup [...]
Hi! Definitely nice and neat site you got there.o