fixes for 2b39e6ed42
This commit is contained in:
@@ -130,7 +130,7 @@ void Display::SongsInColumns(const MPD::Song &s, void *, Menu<MPD::Song> *menu)
|
||||
if (Config.columns.size() > 1)
|
||||
next2last = Config.columns.end()-2;
|
||||
|
||||
bool discard_colors = Config.discard_colors_if_item_is_selected && menu->GetColor() != Config.main_color && menu->isSelected(menu->CurrentlyDrawedPosition());
|
||||
bool discard_colors = Config.discard_colors_if_item_is_selected && menu->isSelected(menu->CurrentlyDrawedPosition());
|
||||
|
||||
for (it = Config.columns.begin(); it != Config.columns.end(); ++it)
|
||||
{
|
||||
@@ -243,7 +243,7 @@ void Display::Songs(const MPD::Song &s, void *data, Menu<MPD::Song> *menu)
|
||||
if (is_now_playing)
|
||||
*menu << Config.now_playing_prefix;
|
||||
|
||||
bool discard_colors = Config.discard_colors_if_item_is_selected && menu->GetColor() != Config.main_color && menu->isSelected(menu->CurrentlyDrawedPosition());
|
||||
bool discard_colors = Config.discard_colors_if_item_is_selected && menu->isSelected(menu->CurrentlyDrawedPosition());
|
||||
|
||||
std::string line = s.toString(*static_cast<std::string *>(data), "$");
|
||||
for (std::string::const_iterator it = line.begin(); it != line.end(); ++it)
|
||||
@@ -265,13 +265,11 @@ void Display::Songs(const MPD::Song &s, void *data, Menu<MPD::Song> *menu)
|
||||
basic_buffer<my_char_t> buf;
|
||||
buf << U(" ");
|
||||
String2Buffer(TO_WSTRING(line.substr(it-line.begin()+1)), buf);
|
||||
if (discard_colors)
|
||||
buf.RemoveFormatting();
|
||||
if (is_now_playing)
|
||||
buf << Config.now_playing_suffix;
|
||||
*menu << XY(menu->GetWidth()-buf.Str().length()-(menu->isSelected(menu->CurrentlyDrawedPosition()) ? Config.selected_item_suffix_length : 0), menu->Y());
|
||||
if (discard_colors)
|
||||
*menu << buf.Str();
|
||||
else
|
||||
*menu << buf;
|
||||
*menu << XY(menu->GetWidth()-buf.Str().length()-(menu->isSelected(menu->CurrentlyDrawedPosition()) ? Config.selected_item_suffix_length : 0), menu->Y()) << buf;
|
||||
return;
|
||||
}
|
||||
else // not a color nor right align, just a random character
|
||||
|
||||
@@ -106,6 +106,10 @@ namespace NCurses
|
||||
void RemoveFormatting(short val_b, std::basic_string<C> pattern, short val_e,
|
||||
bool case_sensitive, bool for_each = 1);
|
||||
|
||||
/// Removes all formating applied to string in buffer.
|
||||
///
|
||||
void RemoveFormatting();
|
||||
|
||||
/// Sets the pointer to string, that will be passed in operator<<() to window
|
||||
/// object instead of the internal buffer. This is useful if you took the content
|
||||
/// of the buffer, modified it somehow and want to print the modified version instead
|
||||
@@ -253,6 +257,11 @@ template <typename C> void NCurses::basic_buffer<C>::RemoveFormatting( short val
|
||||
}
|
||||
}
|
||||
|
||||
template <typename C> void NCurses::basic_buffer<C>::RemoveFormatting()
|
||||
{
|
||||
itsFormat.clear();
|
||||
}
|
||||
|
||||
template <typename C> void NCurses::basic_buffer<C>::SetTemp(std::basic_string<C> *tmp)
|
||||
{
|
||||
itsTempString = tmp;
|
||||
|
||||
Reference in New Issue
Block a user