Disable autocenter mode while searching and filtering
This commit is contained in:
1
NEWS
1
NEWS
@@ -26,6 +26,7 @@ ncmpcpp-0.8 (????-??-??)
|
|||||||
* Added support for fetching lyrics from jah-lyrics.com and plyrics.com.
|
* Added support for fetching lyrics from jah-lyrics.com and plyrics.com.
|
||||||
* Seek immediately after invoking appropriate action once.
|
* Seek immediately after invoking appropriate action once.
|
||||||
* Added support for locating current song in playlist editor.
|
* Added support for locating current song in playlist editor.
|
||||||
|
* Disable autocenter mode while searching and filtering.
|
||||||
|
|
||||||
ncmpcpp-0.7.7 (2016-10-31)
|
ncmpcpp-0.7.7 (2016-10-31)
|
||||||
* Fixed compilation on 32bit platforms.
|
* Fixed compilation on 32bit platforms.
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ noinst_HEADERS = \
|
|||||||
utility/html.h \
|
utility/html.h \
|
||||||
utility/option_parser.h \
|
utility/option_parser.h \
|
||||||
utility/readline.h \
|
utility/readline.h \
|
||||||
|
utility/scoped_value.h \
|
||||||
utility/shared_resource.h \
|
utility/shared_resource.h \
|
||||||
utility/string.h \
|
utility/string.h \
|
||||||
utility/type_conversions.h \
|
utility/type_conversions.h \
|
||||||
|
|||||||
@@ -39,6 +39,7 @@
|
|||||||
#include "statusbar.h"
|
#include "statusbar.h"
|
||||||
#include "utility/comparators.h"
|
#include "utility/comparators.h"
|
||||||
#include "utility/conversion.h"
|
#include "utility/conversion.h"
|
||||||
|
#include "utility/scoped_value.h"
|
||||||
|
|
||||||
#include "curses/menu_impl.h"
|
#include "curses/menu_impl.h"
|
||||||
#include "bindings.h"
|
#include "bindings.h"
|
||||||
@@ -1982,6 +1983,7 @@ void ApplyFilter::run()
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
ScopedValue<bool> disabled_autocenter_mode(Config.autocenter_mode, false);
|
||||||
Statusbar::ScopedLock slock;
|
Statusbar::ScopedLock slock;
|
||||||
NC::Window::ScopedPromptHook helper(
|
NC::Window::ScopedPromptHook helper(
|
||||||
*wFooter,
|
*wFooter,
|
||||||
@@ -3022,6 +3024,7 @@ void findItem(const SearchDirection direction)
|
|||||||
std::string constraint = w->searchConstraint();
|
std::string constraint = w->searchConstraint();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
ScopedValue<bool> disabled_autocenter_mode(Config.autocenter_mode, false);
|
||||||
Statusbar::ScopedLock slock;
|
Statusbar::ScopedLock slock;
|
||||||
NC::Window::ScopedPromptHook prompt_hook(
|
NC::Window::ScopedPromptHook prompt_hook(
|
||||||
*wFooter,
|
*wFooter,
|
||||||
|
|||||||
44
src/utility/scoped_value.h
Normal file
44
src/utility/scoped_value.h
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2008-2016 by Andrzej Rybczak *
|
||||||
|
* electricityispower@gmail.com *
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program; if not, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifndef NCMPCPP_UTILITY_SCOPED_VALUE_H
|
||||||
|
#define NCMPCPP_UTILITY_SCOPED_VALUE_H
|
||||||
|
|
||||||
|
template <typename ValueT>
|
||||||
|
struct ScopedValue
|
||||||
|
{
|
||||||
|
ScopedValue(ValueT &ref, ValueT &&new_value)
|
||||||
|
: m_ref(ref)
|
||||||
|
{
|
||||||
|
m_value = ref;
|
||||||
|
m_ref = std::forward<ValueT>(new_value);
|
||||||
|
}
|
||||||
|
|
||||||
|
~ScopedValue()
|
||||||
|
{
|
||||||
|
m_ref = std::move(m_value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
ValueT &m_ref;
|
||||||
|
ValueT m_value;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // NCMPCPP_UTILITY_SCOPED_VALUE_H
|
||||||
Reference in New Issue
Block a user