Re: [patch] support back-references when bulk renaming

"Thomas Leonard" <[email protected]> Sun, 30 Nov 2008 10:44:07 +0000
Newsgroups gmane.comp.desktop.rox.devel
Message-ID <[email protected]>
2008/11/27 Rogutes <[email protected]>:
> Hello,
>
> I thought it would be nice to have back-references support in the bulk
> renaming dialog, so one could, for example, type
>
> Replace: "\(.*\) (\([0-9]\{4\}\))"
> With: "[\2]: \1"

> If my patch seems awkward (I hardly know C and just tried to mimic the
> surrounding code), then this is a feature request.

Looks pretty good (and useful). I think your array may be one element
too small (whole pattern plus nine back-refs = 10 offsets).

You might find the code would be simpler if you used the g_string_*
functions rather than realloc (e.g. g_string_append):

http://library.gnome.org/devel/glib/unstable/glib-Strings.html

1. Append everything before the match
2. Append the characters in the with string, expanding references as you go
3. Append everything after the match

Do you want to update the patch? If not, I'll try to find some time to
do it myself.

Thanks!


-- 
Dr Thomas Leonard		ROX desktop / Zero Install
GPG: 9242 9807 C985 3C07 44A6  8B9A AE07 8280 59A5 3CC1

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/