New Replace part

Jens Dagerbo jens.dagerbo at swipnet.se
Mon Mar 31 01:17:05 UTC 2003


Hi all,

I finally found the time to write something about my first real contribution 
to this great piece of software.

I just want to put everyones mind at ease about the state of the "replace 
part". One should never promise that any software won't eat your harddrive, 
but it hasn't for me.. It should be safe enough to enable for developers, as 
I'd really like some input on it. Please try it out and give me some feedback 
on the perhaps unusual gui. If you're paranoid, just remember to click 
"cancel", instead  of "replace". :)

To enable: add "replace" to the kdevelop/parts/Makefile.am file.

Essentially, it works like follows:
Call it up through ctrl+alt+p or from the "Edit" menu, enter a search string 
and a replacement string and hit "find". The result will be an output window 
where the possible replacements are listed. Uncheck any line or file you 
don't want modified, and hit "replace" to finalize the changes. Clicking a 
line takes you to that line should more context than one line provides be 
needed.

There are still some things I'd like to fix though, if you people think the 
basic idea of this part is sound, mainly:

# For any open files, the undo history is erased. 
# It doesn't work on unsaved files

This is the big usability issue I feel and also the one that's the most 
troublesome to fix. It happens because the part works with the files on disk, 
and reloads open editors afterwards. It's certainly possible to do the 
replacements through the KTextEditor interface, but that increases the 
complexity (and isn't very clean either since the undohistory can't be 
manipulated properly). 

# More options (whole words, case sensitivity)

"Whole words" could probably make sense (left out so far because it was 
easier), case sensitivity, I think not. Frankly, the only need/use for this 
part is for "basic refactoring" and I cant see why case insensitivity would 
be a benefit to that. (Hmm.. other languages than C++ maybe? Yeah, ok.) 
Anything more advanced than renaming of methods and attributes probably needs 
contextual analysis and is therefore better placed elsewhere.

(regexps and placeholders like the katepart has is simply out, that is in the 
domain of the editor and we should push for a better KTextEditor interface if 
we want this to happen - something that opens real problems with KDE version 
support..)

# GUI-improvements:

The buttons shouldn't really be that wide, easily fixed once I know if I'm not 
breaking any religious commandments buy putting buttons on the "output" 
view.. Suggestions are welcome! :)

# Tooltips, i18n stuff, coderearragements

Also, once I know if people think the general design is worth pursuing.


Again, feedback is appreciated. :)

Regards,

Jens Dagerbo, aka "teatime"



On Sunday 30 March 2003 04.58, Amilcar Lucas wrote:
> We have a new part!!!
>
> It does search and replace of stings project wide. (The begining of code
> refractoring!!!!)
> It was coded by Jens Dagerbo and I've added it to cvs.
> If you want to test it (this one is VERY alpha) you'll have to activate it
> in the parts/Makefile.am.
> Once Jens Dagerbo finishes the tests we can activate it permanently.
>
> Happy coding
> Amilcar
>





More information about the KDevelop-devel mailing list