Initialize Entry's visible rows and make sure it's always at least 1
multiline(false),
edit_pos(0),
first_row(0),
+ visible_rows(1),
text_part(0),
slider(0)
{
unsigned line_spacing = static_cast<unsigned>(font_size*6/5);
const Sides &margin = text_part->get_margin();
- visible_rows = (geom.h-margin.top-margin.bottom)/line_spacing;
+ visible_rows = max((geom.h-margin.top-margin.bottom)/line_spacing, 1U);
unsigned row, col;
text.offset_to_coords(edit_pos, row, col);
int y_offset = static_cast<int>(-font->get_descent()*font_size);
const Sides &margin = part.get_margin();
- unsigned n_lines = min(lines.size(), (parent.h-margin.top-margin.bottom)/line_spacing);
+ unsigned n_lines = max(min(lines.size(), (parent.h-margin.top-margin.bottom)/line_spacing), 1U);
first_row = min(first_row, lines.size()-n_lines);
for(unsigned i=0; i<n_lines; ++i)