Commit Graph

8 Commits

Author SHA1 Message Date
Giovanni Campagna
bbdce159fa Util: fix binary search exit condition
The loop can exit with an interval of length one or one of
length zero. In the first case it is correct to check which side
of the interval to return, in the second case no comparison should
be made (since there is only one possible value).
In practice, this usually results in one comparison more than needed,
but in some cases (when the position was past the end of the array),
would call the comparator with undefined.

https://bugzilla.gnome.org/show_bug.cgi?id=666614
2011-12-20 22:44:03 +01:00
Giovanni Campagna
09ab13cf04 Array: add capability to insert while keeping a specific order
Adds two new functions, Util.lowerBound and Util.insertSorted,
that take an array, a value and a comparator, and find the
first position at which the value can be inserted without
violating the order, in optimal time.

https://bugzilla.gnome.org/show_bug.cgi?id=666429
2011-12-19 16:54:46 +01:00
Jason Siefken
3941961f8b lookingGlass: Add tab-completion
https://bugzilla.gnome.org/show_bug.cgi?id=661054
2011-11-05 13:05:11 -04:00
Dan Winship
75b824d032 *.js: Make emacs modelines consistent
js2-mode is no longer developed and we recommend js-mode these days,
so switch the modelines to specify that, and make them consistent
across all files.

https://bugzilla.gnome.org/show_bug.cgi?id=660358
2011-10-11 08:05:12 -04:00
Dan Winship
6496205081 tests: add a unit test for Misc.findUrls()
https://bugzilla.gnome.org/show_bug.cgi?id=636252
2011-09-08 09:09:12 -04:00
Dan Winship
f03793b825 tests: add a test for MessageTray._fixMarkup
https://bugzilla.gnome.org/show_bug.cgi?id=650298
2011-07-27 09:29:03 -04:00
Florian Müllner
a84e2e3307 [format] Add 'x' format specifier and field width
Sometimes it is useful to print numbers in hex format - add the
appropriate specifier. Also support a minimum field width to
pad the formatted string with spaces (or zeros if the width is
prefixed with '0').

https://bugzilla.gnome.org/show_bug.cgi?id=622597
2010-06-24 15:54:54 +02:00
Adel Gadllah
64cd51667d Add String formatting
Add String formatting by extending the String object with a
format method.

Now we can do stuff like "Text: %s, %d".format(somevar, 5)

This is required for proper translation of some strings.

https://bugzilla.gnome.org/show_bug.cgi?id=595661
2009-10-04 23:37:33 +02:00