- 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;
+ lyxerr[Debug::GUI] << "text_height now " << text_height << endl;
+ lyxerr[Debug::GUI] << "work_height " << work_height << endl;
+
+ /* If the text is smaller than the working area, the scrollbar
+ * maximum must be the working area height. No scrolling will
+ * be possible */
+ if (text_height <= work_height) {
+ lyxerr[Debug::GUI] << "doc smaller than workarea !" << endl;
+ workarea_.setScrollbarBounds(0.0, 0.0);
+ current_scrollbar_value = bv_->text->first_y;
+ workarea_.setScrollbar(current_scrollbar_value, 1.0);
+ return;