add separate keys to move sel. before/after cursor
This commit is contained in:
committed by
Andrzej Rybczak
parent
883d1a6cdd
commit
dc8aff65a2
4
doc/keys
4
doc/keys
@@ -146,6 +146,10 @@
|
|||||||
#
|
#
|
||||||
#key_move_to = 'M'
|
#key_move_to = 'M'
|
||||||
#
|
#
|
||||||
|
#key_move_before = 0
|
||||||
|
#
|
||||||
|
#key_move_after = 0
|
||||||
|
#
|
||||||
#key_add = 'a'
|
#key_add = 'a'
|
||||||
#
|
#
|
||||||
#key_save_playlist = 'S'
|
#key_save_playlist = 'S'
|
||||||
|
|||||||
@@ -231,6 +231,8 @@ void Help::GetKeybindings()
|
|||||||
*w << DisplayKeys(Key.MvSongUp) << "Move item(s) up\n";
|
*w << DisplayKeys(Key.MvSongUp) << "Move item(s) up\n";
|
||||||
*w << DisplayKeys(Key.MvSongDown) << "Move item(s) down\n";
|
*w << DisplayKeys(Key.MvSongDown) << "Move item(s) down\n";
|
||||||
*w << DisplayKeys(Key.MoveTo) << "Move selected item(s) to cursor position\n";
|
*w << DisplayKeys(Key.MoveTo) << "Move selected item(s) to cursor position\n";
|
||||||
|
*w << DisplayKeys(Key.MoveBefore) << "Move selected item(s) before cursor position\n";
|
||||||
|
*w << DisplayKeys(Key.MoveAfter) << "Move selected item(s) after cursor position\n";
|
||||||
*w << DisplayKeys(Key.Add) << "Add url/file/directory to playlist\n";
|
*w << DisplayKeys(Key.Add) << "Add url/file/directory to playlist\n";
|
||||||
# ifdef HAVE_TAGLIB_H
|
# ifdef HAVE_TAGLIB_H
|
||||||
*w << DisplayKeys(Key.EditTags) << "Edit song's tags\n";
|
*w << DisplayKeys(Key.EditTags) << "Edit song's tags\n";
|
||||||
|
|||||||
@@ -1137,7 +1137,8 @@ int main(int argc, char *argv[])
|
|||||||
wFooter->SetTimeout(ncmpcpp_window_timeout);
|
wFooter->SetTimeout(ncmpcpp_window_timeout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (Keypressed(input, Key.MoveTo) && myScreen == myPlaylist)
|
else if ((Keypressed(input, Key.MoveTo) || Keypressed(input, Key.MoveBefore)
|
||||||
|
|| Keypressed(input, Key.MoveAfter)) && myScreen == myPlaylist)
|
||||||
{
|
{
|
||||||
CHECK_PLAYLIST_FOR_FILTERING;
|
CHECK_PLAYLIST_FOR_FILTERING;
|
||||||
if (!myPlaylist->Items->hasSelected())
|
if (!myPlaylist->Items->hasSelected())
|
||||||
@@ -1147,13 +1148,18 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
Playlist::BlockUpdate = 1;
|
Playlist::BlockUpdate = 1;
|
||||||
size_t pos = myPlaylist->Items->Choice();
|
size_t pos = myPlaylist->Items->Choice();
|
||||||
// if cursor is at the last item, break convention and move at the end of playlist
|
|
||||||
if (pos == myPlaylist->Items->Size()-1)
|
|
||||||
pos++;
|
|
||||||
std::vector<size_t> list;
|
std::vector<size_t> list;
|
||||||
myPlaylist->Items->GetSelected(list);
|
myPlaylist->Items->GetSelected(list);
|
||||||
if (pos >= list.front() && pos <= list.back())
|
if (pos >= list.front() && pos <= list.back())
|
||||||
continue;
|
continue;
|
||||||
|
if (Keypressed(input, Key.MoveTo))
|
||||||
|
{
|
||||||
|
// if cursor is at the last item, break convention and move at the end of playlist
|
||||||
|
if (pos == myPlaylist->Items->Size()-1)
|
||||||
|
pos++;
|
||||||
|
}
|
||||||
|
else if (Keypressed(input, Key.MoveAfter))
|
||||||
|
pos++;
|
||||||
int diff = pos-list.front();
|
int diff = pos-list.front();
|
||||||
Mpd.StartCommandsList();
|
Mpd.StartCommandsList();
|
||||||
if (diff > 0)
|
if (diff > 0)
|
||||||
|
|||||||
@@ -220,6 +220,8 @@ void NcmpcppKeys::SetDefaults()
|
|||||||
MvSongUp[0] = 'm';
|
MvSongUp[0] = 'm';
|
||||||
MvSongDown[0] = 'n';
|
MvSongDown[0] = 'n';
|
||||||
MoveTo[0] = 'M';
|
MoveTo[0] = 'M';
|
||||||
|
MoveBefore[0] = NullKey;
|
||||||
|
MoveAfter[0] = NullKey;
|
||||||
Add[0] = 'a';
|
Add[0] = 'a';
|
||||||
SavePlaylist[0] = 'S';
|
SavePlaylist[0] = 'S';
|
||||||
GoToNowPlaying[0] = 'o';
|
GoToNowPlaying[0] = 'o';
|
||||||
@@ -302,6 +304,8 @@ void NcmpcppKeys::SetDefaults()
|
|||||||
MvSongUp[1] = NullKey;
|
MvSongUp[1] = NullKey;
|
||||||
MvSongDown[1] = NullKey;
|
MvSongDown[1] = NullKey;
|
||||||
MoveTo[1] = NullKey;
|
MoveTo[1] = NullKey;
|
||||||
|
MoveBefore[1] = NullKey;
|
||||||
|
MoveAfter[1] = NullKey;
|
||||||
Add[1] = NullKey;
|
Add[1] = NullKey;
|
||||||
SavePlaylist[1] = NullKey;
|
SavePlaylist[1] = NullKey;
|
||||||
GoToNowPlaying[1] = NullKey;
|
GoToNowPlaying[1] = NullKey;
|
||||||
@@ -571,6 +575,10 @@ void NcmpcppKeys::Read()
|
|||||||
GetKeys(key, MvSongDown);
|
GetKeys(key, MvSongDown);
|
||||||
else if (key.find("key_move_to ") != std::string::npos)
|
else if (key.find("key_move_to ") != std::string::npos)
|
||||||
GetKeys(key, MoveTo);
|
GetKeys(key, MoveTo);
|
||||||
|
else if (key.find("key_move_before ") != std::string::npos)
|
||||||
|
GetKeys(key, MoveBefore);
|
||||||
|
else if (key.find("key_move_after ") != std::string::npos)
|
||||||
|
GetKeys(key, MoveAfter);
|
||||||
else if (key.find("key_add ") != std::string::npos)
|
else if (key.find("key_add ") != std::string::npos)
|
||||||
GetKeys(key, Add);
|
GetKeys(key, Add);
|
||||||
else if (key.find("key_save_playlist ") != std::string::npos)
|
else if (key.find("key_save_playlist ") != std::string::npos)
|
||||||
|
|||||||
@@ -125,6 +125,8 @@ struct NcmpcppKeys
|
|||||||
int MvSongUp[2];
|
int MvSongUp[2];
|
||||||
int MvSongDown[2];
|
int MvSongDown[2];
|
||||||
int MoveTo[2];
|
int MoveTo[2];
|
||||||
|
int MoveBefore[2];
|
||||||
|
int MoveAfter[2];
|
||||||
int Add[2];
|
int Add[2];
|
||||||
int SavePlaylist[2];
|
int SavePlaylist[2];
|
||||||
int GoToNowPlaying[2];
|
int GoToNowPlaying[2];
|
||||||
|
|||||||
Reference in New Issue
Block a user