$canvas find enclosed does not find text with trailing newline 
Author Message
 $canvas find enclosed does not find text with trailing newline

Tk 8.2b2 Bug:  Generated by Scriptics' bug entry form at
        http://www.*-*-*.com/
Responses to this post are encouraged.
------

Submitted by:  Marco R. Gazzetta
OperatingSystem:  Windows NT
OperatingSystemVersion:  4.0
Extensions:  n.a.
CustomShell:  n.a.
Synopsis:  $canvas find enclosed does not find text with trailing newline

ReproducibleScript:
    pack [canvas .c]
    set item [.c create text 100 100 -text Hello\n -anchor nw]
    set bbox [.c bbox $item]
    set x2 [lindex $bbox 2]
    set y2 [lindex $bbox 3]
    incr y2
    for {set i 1} {$i < 1000000000} {append i 0} {
    puts "$i [.c find enclosed 99 99 [expr $x2 + $i] [expr $y2 + 1]]"
    }

ObservedBehavior:
    until $i reaches a very large number (hard-coded in tkFont.c), the item
    is not retrieved

DesiredBehavior:
    the first call (with i == 1) should already return the item searched

Patch:
Index: tkFont.c
===================================================================
RCS file: /cvsroot/tk/generic/tkFont.c,v
retrieving revision 1.5
diff -c -r1.5 tkFont.c
*** tkFont.c    1999/06/02 18:15:54     1.5
--- tkFont.c    1999/08/11 18:13:46
***************
*** 1922,1928 ****
                    continue;
                }
            } else {
!               NewChunk(&layoutPtr, &maxChunks, start, 1, curX, 1000000000,
                        baseline)->numDisplayChars = -1;
                start++;
                goto wrapLine;
--- 1922,1928 ----
                    continue;
                }
            } else {
!               NewChunk(&layoutPtr, &maxChunks, start, 1, curX, curX,
                        baseline)->numDisplayChars = -1;
                start++;
                goto wrapLine;

PatchFiles:
    tkFont.c



Sun, 27 Jan 2002 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Visa Find resource vi does not find GPIB0 board

2. finding size of text on Tkinter.Canvas, was: Re: Need urgent solution

3. Way to find the trailing blanks

4. bug: string.find() doesn't cross newlines

5. BUG: More on, Tk8: can't find enclosed canvas text items???

6. BUG? Tk8: can't find enclosed canvas text items???

7. finding newline chars in string?

8. Finding text in text

9. finding out whether the text in a text widget has changed

10. ITS NOT A VIRUS, ITS A 404 ERROR, FILE NOT FOUND

11. ITS NOT A VIRUS, ITS A 404 ERROR, FILE NOT FOUND

12. Modifying existing script to remove trailing newlines

 

 
Powered by phpBB® Forum Software