fix bug with removing format from artist's info screen
This commit is contained in:
@@ -188,6 +188,8 @@ void Info::GetArtist()
|
||||
input.close();
|
||||
w->SetFormatting(fmtBold, "\n\nSimilar artists:\n", fmtBoldEnd, 0);
|
||||
w->SetFormatting(Config.color2, "\n * ", clEnd);
|
||||
// below is used so format won't be removed using RemoveFormatting() by accident.
|
||||
w->ForgetFormatting();
|
||||
w->Flush();
|
||||
}
|
||||
else
|
||||
|
||||
@@ -33,8 +33,8 @@ Scrollpad::Scrollpad(size_t startx,
|
||||
: Window(startx, starty, width, height, title, color, border),
|
||||
itsBeginning(0),
|
||||
itsFoundForEach(0),
|
||||
itsFoundValueBegin(0),
|
||||
itsFoundValueEnd(0),
|
||||
itsFoundValueBegin(-1),
|
||||
itsFoundValueEnd(-1),
|
||||
itsRealHeight(1)
|
||||
{
|
||||
}
|
||||
@@ -114,17 +114,21 @@ bool Scrollpad::SetFormatting(short vb, const std::basic_string<my_char_t> &s, s
|
||||
itsFoundPattern = s;
|
||||
}
|
||||
else
|
||||
{
|
||||
itsFoundForEach = 0;
|
||||
itsFoundValueBegin = 0;
|
||||
itsFoundValueEnd = 0;
|
||||
itsFoundPattern.clear();
|
||||
}
|
||||
ForgetFormatting();
|
||||
return result;
|
||||
}
|
||||
|
||||
void Scrollpad::ForgetFormatting()
|
||||
{
|
||||
itsFoundForEach = 0;
|
||||
itsFoundValueBegin = -1;
|
||||
itsFoundValueEnd = -1;
|
||||
itsFoundPattern.clear();
|
||||
}
|
||||
|
||||
void Scrollpad::RemoveFormatting()
|
||||
{
|
||||
if (itsFoundValueBegin >= 0 && itsFoundValueEnd >= 0)
|
||||
itsBuffer.RemoveFormatting(itsFoundValueBegin, itsFoundPattern, itsFoundValueEnd, itsFoundForEach);
|
||||
}
|
||||
|
||||
@@ -205,6 +209,7 @@ void Scrollpad::Clear(bool clrscr)
|
||||
itsWindow = newpad(itsHeight, itsWidth);
|
||||
SetTimeout(itsWindowTimeout);
|
||||
SetColor(itsColor, itsBgColor);
|
||||
ForgetFormatting();
|
||||
keypad(itsWindow, 1);
|
||||
if (clrscr)
|
||||
Refresh();
|
||||
|
||||
@@ -35,6 +35,7 @@ namespace NCurses
|
||||
|
||||
void Flush();
|
||||
bool SetFormatting(short, const std::basic_string<my_char_t> &, short, bool for_each = 1);
|
||||
void ForgetFormatting();
|
||||
void RemoveFormatting();
|
||||
std::basic_string<my_char_t> Content() { return itsBuffer.Str(); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user