From: SourceForge.net <no...@so...> - 2012-01-19 20:00:12
|
Bugs item #3021557, was opened at 2010-06-25 13:35 Message generated for change (Comment added) made by nijtmans You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112997&aid=3021557&group_id=12997 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: 18. [text] Group: development: 8.6b2 >Status: Closed Resolution: None Priority: 7 Private: No Submitted By: Francois VOGEL (fvogelnew1) >Assigned to: Jan Nijtmans (nijtmans) Summary: Moving the cursor in elided text freezes Tk Initial Comment: wish freezes when moving the cursor in a text widget containing elided text. To reproduce, just paste the following in wish: package require Tk info patchlevel ;# spits 8.5.7 for me (ActiveState version) text .t pack .t .t insert end "Fifteen men on the Dead Man's Chest\n" .t insert end "Yo-ho-ho, and a bottle of rum!\n" .t insert end "Drink and the devil had done for the rest \n" .t insert end "Yo-ho-ho, and a bottle of rum!\n" .t insert end "\nFifteen men on the Dead Man's Chest\n" .t insert end "a poem by Robert Louis Stevenson\n" .t tag add hidden 2.10 3.15 .t tag configure hidden -elide true # now : # 1. click in the text widget to place the cursor just # before the letter D of the word "Dead" (1st line) # 2. press the down arrow once on the keyboard # 3. press the up arrow once on the keyboard # # ==> wish is frozen with 100% CPU This happens for me on Win Vista 64 bits OS with the ActiveState binary distribution of Tcl/Tk version 8.5.7 (32 bits). It also happens under ActiveState's 8.6 beta 3, windows 7 64 bit. ---------------------------------------------------------------------- >Comment By: Jan Nijtmans (nijtmans) Date: 2012-01-19 12:00 Message: proposed patch now committed to core-8-5-branch and trunk ---------------------------------------------------------------------- Comment By: Francois VOGEL (fvogelnew1) Date: 2012-01-11 12:43 Message: I have proposed a patch fixing this issue, see #3472539: https://sourceforge.net/tracker/index.php?func=detail&aid=3472539&group_id=12997&atid=312997 I'm setting the "Assigned" field to the maintainer of the [text] area for patch review. ---------------------------------------------------------------------- Comment By: Francois VOGEL (fvogelnew1) Date: 2012-01-11 03:27 Message: It loops in tkTextUpdateOneLine because in TextWidgetObjCmd the following while loop is incorrect: index = *indexFromPtr; (...) while (index.linePtr != indexToPtr->linePtr) { value += TkTextUpdateOneLine(textPtr, fromPtr,0,&index,0); The intent is to count up all display lines in the logical line of 'indexFromPtr' up to, but not including the logical line of 'indexToPtr'. This snippet wants to do so by calling TkTextUpdateOneLine which (apart from measuring the height of a logical line) returns the number of display lines in the logical line, and changes index to the first index of next line. The important point is that this call to TkTextUpdateOneLine *skips* elided lines in the chain of indexes. Now, when the indexToPtr refers to an elided line the condition of the while loop (index.linePtr != indexToPtr->linePtr) keeps being true, leading to counting until the very end of the text widget, and eventually calling TkTextUpdateOneLine on the final line containing only the last newline. This last call to TkTextUpdateOneLine loops endlessly, which is expected: /* * Caution: we must NEVER call TkTextUpdateOneLine with the * last artificial line in the widget. */ The fact that we do it anyway is due to the while loop end condition being always true, which is what should be corrected. ---------------------------------------------------------------------- Comment By: Francois VOGEL (fvogelnew1) Date: 2012-01-11 00:41 Message: Slightly shorter test case, no user interaction needed: text .t pack .t .t insert end "Line 1 - This is Line 1\n" .t insert end "Line 2 - This is Line 2\n" .t insert end "Line 3 - This is Line 3\n" .t insert end "Line 4 - This is Line 4\n" .t insert end "Line 5 - This is Line 5\n" .t tag add hidden 2.9 3.17 .t tag configure hidden -elide true .t count -displaylines 1.11 3.19 ; # endless loop! It loops ad vitam aeternam in tkTextUpdateOneLine (tkTextDisp.c). ---------------------------------------------------------------------- Comment By: Joe English (jenglish) Date: 2010-06-30 10:03 Message: Does not affect Tk 8.4.9, Tk 8.4.17, or core-8-4 branch HEAD (currently Tk 8.4.19). Can replicate with core-8-5-branch HEAD (8.5.9) and mainline HEAD. Suspect this is due to TIP#155 enhancements. ---------------------------------------------------------------------- Comment By: Jan Nijtmans (nijtmans) Date: 2010-06-28 04:08 Message: Confirmed: I can reproduce this on HEAD, on ubuntu 10.4 ---------------------------------------------------------------------- Comment By: Francois VOGEL (fvogelnew1) Date: 2010-06-27 09:36 Message: From my initial thread on comp.lang.tcl: http://groups.google.fr/group/comp.lang.tcl/browse_thread/thread/91c29c4879b4763f It freezes as well on 8.6b1 on linux64, and on Mac OS 10.6.4 with tclkit 8.5.8. On my side I checked with 8.4.19 cvs HEAD compiled today on Win64 with Visual Studio 2008: it does not freeze. Definitely a display submodifier issue I think. ---------------------------------------------------------------------- Comment By: Francois VOGEL (fvogelnew1) Date: 2010-06-26 00:06 Message: Also happens with Windows 7 32 bits with 8.6.0 beta 3, therefore not a 32/64 bits issue. Also happens under Fedora12 with 8.5.7 But does not happen under Win XP running 8.4.19. Note also that elision under 8.4.x is not visually the same as in 8.5+. Elision of \n apparently is different. I don't think this bug is a platform-related issue, it rather seems to have been introduced with the "display" submodifier in the text widget. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112997&aid=3021557&group_id=12997 |