Re: select patch
Jeff Abrahamson <[email protected]> Wed, 18 Jun 2014 19:51:50 +0100
| Newsgroups | gmane.comp.window-managers.ratpoison.devel |
|---|---|
| Message-ID | <CAM4Y7zzVzOd2nr-EsknLmjzfoe4=2NHesVoh8O-TSFtyOsY+qg@mail.gmail.com> |
Thanks for the contribution. Your C isn't so bad. I have three small quibbles: - Using raw strcmp() isn't a very good idea -- if one of the strings is not null-terminated, you introduce a subtle bug. Prefer instead strncmp() and strnlen(). This requires defining some reasonable upper limit on window names, of course. - The two blocks are almost the same, the only difference is the string compare. It would be nice to merge them into one. - My opinion only, but I don't actually like the behavior. It makes sense to me to skip the current window in the search, but it seems odd to me to have behavior depend on the current numbered ordering of windows. At the very least, to my mind this should be an option that is off by default (i.e., preserves current behavior) or else a new function (select-next). Out of curiosity, why do you find it convenient to name multiple things with the same name? Regards, Jeff Abrahamson +33 6 24 40 01 57 <-- brièvement indisponible le 4 juillet +44 7920 594 255 <-- will change 18 July http://jeff.purple.com/ http://blog.purple.com/jeff/ On 17 June 2014 17:41, Johannes Altmanninger <[email protected]> wrote: > The default "select" command (disregarding window numbers) selects the > first exact match, > if there is none, the argument is matched against the beginning of each > window name, > again selecting the first match. > I have shortcuts to select my each of my windows by their name, but > sometimes i have more > than one window with the same name. I wrote a script to alternate between > them but I think > it is more appropriate as a native feature. > The attached patch adds a function to find a window by name, if there is > more than one returns > the match after the currently selected. The select command is changed to > use this function. > > I am pretty new to C, so please let me know if I am doing something > horribly wrong. > > Johannes Altmanninger > > _______________________________________________ > Ratpoison-devel mailing list > [email protected] > https://lists.nongnu.org/mailman/listinfo/ratpoison-devel > > _______________________________________________ Ratpoison-devel mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/ratpoison-devel