Fix fontsize unit fixing (assume px if no unit specified)

The settings module sees that we're reading a number, so it converts
the value to a number. Unit detection needs a string, though, so
convert it back into one in that case.
This commit is contained in:
Lorenz Hübschle-Schneider 2017-02-09 10:10:08 +01:00
parent dd351224d9
commit 4937b79a7a

View file

@ -445,6 +445,11 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
});
// Update font size when changed
settings.addCallback('fontsize', function(fontsize) {
if (typeof(fontsize) === "number") {
// settings module recognizes a fontsize without unit it as a number
// and converts, we need to convert back
fontsize = fontsize.toString();
}
// If no unit is specified, it should be pixels
if (fontsize.match(/^[0-9]+$/)) {
fontsize += 'px';