mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-07 10:42:31 +00:00
* Cleanup of TextElement.
git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@838 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -44,24 +44,13 @@ namespace display {
|
||||
|
||||
char*
|
||||
TextElementStringBase::print(char* first, char* last, Canvas::attributes_list* attributes, void* object) {
|
||||
// Move this stuff into a function in TextElement.
|
||||
Attributes base = attributes->back();
|
||||
Attributes current(NULL, m_attributes, Attributes::color_invalid);
|
||||
Attributes baseAttribute = attributes->back();
|
||||
push_attribute(attributes, Attributes(first, m_attributes, Attributes::color_invalid));
|
||||
|
||||
if (current.attributes() == Attributes::a_invalid)
|
||||
current.set_attributes(base.attributes());
|
||||
else if (current.attributes() != base.attributes())
|
||||
current.set_position(first);
|
||||
if (first == last)
|
||||
return first;
|
||||
|
||||
if (current.colors() == Attributes::color_invalid)
|
||||
current.set_colors(base.colors());
|
||||
else if (current.colors() != base.colors())
|
||||
current.set_position(first);
|
||||
|
||||
if (first == last) {
|
||||
// Do nothing, but ensure that the last attributes are set.
|
||||
|
||||
} else if (m_flags & flag_escape_hex) {
|
||||
if (m_flags & flag_escape_hex) {
|
||||
char buffer[last - first];
|
||||
char* bufferLast = copy_string(buffer, buffer + (last - first), object);
|
||||
|
||||
@@ -77,10 +66,7 @@ TextElementStringBase::print(char* first, char* last, Canvas::attributes_list* a
|
||||
first = copy_string(first, last, object);
|
||||
}
|
||||
|
||||
if (current.position() != NULL) {
|
||||
attributes->push_back(current);
|
||||
attributes->push_back(Attributes(first, base.attributes(), base.colors()));
|
||||
}
|
||||
push_attribute(attributes, Attributes(first, baseAttribute));
|
||||
|
||||
return first;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user