summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2015-11-16 13:48:50 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2015-11-16 13:48:50 (GMT)
commit422f0785c38cdf9853a7f1431f924c1f8c7284bc (patch)
tree1af19a99b56b4497e347342da05e9be136a3713e
parent81efcb96ee7e35d462eff61b31a9300dd57217fb (diff)
parente93d2c976989ce8e9fa4feff3b9d226c38f9390a (diff)
downloadtk-422f0785c38cdf9853a7f1431f924c1f8c7284bc.zip
tk-422f0785c38cdf9853a7f1431f924c1f8c7284bc.tar.gz
tk-422f0785c38cdf9853a7f1431f924c1f8c7284bc.tar.bz2
Improve user experience related to [http://core.tcl.tk/tk/tktview/1499165|dancing scrollbars]. Patch by Koen Danckaert.
-rw-r--r--generic/tkText.c20
-rw-r--r--tests/textDisp.test4
2 files changed, 14 insertions, 10 deletions
diff --git a/generic/tkText.c b/generic/tkText.c
index b002068..4edf652 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -580,14 +580,6 @@ CreateWidget(
textPtr->end = NULL;
}
- /*
- * Register with the B-tree. In some sense it would be best if we could do
- * this later (after configuration options), so that any changes to
- * start,end do not require a total recalculation.
- */
-
- TkBTreeAddClient(sharedPtr->tree, textPtr, textPtr->charHeight);
-
textPtr->state = TK_TEXT_STATE_NORMAL;
textPtr->relief = TK_RELIEF_FLAT;
textPtr->cursor = None;
@@ -598,6 +590,14 @@ CreateWidget(
textPtr->prevHeight = Tk_Height(newWin);
/*
+ * Register with the B-tree. In some sense it would be best if we could do
+ * this later (after configuration options), so that any changes to
+ * start,end do not require a total recalculation.
+ */
+
+ TkBTreeAddClient(sharedPtr->tree, textPtr, textPtr->charHeight);
+
+ /*
* This will add refCounts to textPtr.
*/
@@ -2344,6 +2344,7 @@ TextWorldChanged(
{
Tk_FontMetrics fm;
int border;
+ int oldCharHeight = textPtr->charHeight;
textPtr->charWidth = Tk_TextWidth(textPtr->tkfont, "0", 1);
if (textPtr->charWidth <= 0) {
@@ -2355,6 +2356,9 @@ TextWorldChanged(
if (textPtr->charHeight <= 0) {
textPtr->charHeight = 1;
}
+ if (textPtr->charHeight != oldCharHeight) {
+ TkBTreeClientRangeChanged(textPtr, textPtr->charHeight);
+ }
border = textPtr->borderWidth + textPtr->highlightWidth;
Tk_GeometryRequest(textPtr->tkwin,
textPtr->width * textPtr->charWidth + 2*textPtr->padX + 2*border,
diff --git a/tests/textDisp.test b/tests/textDisp.test
index a6bbfd7..9c6af70 100644
--- a/tests/textDisp.test
+++ b/tests/textDisp.test
@@ -4104,7 +4104,7 @@ test textDisp-33.2 {one line longer than fits in the widget} {
.tt debug 1
set tk_textHeightCalc ""
.tt insert 1.0 [string repeat "more wrap + " 1]
- after 100 ; update
+ after 100 ; update idletasks
# Nothing should have been recalculated.
set tk_textHeightCalc
} {}
@@ -4184,7 +4184,7 @@ test textDisp-34.1 {Text widgets multi-scrolling problem: Bug 2677890} -setup {
return $result
} -cleanup {
destroy .t1 .sy
-} -result {{0.0 1.0} {0.0 1.0} {0.0 1.0} {0.0 0.24}}
+} -result {{0.0 0.24} {0.0 0.24} {0.0 0.24} {0.0 0.24}}
deleteWindows
option clear