$OpenBSD: patch-src_actions_cpp,v 1.3 2016/06/28 09:17:05 dcoppa Exp $

commit a0b662886555be36037222e541e84c2dc5787658
Author: Andrzej Rybczak <electricityispower@gmail.com>
Date:   Fri Jun 10 15:00:32 2016 +0200

actions: allow action chains to be used for seeking

--- src/actions.cpp.orig	Sun Apr 17 07:41:01 2016
+++ src/actions.cpp	Tue Jun 28 10:52:54 2016
@@ -2830,9 +2830,30 @@ void seek()
 	int old_timeout = wFooter->getTimeout();
 	wFooter->setTimeout(BaseScreen::defaultWindowTimeout);
 	
-	auto seekForward = &Actions::get(Actions::Type::SeekForward);
-	auto seekBackward = &Actions::get(Actions::Type::SeekBackward);
-	
+	auto hasRunnableAction = [](BindingsConfiguration::BindingIteratorPair &bindings, Actions::Type type) {
+		bool success = false;
+		for (auto binding = bindings.first; binding != bindings.second; ++binding)
+		{
+			auto &actions = binding->actions();
+			for (const auto &action : actions)
+			{
+				if (action->canBeRun())
+				{
+					if (action->type() == type)
+						success = true;
+				}
+				else
+				{
+					success = false;
+					break;
+				}
+			}
+			if (success)
+				break;
+		}
+		return success;
+	};
+
 	SeekingInProgress = true;
 	while (true)
 	{
@@ -2844,15 +2865,12 @@ void seek()
 		
 		NC::Key::Type input = readKey(*wFooter);
 		auto k = Bindings.get(input);
-		if (k.first == k.second || !k.first->isSingle()) // no single action?
-			break;
-		auto a = k.first->action();
-		if (a == seekForward)
+		if (hasRunnableAction(k, Actions::Type::SeekForward))
 		{
 			if (songpos < Status::State::totalTime())
 				songpos = std::min(songpos + howmuch, Status::State::totalTime());
 		}
-		else if (a == seekBackward)
+		else if (hasRunnableAction(k, Actions::Type::SeekBackward))
 		{
 			if (songpos > 0)
 			{
