| Ticket UUID: | 770578 | |||
| Title: | long text item won't scroll | |||
| Type: | Bug | Version: | 8.3.3, 8.6.18, 9.0.5, 9.1b1 | |
| Submitter: | nobody | Created on: | 2003-07-13 17:20:08 | |
| Subsystem: | 05. Canvas Items | Assigned To: | hobbs | |
| Priority: | 5 Medium | Severity: | ||
| Status: | Open | Last Modified: | 2026-09-22 09:35:39 | |
| Resolution: | None | Closed By: | ||
| Closed on: | ||||
| Description: |
Hi All! I am using Tk Canvas for bioinformatic software design (multiple alignment visualization). I have found one malfunction of long text items -- if text item is VERY long it scrolling "hangs" when scroll displacement reaches ~32000 pixels (I am not sure this value is correct). I bypassed this bug with splitting text item into small chunks (~200 letters). Howerever, it's tricky way. So, there is my test (tk version is tk-8.3.3-67): ############## cut here ############################## #!/bin/sh # the next line restarts using wish\ exec wish "$0" "$@" set longstring [string repeat "bug!_" 10000] canvas .c -width 700 -height 50 -xscrollcommand ".s set" \ -scrollregion "0 0 200000 50" scrollbar .s -command ".c xview" -orient horiz .c create text 3 10 -anchor w -text $longstring pack .c -expand 1 -fill both -side top pack .s -expand 1 -fill x -side bottom ############## cut here ############################## Thanks in advance, Dmitry Samborsky, Moscow | |||
| User Comments: |
serhiy.storchaka added on 2026-09-22 09:35:39:
With Xft this works since [bce3c9222f] (8.6.9): glyphs outside the 16-bit coordinate range of Xft are skipped, so the visible part of the item is drawn at every scroll position. Verified with the script from the report on 8.6.18 and 9.0.5. On Windows it works too. In 9.1 the new HarfBuzz/SheenBidi backend lacked that check and, worse, drew only the first 512 characters of a string; that is [4eef1fa86e], fixed in [4c1e52f0d9]. With the core X fonts (--disable-xft) the item still disappears, since the string is passed to XDrawString() with a 16-bit coordinate. This can be fixed in the same way in tkUnixFont.c: Tk_DrawChars() draws the string in runs, one per subfont, and can skip the runs (and the characters of a run at the boundary) which lie outside the 16-bit range instead of sending them, as the Xft backend does per glyph. vincentdarley added on 2004-02-28 22:55:59: Logged In: YES user_id=32170 I know about text _widgets_ but nothing at all about the canvas and its embedded types... sorry... As a data point: I pasted the above into a Wish 8.5 console on windows-xp, and am unable to see the text box at all... dkf added on 2004-02-16 18:18:43: Logged In: YES user_id=79902 X defines coordinates and dimensions using short ints (which is likely to be adequate for a while yet) and altering this requres a major protocol revision (i.e. it would be a massive job, and is way out of the responsibility of Tk.) (Dimensions might actually be unsigned shorts; I can't remember and can't be bothered to look it up.) On the other hand, we do try to make Tk resistant to this sort of problem where possible (the pre-clipping I mentioned) even though it seems we're not yet there. (The problem is that the font/string measuring engine is restricted by the short int issue as well, despite the fact that that is what is needed to restrict everything else.) I'm not sure who is the best person to work on this; development with Tk is currently awkward for me for local config reasons... nobody added on 2003-07-18 16:32:47: Logged In: NO > The problem is that the width of something being drawn has > to fit in a signed short int, and it appears that the canvas > isn't pre-clipping the string right. (Which IIRC isn't that > easy to do, though it should be possible by passing smaller > chunks to the appropriate low-level text measurer.) Why Tk uses short int type? Is it done for native work with Xlib (avoiding X protocol overflow)? Does it mean this Tk fault won't be fixed in future? > Which platform are you observing this problem on? I have observed this behavior at Linux RedHat7.3 (sorry I can't now query Tk version). Thanks in advance, Dmitry Samborsky, Moscow dkf added on 2003-07-14 15:10:32: Logged In: YES user_id=79902 The problem is that the width of something being drawn has to fit in a signed short int, and it appears that the canvas isn't pre-clipping the string right. (Which IIRC isn't that easy to do, though it should be possible by passing smaller chunks to the appropriate low-level text measurer.) Which platform are you observing this problem on? | |||
Home
Timeline
Branches
Tags
Forum
Tickets
Download
Wiki