ttext: move maximum_length validity check to member function
This commit is contained in:
parent
ce8ca0a9df
commit
91f79a956d
2 changed files with 6 additions and 6 deletions
|
@ -72,6 +72,10 @@ unsigned ttext_::get_state() const
|
|||
|
||||
void ttext_::set_maximum_length(const size_t maximum_length)
|
||||
{
|
||||
if(maximum_length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const bool need_update = text_.get_length() > maximum_length;
|
||||
|
||||
text_.set_maximum_length(maximum_length);
|
||||
|
|
|
@ -125,9 +125,7 @@ void ttext_box::place(const tpoint& origin, const tpoint& size)
|
|||
set_maximum_width(get_text_maximum_width());
|
||||
set_maximum_height(get_text_maximum_height(), false);
|
||||
|
||||
if(max_input_length_ != 0) {
|
||||
set_maximum_length(max_input_length_);
|
||||
}
|
||||
set_maximum_length(max_input_length_);
|
||||
|
||||
update_offsets();
|
||||
}
|
||||
|
@ -140,9 +138,7 @@ void ttext_box::update_canvas()
|
|||
const unsigned start = get_selection_start();
|
||||
const int length = get_selection_length();
|
||||
|
||||
if(max_input_length_ != 0) {
|
||||
set_maximum_length(max_input_length_);
|
||||
}
|
||||
set_maximum_length(max_input_length_);
|
||||
|
||||
PangoEllipsizeMode ellipse_mode = PANGO_ELLIPSIZE_NONE;
|
||||
if(!can_wrap()) {
|
||||
|
|
Loading…
Add table
Reference in a new issue