From 8300db58dcaedee2e73a03c55f1f35f384982a3d Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Mon, 30 Mar 2009 01:03:22 +1100 Subject: [PATCH] Respect 'incsearch' when searching in Player mode. --- xulmus/TODO | 2 +- xulmus/content/player.js | 30 +++++++++++++++++++++++------- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/xulmus/TODO b/xulmus/TODO index 9a5e1dcf..b9399a58 100644 --- a/xulmus/TODO +++ b/xulmus/TODO @@ -10,12 +10,12 @@ BUGS: Is this workable anyway? --djk - is off by one when alternating with the media tab - numbered tabs - - :winopen FEATURES: 9 '?' - Reusing '/'. 8 Playlist/SmartPlaylist operations & meta-data operations. 7 extended hint mode for opening links in FF. +6 :tqueue, :lqueue etc. 5 make Player mode commands work in the Mini-Player. 5 Check for default extensions and add commands for them. Ex. Last.fm, Seeqpod e.t.c Wouldn't these be provided as Xulmus plugins like Vimperator does? --djk diff --git a/xulmus/content/player.js b/xulmus/content/player.js index 909284c7..54d5eaf7 100644 --- a/xulmus/content/player.js +++ b/xulmus/content/player.js @@ -56,8 +56,8 @@ function Player() // {{{ .getService(Components.interfaces.sbIMediaPageManager); // Register Callbacks for searching. - liberator.registerCallback("change", modes.SEARCH_VIEW_FORWARD, function (command) { player.searchView(command);}); - liberator.registerCallback("submit", modes.SEARCH_VIEW_FORWARD, function (command) { player.searchView(command);}); + liberator.registerCallback("change", modes.SEARCH_VIEW_FORWARD, function (str) { player.onSearchKeyPress(str); }); + liberator.registerCallback("submit", modes.SEARCH_VIEW_FORWARD, function (str) { player.onSearchSubmit(str); }); //liberator.registerCallback("cancel", modes.SEARCH_VIEW_FORWARD, function (command) { player.searchView(command);}); // interval (milliseconds) @@ -592,16 +592,22 @@ function Player() // {{{ } }, - //FIXME: commandline.echo should work --ken searchViewAgain: function searchViewAgain(reverse) { + function echo(str) + { + setTimeout(function () { + commandline.echo("Search hit TOP, continuing at BOTTOM", + commandline.HL_WARNINGMSG, commandline.APPEND_TO_MESSAGES | commandline.FORCE_SINGLELINE); + }, 0); + } + if (reverse) { if (lastSearchIndex == 0) { - //commandline.echo("Search hit TOP, continuing at BOTTOM", - // commandline.HL_WARNINGMSG, commandline.APPEND_TO_MESSAGES | commandline.FORCE_SINGLELINE); lastSearchIndex = lastSearchView.length - 1; + echo("Search hit TOP, continuing at BOTTOM"); } else lastSearchIndex = lastSearchIndex - 1; @@ -610,9 +616,8 @@ function Player() // {{{ { if (lastSearchIndex == (lastSearchView.length - 1)) { - //commandline.echo("Search hit BOTTOM, continuing at TOP", - // commandline.HL_WARNINGMSG, commandline.APPEND_TO_MESSAGES | commandline.FORCE_SINGLELINE); lastSearchIndex = 0; + echo("Search hit BOTTOM, continuing at TOP"); } else lastSearchIndex = lastSearchIndex + 1; @@ -624,6 +629,17 @@ function Player() // {{{ }, + onSearchKeyPress: function (str) + { + if (options["incsearch"]) + this.searchView(str); + }, + + onSearchSubmit: function (str) + { + this.searchView(str); + }, + getPlaylists: function getPlaylists() { let mainLibrary = LibraryUtils.mainLibrary;