On Mon, Feb 20, 2012 at 10:40 AM, Frank Lanitz frank@frank.uvena.de wrote:
Am 20.02.2012 09:49, schrieb Emil Brink:
I saw that "Remove duplicate lines - simple?" item on the Plugin wishlist, and thought I'd have a go at it this weekend.
Nice ;)
Thanks!
The results are at https://github.com/unwind/geanyuniq, and I would love some feedback.
Without having a too deep look, just a few thought:
- you should consider using PLUGIN_SET_TRANSLATABLE_INFO macro instead
of PLUGIN_SET_INFO. Its allowing also to translated informatons inside geany's plugin manager
Yes, absolutely. I haven't looked into the details of translating plugins, but I did see that macro.
- Why do you giving prev (l66) a fixed size? IIRC this will prevent
lines to being checked in case of they are huger than 512 char (or e.g. ~128 real UTF32 chars)
No, glib's GStrings are always dynamic, this is just a way of trying to avoiding re-allocating the string on first assign() since I expect many lines of "typical" text files to be shorter than 512 bytes.
[menu cleverness]
At least as far as I know this just wasn't under discussion by now. Its current just some kind of a stack.
Not sure what you're referring to here. The Tools menu?
Ignoring the menu item issue, the command is by default bound to Shift+Control+D,
I'd remove default binding. E.g. I already have this one in another use.
Aha, that might be a good point, leaving the assigning of the key to the user.
It outputs a line of text to the Status window saying how many lines were deleted (if any were deleted), is that a good idea, or annoying/spammy?
I like that idea.
Cool.
Are you thinking of adding it to geany-plugins project? ;)
Yes, this seems general-purpose enough to make sense for that project, and also since it was on the wishlist it might be useful/sought after.
To the people saying "you can just pipe through uniq/sort": yes, of course.
But that creates another process, and pipes the data (twice!) between the two. I haven't tested it, but I'd wager that doing it directly against the Scintilla widget is at least twice as fast, and uses way less memory too. That was the point, plus maybe making it a little bit more user-accessible (the mere existence of the item on the wishlist seems to signify that "most users" don't just think of piping through an external program). So I think it's worthwhile. :)
Regards,
/Emil