-
- workarea_.setScrollbarBounds(0, height_diff);
- double const lineh = bv_->text->DefaultHeight();
- workarea_.setScrollbarIncrements(lineh);
- double const slider_size = 1.0 / double(height_diff) ;
- workarea_.setScrollbar(current_scrollbar_value, slider_size);
+ static long old_text_height = 0;
+ static double old_lineh = 0;
+ static double old_slider_size = 0;
+
+ if (text_height != old_text_height) {
+ workarea_.setScrollbarBounds(0, text_height - workarea_.height());
+ old_text_height = text_height;
+ }
+ if (lineh != old_lineh) {
+ workarea_.setScrollbarIncrements(lineh);
+ old_lineh = lineh;
+ }
+ if (current_scrollbar_value != bv_->text->first
+ || slider_size != old_slider_size) {
+ current_scrollbar_value = bv_->text->first;
+ workarea_.setScrollbar(current_scrollbar_value, slider_size);
+ old_slider_size = slider_size;
+ }