new feature: support for centered cursor (disabled by default)

This commit is contained in:
Andrzej Rybczak
2009-11-11 00:50:14 +01:00
parent 35a182d79e
commit 3b7f19f095
5 changed files with 13 additions and 0 deletions

View File

@@ -225,6 +225,8 @@
# #
#autocenter_mode = "no" #autocenter_mode = "no"
# #
#centered_cursor = "no"
#
#progressbar_look = "=>" #progressbar_look = "=>"
# #
#default_place_to_search_in = "database" (database/playlist) #default_place_to_search_in = "database" (database/playlist)

View File

@@ -180,6 +180,9 @@ If enabled, statusbar will be displayed, otherwise hidden.
.B autocenter_mode = yes/no .B autocenter_mode = yes/no
Default state for autocenter mode at start. Default state for autocenter mode at start.
.TP .TP
.B centered_cursor = yes/no
If enabled, currently highlighted position in the list will be always centered.
.TP
.B progressbar_look = TEXT .B progressbar_look = TEXT
This variable defines the look of progressbar. Note that it has to be exactly two characters long. This variable defines the look of progressbar. Note that it has to be exactly two characters long.
.TP .TP

View File

@@ -235,6 +235,8 @@ template <typename WindowType> void Screen<WindowType>::Scroll(Where where, cons
} }
else else
w->Scroll(where); w->Scroll(where);
if (List *list = Config.centered_cursor ? dynamic_cast<List *>(w) : 0)
list->Highlight(list->Choice());
} }
template <typename WindowType> void Screen<WindowType>::MouseButtonPressed(MEVENT me) template <typename WindowType> void Screen<WindowType>::MouseButtonPressed(MEVENT me)

View File

@@ -293,6 +293,7 @@ void DefaultConfiguration(ncmpcpp_config &conf)
conf.header_visibility = true; conf.header_visibility = true;
conf.header_text_scrolling = true; conf.header_text_scrolling = true;
conf.statusbar_visibility = true; conf.statusbar_visibility = true;
conf.centered_cursor = false;
conf.autocenter_mode = false; conf.autocenter_mode = false;
conf.wrapped_search = true; conf.wrapped_search = true;
conf.space_selects = false; conf.space_selects = false;
@@ -756,6 +757,10 @@ void ReadConfiguration(ncmpcpp_config &conf)
{ {
conf.autocenter_mode = v == "yes"; conf.autocenter_mode = v == "yes";
} }
else if (cl.find("centered_cursor") != std::string::npos)
{
conf.centered_cursor = v == "yes";
}
else if (cl.find("default_find_mode") != std::string::npos) else if (cl.find("default_find_mode") != std::string::npos)
{ {
conf.wrapped_search = v == "wrapped"; conf.wrapped_search = v == "wrapped";

View File

@@ -186,6 +186,7 @@ struct ncmpcpp_config
bool header_visibility; bool header_visibility;
bool header_text_scrolling; bool header_text_scrolling;
bool statusbar_visibility; bool statusbar_visibility;
bool centered_cursor;
bool autocenter_mode; bool autocenter_mode;
bool wrapped_search; bool wrapped_search;
bool space_selects; bool space_selects;