]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/entry.cpp
Refactor visible height calculation in Entry and Text
[libs/gltk.git] / source / entry.cpp
index 70321dc5a68cf029128f07c52e9b06f44ea38f91..6d13ccdd0377eaaff11b29db0c27981d5b9cacc0 100644 (file)
@@ -440,11 +440,7 @@ void Entry::check_view_range()
        if(!multiline || !text_part)
                return;
 
-       float font_size = style->get_font_size();
-       unsigned line_spacing = static_cast<unsigned>(font_size*6/5);
-
-       const Sides &margin = text_part->get_margin();
-       visible_rows = max((geom.h-margin.top-margin.bottom)/line_spacing, 1U);
+       visible_rows = text.get_visible_lines(*text_part, geom, 0);
 
        unsigned row, col;
        text.offset_to_coords(edit_pos, row, col);