1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-07 15:14:11 +01:00

Respect 'incsearch' when searching in Player mode.

This commit is contained in:
Doug Kearns
2009-03-30 01:03:22 +11:00
parent 2d25c1f7c3
commit 8300db58dc
2 changed files with 24 additions and 8 deletions

View File

@@ -10,12 +10,12 @@ BUGS:
Is this workable anyway? --djk Is this workable anyway? --djk
- <C-^> is off by one when alternating with the media tab - <C-^> is off by one when alternating with the media tab
- numbered tabs - numbered tabs
- :winopen
FEATURES: FEATURES:
9 '?' - Reusing '/'. 9 '?' - Reusing '/'.
8 Playlist/SmartPlaylist operations & meta-data operations. 8 Playlist/SmartPlaylist operations & meta-data operations.
7 extended hint mode for opening links in FF. 7 extended hint mode for opening links in FF.
6 :tqueue, :lqueue etc.
5 make Player mode commands work in the Mini-Player. 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 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 Wouldn't these be provided as Xulmus plugins like Vimperator does? --djk

View File

@@ -56,8 +56,8 @@ function Player() // {{{
.getService(Components.interfaces.sbIMediaPageManager); .getService(Components.interfaces.sbIMediaPageManager);
// Register Callbacks for searching. // Register Callbacks for searching.
liberator.registerCallback("change", 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 (command) { player.searchView(command);}); liberator.registerCallback("submit", modes.SEARCH_VIEW_FORWARD, function (str) { player.onSearchSubmit(str); });
//liberator.registerCallback("cancel", modes.SEARCH_VIEW_FORWARD, function (command) { player.searchView(command);}); //liberator.registerCallback("cancel", modes.SEARCH_VIEW_FORWARD, function (command) { player.searchView(command);});
// interval (milliseconds) // interval (milliseconds)
@@ -592,16 +592,22 @@ function Player() // {{{
} }
}, },
//FIXME: commandline.echo should work --ken
searchViewAgain: function searchViewAgain(reverse) 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 (reverse)
{ {
if (lastSearchIndex == 0) 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; lastSearchIndex = lastSearchView.length - 1;
echo("Search hit TOP, continuing at BOTTOM");
} }
else else
lastSearchIndex = lastSearchIndex - 1; lastSearchIndex = lastSearchIndex - 1;
@@ -610,9 +616,8 @@ function Player() // {{{
{ {
if (lastSearchIndex == (lastSearchView.length - 1)) 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; lastSearchIndex = 0;
echo("Search hit BOTTOM, continuing at TOP");
} }
else else
lastSearchIndex = lastSearchIndex + 1; 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() getPlaylists: function getPlaylists()
{ {
let mainLibrary = LibraryUtils.mainLibrary; let mainLibrary = LibraryUtils.mainLibrary;