diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2015-11-16 13:48:50 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2015-11-16 13:48:50 (GMT) |
commit | 025a48fb5523bb8835464ea459db86d60df00d21 (patch) | |
tree | 1af19a99b56b4497e347342da05e9be136a3713e /generic/tkText.c | |
parent | 31aa24abc4ab8adb59d1173538019582bcf92c94 (diff) | |
parent | eaad06dfab9f12af40967edfef6a9a5348af92f2 (diff) | |
download | tk-025a48fb5523bb8835464ea459db86d60df00d21.zip tk-025a48fb5523bb8835464ea459db86d60df00d21.tar.gz tk-025a48fb5523bb8835464ea459db86d60df00d21.tar.bz2 |
Improve user experience related to [http://core.tcl.tk/tk/tktview/1499165|dancing scrollbars]. Patch by Koen Danckaert.
Diffstat (limited to 'generic/tkText.c')
-rw-r--r-- | generic/tkText.c | 20 |
1 files changed, 12 insertions, 8 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, |