FString::rtrim() and FString::left() now return an FString object with the correct character length

This commit is contained in:
Markus Gans 2017-06-26 23:35:34 +02:00
parent 82869a95b7
commit b0b5282c9a
4 changed files with 10 additions and 6 deletions

View File

@ -1,3 +1,7 @@
2017-06-26 Markus Gans <guru.mail@muenster.de>
* FString::rtrim() and FString::left() now return an FString
object with the correct character length
2017-06-18 Markus Gans <guru.mail@muenster.de> 2017-06-18 Markus Gans <guru.mail@muenster.de>
* Move the dragScroll enumeration into the fc namespace * Move the dragScroll enumeration into the fc namespace

View File

@ -384,7 +384,7 @@ void FListBox::clear()
void FListBox::onKeyPress (FKeyEvent* ev) void FListBox::onKeyPress (FKeyEvent* ev)
{ {
int element_count = int(getCount()); int element_count = int(getCount());
int padding_space = 2; // 1 leading space + 1 tailing space const int padding_space = 2; // 1 leading space + 1 tailing space
int current_before = current; int current_before = current;
int xoffset_before = xoffset; int xoffset_before = xoffset;
int xoffset_end = max_line_width - getClientWidth() + padding_space; int xoffset_end = max_line_width - getClientWidth() + padding_space;
@ -1572,7 +1572,7 @@ void FListBox::drawList()
uInt last_pos = uInt(current - yoffset) - 1; uInt last_pos = uInt(current - yoffset) - 1;
uInt current_pos = uInt(last_current - yoffset) - 1; uInt current_pos = uInt(last_current - yoffset) - 1;
start = std::min(last_pos, current_pos); start = std::min(last_pos, current_pos);
end = std::max(last_pos, current_pos)+1; end = std::max(last_pos, current_pos) + 1;
} }
iter = index2iterator(int(start) + yoffset); iter = index2iterator(int(start) + yoffset);

View File

@ -829,7 +829,8 @@ FString FString::rtrim() const
p = s.string; p = s.string;
last = p + length; last = p + length;
while ( std::iswspace(wint_t(*--last)) && last > p ); while ( std::iswspace(wint_t(*--last)) && last > p )
s.length--;
if ( last == p && std::iswspace(wint_t(*last)) ) if ( last == p && std::iswspace(wint_t(*last)) )
s.clear(); s.clear();
@ -873,6 +874,7 @@ FString FString::left (uInt len) const
return s; return s;
p = s.string; p = s.string;
s.length = len;
*(p+len) = '\0'; *(p+len) = '\0';
return s; return s;
} }
@ -1572,6 +1574,7 @@ FString FString::replace (const FString& from, const FString& to)
p++; p++;
} }
} }
return s; return s;
} }

View File

@ -97,9 +97,6 @@ Listbox::Listbox (FWidget* parent)
list2->setGeometry(21, 1, 10, 10); list2->setGeometry(21, 1, 10, 10);
list2->setText ("double"); list2->setText ("double");
for (double i=1; i<=15; i++)
double_list->push_back(2*i + (i/100));
// //
// Import via lazy conversion on print // Import via lazy conversion on print
// //