improve formatting removal

This commit is contained in:
Andrzej Rybczak
2009-04-19 22:19:52 +02:00
parent 88fa887776
commit c7251ebb98
5 changed files with 54 additions and 20 deletions

View File

@@ -32,6 +32,9 @@ Scrollpad::Scrollpad(size_t startx,
Border border)
: Window(startx, starty, width, height, title, color, border),
itsBeginning(0),
itsFoundForEach(0),
itsFoundValueBegin(0),
itsFoundValueEnd(0),
itsRealHeight(1)
{
}
@@ -102,7 +105,27 @@ void Scrollpad::Flush()
bool Scrollpad::SetFormatting(short vb, const std::basic_string<my_char_t> &s, short ve, bool for_each)
{
return itsBuffer.SetFormatting(vb, s, ve, for_each);
bool result = itsBuffer.SetFormatting(vb, s, ve, for_each);
if (result)
{
itsFoundForEach = for_each;
itsFoundValueBegin = vb;
itsFoundValueEnd = ve;
itsFoundPattern = s;
}
else
{
itsFoundForEach = 0;
itsFoundValueBegin = 0;
itsFoundValueEnd = 0;
itsFoundPattern.clear();
}
return result;
}
void Scrollpad::RemoveFormatting()
{
itsBuffer.RemoveFormatting(itsFoundValueBegin, itsFoundPattern, itsFoundValueEnd, itsFoundForEach);
}
void Scrollpad::Recreate()