make last column with fixed size take its whole size, not size-1

This commit is contained in:
Andrzej Rybczak
2010-08-22 18:40:10 +02:00
parent 7aebb34015
commit e4b3d6aea2

View File

@@ -88,7 +88,7 @@ std::string Display::Columns()
if (it == Config.columns.end()-1) if (it == Config.columns.end()-1)
width = COLS-where; width = COLS-where;
else if (last_fixed && it == next2last) else if (last_fixed && it == next2last)
width = COLS-where-(++next2last)->width; width = COLS-where-1-(++next2last)->width;
else else
width = it->width*(it->fixed ? 1 : COLS/100.0); width = it->width*(it->fixed ? 1 : COLS/100.0);
@@ -130,6 +130,9 @@ void Display::SongsInColumns(const MPD::Song &s, void *data, Menu<MPD::Song> *me
if (!s.Localized()) if (!s.Localized())
const_cast<MPD::Song *>(&s)->Localize(); const_cast<MPD::Song *>(&s)->Localize();
/// FIXME: This function is pure mess, it needs to be
/// rewritten and unified with Display::Columns() a bit.
bool is_now_playing = menu == myPlaylist->Items && (menu->isFiltered() ? s.GetPosition() : menu->CurrentlyDrawedPosition()) == size_t(myPlaylist->NowPlaying); bool is_now_playing = menu == myPlaylist->Items && (menu->isFiltered() ? s.GetPosition() : menu->CurrentlyDrawedPosition()) == size_t(myPlaylist->NowPlaying);
if (is_now_playing) if (is_now_playing)
*menu << Config.now_playing_prefix; *menu << Config.now_playing_prefix;
@@ -172,7 +175,7 @@ void Display::SongsInColumns(const MPD::Song &s, void *data, Menu<MPD::Song> *me
if (it == Config.columns.end()-1) if (it == Config.columns.end()-1)
width = menu->GetWidth()-where; width = menu->GetWidth()-where;
else if (last_fixed && it == next2last) else if (last_fixed && it == next2last)
width = COLS-where-(++next2last)->width; width = COLS-where-1-(++next2last)->width;
else else
width = it->width*(it->fixed ? 1 : COLS/100.0); width = it->width*(it->fixed ? 1 : COLS/100.0);