fixes
This commit is contained in:
18
src/menu.h
18
src/menu.h
@@ -171,11 +171,16 @@ int Menu<T>::count_length(string str)
|
||||
|
||||
for (int i = 0; i < str2.length(); i++, length++)
|
||||
{
|
||||
if (str2[i] == '[')
|
||||
if (str2[i] == '[' && (str2[i+1] == '.' || str2[i+1] == '/'))
|
||||
collect = 1;
|
||||
|
||||
if (collect)
|
||||
{
|
||||
if (str2[i] != '[')
|
||||
tmp += str2[i];
|
||||
else
|
||||
tmp = str2[i];
|
||||
}
|
||||
|
||||
if (str2[i] == ']')
|
||||
collect = 0;
|
||||
@@ -423,17 +428,10 @@ void Menu<T>::Refresh(bool redraw_whole_window)
|
||||
}
|
||||
}
|
||||
|
||||
# ifdef UTF8_ENABLED
|
||||
if (itsOptions[*it]->selected)
|
||||
WriteXY(x, line, itsWidth, ToWString(itsSelectedPrefix + option + itsSelectedSuffix), 0);
|
||||
WriteXY(x, line, itsWidth, TO_WSTRING(itsSelectedPrefix + option + itsSelectedSuffix), 0);
|
||||
else
|
||||
WriteXY(x, line, itsWidth, ToWString(option), 0);
|
||||
# else
|
||||
if (itsOptions[*it]->selected)
|
||||
WriteXY(x, line, itsWidth, itsSelectedPrefix + option + itsSelectedSuffix, 0);
|
||||
else
|
||||
WriteXY(x, line, itsWidth, option, 0);
|
||||
# endif
|
||||
WriteXY(x, line, itsWidth, TO_WSTRING(option), 0);
|
||||
|
||||
if (!ch && (itsOptions[*it]->location == lCenter || itsOptions[*it]->location == lLeft))
|
||||
{
|
||||
|
||||
@@ -173,6 +173,7 @@ int main(int argc, char *argv[])
|
||||
main_height++;
|
||||
|
||||
mPlaylist = new Menu<Song>(0, main_start_y, COLS, main_height, Config.columns_in_playlist ? DisplayColumns(Config.song_columns_list_format) : "", Config.main_color, brNone);
|
||||
mPlaylist->AutoRefresh(0);
|
||||
mPlaylist->SetTimeout(ncmpcpp_window_timeout);
|
||||
mPlaylist->HighlightColor(Config.main_highlight_color);
|
||||
mPlaylist->SetSelectPrefix(Config.selected_item_prefix);
|
||||
@@ -368,8 +369,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (current_screen == csPlaylist && !playlist_stats.empty())
|
||||
wHeader->WriteXY(title.length(), 0, max_allowed_title_length-title.length(), playlist_stats);
|
||||
|
||||
if (current_screen == csBrowser)
|
||||
else if (current_screen == csBrowser)
|
||||
{
|
||||
int max_length_without_scroll = wHeader->GetWidth()-volume_state.length()-title.length();
|
||||
my_string_t wbrowseddir = TO_WSTRING(browsed_dir);
|
||||
@@ -651,10 +651,12 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
if (redraw_screen && wCurrent == mEditorTagTypes && mEditorTagTypes->GetChoice() < 10)
|
||||
{
|
||||
mEditorTags->Refresh(1);
|
||||
redraw_screen = 0;
|
||||
}
|
||||
else if (mEditorTagTypes->GetChoice() >= 10)
|
||||
mEditorTags->Window::Clear();
|
||||
redraw_screen = 0;
|
||||
}
|
||||
# endif // HAVE_TAGLIB_H
|
||||
// album editor end
|
||||
@@ -1277,9 +1279,6 @@ int main(int argc, char *argv[])
|
||||
# ifdef HAVE_TAGLIB_H
|
||||
case csTagEditor:
|
||||
{
|
||||
if (mEditorTags->Empty())
|
||||
break;
|
||||
|
||||
if (wCurrent == mEditorDirs)
|
||||
{
|
||||
TagList test;
|
||||
@@ -1296,6 +1295,9 @@ int main(int argc, char *argv[])
|
||||
break;
|
||||
}
|
||||
|
||||
if (mEditorTags->Empty()) // we need songs to deal with, don't we?
|
||||
break;
|
||||
|
||||
// if there are selected songs, perform operations only on them
|
||||
SongList list;
|
||||
if (mEditorTags->IsAnySelected())
|
||||
|
||||
@@ -192,9 +192,6 @@ void NcmpcppStatusChanged(MPDConnection *Mpd, MPDStatusChanges changed, void *da
|
||||
}
|
||||
else
|
||||
{
|
||||
// mPlaylist->BoldOption(old_playing+1, 0);
|
||||
// mPlaylist->BoldOption(now_playing+1, 1);
|
||||
|
||||
Mpd->GetPlaylistChanges(-1, list);
|
||||
|
||||
for (int i = 0; i < mPlaylist->Size(); i++)
|
||||
|
||||
@@ -629,7 +629,7 @@ char * ToString(const wchar_t *ws)
|
||||
string s;
|
||||
for (int i = 0; i < wcslen(ws); i++)
|
||||
{
|
||||
char *c = (char *)calloc(MB_CUR_MAX, sizeof(char));
|
||||
char *c = new char[MB_CUR_MAX]();
|
||||
wctomb(c, ws[i]);
|
||||
s += c;
|
||||
delete [] c;
|
||||
@@ -640,7 +640,7 @@ char * ToString(const wchar_t *ws)
|
||||
|
||||
wchar_t * ToWString(const char *s)
|
||||
{
|
||||
wchar_t *ws = (wchar_t *)calloc(strlen(s)+1, sizeof(wchar_t));
|
||||
wchar_t *ws = new wchar_t[strlen(s)+1]();
|
||||
mbstowcs(ws, s, strlen(s));
|
||||
return ws;
|
||||
}
|
||||
@@ -650,7 +650,7 @@ string ToString(const wstring &ws)
|
||||
string s;
|
||||
for (wstring::const_iterator it = ws.begin(); it != ws.end(); it++)
|
||||
{
|
||||
char *c = (char *)calloc(MB_CUR_MAX, sizeof(char));
|
||||
char *c = new char[MB_CUR_MAX]();
|
||||
wctomb(c, *it);
|
||||
s += c;
|
||||
delete [] c;
|
||||
@@ -660,14 +660,13 @@ string ToString(const wstring &ws)
|
||||
|
||||
wstring ToWString(const string &s)
|
||||
{
|
||||
wchar_t *ws = (wchar_t *)calloc(s.length()+1, sizeof(wchar_t));
|
||||
wchar_t *ws = new wchar_t[s.length()+1]();
|
||||
mbstowcs(ws, s.c_str(), s.length());
|
||||
wstring result = ws;
|
||||
delete [] ws;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
string Window::OmitBBCodes(const string &str)
|
||||
{
|
||||
bool collect = false;
|
||||
|
||||
Reference in New Issue
Block a user