diff --git a/content/buffer.js b/content/buffer.js index 64cb6983..b027e551 100644 --- a/content/buffer.js +++ b/content/buffer.js @@ -456,6 +456,12 @@ liberator.Buffer = function () //{{{ "Select the author style sheet to apply", function (args) { + if (!args) + { + liberator.echoerr("E471: Argument required"); + return; + } + if (liberator.options["usermode"]) liberator.options["usermode"] = false; diff --git a/content/completion.js b/content/completion.js index 9c661e69..20794dec 100644 --- a/content/completion.js +++ b/content/completion.js @@ -287,7 +287,15 @@ liberator.Completion = function () //{{{ stylesheet: function (filter) { - var stylesheets = getAllStyleSheets(window.content).map(function (stylesheet) { return [stylesheet.title, ""]; }); + var stylesheets = getAllStyleSheets(window.content); + + // TODO: how should we handle duplicate titles? + stylesheets = stylesheets.filter(function(stylesheet) { + return !(!/^(screen|all|)$/i.test(stylesheet.media.mediaText) || /^\s*$/.test(stylesheet.title)) + }).map(function (stylesheet) { + return [stylesheet.title, stylesheet.href || "inline"]; + }); + return [0, this.filter(stylesheets, filter)]; },