Skip to content

Commit ac9152a

Browse files
committed
Merge pull request #85 from hchbaw/tb/completion-charset-charsetmenu
:set encoding= completion works again on Firefox >= 32.
2 parents 69e52fd + 1e237bf commit ac9152a

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

common/content/io.js

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,14 +1017,23 @@ lookup:
10171017

10181018
completion.charset = function (context) {
10191019
context.anchored = false;
1020-
context.generate = function () {
1021-
let names = util.Array(
1022-
"more1 more2 more3 more4 more5 static".split(" ").map(function (key)
1023-
options.getPref("intl.charsetmenu.browser." + key).split(', '))
1024-
).flatten().uniq();
1025-
let bundle = document.getElementById("liberator-charset-bundle");
1026-
return names.map(function (name) [name, bundle.getString(name.toLowerCase() + ".title")]);
1027-
};
1020+
if (services.get("vc").compare(Application.version, "32") < 0) {
1021+
context.generate = function () {
1022+
let names = util.Array(
1023+
"more1 more2 more3 more4 more5 static".split(" ").map(function (key)
1024+
options.getPref("intl.charsetmenu.browser." + key).split(', '))
1025+
).flatten().uniq();
1026+
let bundle = document.getElementById("liberator-charset-bundle");
1027+
return names.map(function (name) [name, bundle.getString(name.toLowerCase() + ".title")]);
1028+
};
1029+
}
1030+
else {
1031+
context.generate = function () {
1032+
let {CharsetMenu} = Cu.import("resource://gre/modules/CharsetMenu.jsm", {});
1033+
let data = CharsetMenu.getData();
1034+
return data.pinnedCharsets.concat(data.otherCharsets).map(function (o) [o.value, o.label]);
1035+
};
1036+
}
10281037
};
10291038

10301039
completion.directory = function directory(context, full) {

0 commit comments

Comments
 (0)