X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fentry.cpp;h=3fa4c91bb36423d64e10986bafcd156e995fdf28;hb=dc33fa600b334e10f52da4baf9758aacaca87f2c;hp=654ac6c673f17025917f72ad1af4bf0cdcde0631;hpb=850fae783476edfdaf996a008c70c941afb39d62;p=libs%2Fgltk.git diff --git a/source/entry.cpp b/source/entry.cpp index 654ac6c..3fa4c91 100644 --- a/source/entry.cpp +++ b/source/entry.cpp @@ -27,6 +27,7 @@ Entry::Entry(const Resources &r, const string &t): multiline(false), edit_pos(0), first_row(0), + visible_rows(1), text_part(0), slider(0) { @@ -187,7 +188,7 @@ void Entry::check_view_range() unsigned line_spacing = static_cast(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);