From: SourceForge.net <no...@so...> - 2012-06-26 21:14:34
|
Bugs item #2443069, was opened at 2008-12-17 15:21 Message generated for change (Settings changed) made by nijtmans You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112997&aid=2443069&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: 53. [selection] Group: development: 8.6b2 Status: Open >Resolution: Fixed Priority: 5 Private: No Submitted By: Andy Goth (andygoth) >Assigned to: Donal K. Fellows (dkf) Summary: Cannot replace [selection handle] command Initial Comment: % package require Tk % proc report {string args} {return $string} % selection handle . {report 1} % selection own . % selection get 1 % selection get -type UTF8_STRING 1 % selection handle . {report 2} % selection get 2 % selection get -type UTF8_STRING 1 When replacing the [selection handle] command, the automatically generated UTF8_STRING handler is *not* updated, only the STRING handler. The attached patch fixes Tk_CreateSelHandler() to update both. It also updates the Tk_CreateSelHandler() documentation to describe the automatic UTF8_STRING handler creation, updating, and removal. I tested the patch successfully on X11. Workaround 1: Use [selection handle -type UTF8_STRING] to explicitly set the UTF8_STRING handler in addition to the STRING handler. Workaround 2: Use [selection handle $win ""] to clear the handler before changing it. ---------------------------------------------------------------------- >Comment By: Jan Nijtmans (nijtmans) Date: 2012-06-26 14:14 Message: It turns out that test select-5.15 is already failing for ages (why did no-one notice that before....). This test was written to test for bug 2441988, so I re-opened that one. Conclusion: the failure of select-5.15 has nothing to do with Andy's [selection handle] changes. See: <http://core.tcl.tk/tk/info/bd1165a06d17b3df426b97cda3e7df675656a81e> Donal, it appears that you know a lot more about selection handles than I do. If you are OK with merging this with trunk, I am as well. It's too small to let it go though the TIP process. ---------------------------------------------------------------------- Comment By: Andy Goth (andygoth) Date: 2012-06-20 07:53 Message: I don't understand it all that well, but it looks very fishy to me. Take this line: selection handle .f1 ERROR errHandler The man page says: selection handle ?-selection s? ?-type t? ?-format f? window command I see no -selection, -type, or -format options, so .f1 is window and... well, what's ERROR supposed to be? The intended command is [errHandler], since that generates the expected output string. Maybe ERROR should be the value for the -type option, but that's a guess; wouldn't that also cause the result to *not* include an error about ERROR not being defined? I'm not sure why this test ever worked, why my patch broke it, or what it's even trying to accomplish. Some of the other tests contain this same [selection handle] line, though select-5.15 is the only one that tests for the "selection handler aborted" failure, so if this one line of code is faulty, it'll likely only matter for select-5.15. ---------------------------------------------------------------------- Comment By: Jan Nijtmans (nijtmans) Date: 2012-06-20 07:19 Message: After 10 days of silence, this doesn't look that high priority. Andy? How do you think about the select-5.15 failure? ---------------------------------------------------------------------- Comment By: Jan Nijtmans (nijtmans) Date: 2012-06-10 11:40 Message: Donal, Thanks! I believe you. (personally, I never used the selection function, so I don't consider myself an expert in this) So, after doing what Donal suggests, there is one more failure: ==== select-5.15 Tk_GetSelection procedure FAILED ==== Contents of test case: proc ::bgerror msg {lappend ::bgerrors $msg} selection handle .f1 ERROR errHandler list [catch {selection get ERROR} msg] $msg [update] {*}$::bgerrors ---- Result was: 1 {PRIMARY selection doesn't exist or form "ERROR" not defined} {} ---- Result should have been (exact matching): 1 {PRIMARY selection doesn't exist or form "ERROR" not defined} {} {selection handler aborted} ==== select-5.15 FAILED What should be done about this one? ---------------------------------------------------------------------- Comment By: Donal K. Fellows (dkf) Date: 2012-06-09 09:37 Message: Those tests look like bystanders, with the thing tested for (equality of target list) being a proxy for what is interesting (TEST present in target list or not). Just update the expected test results. :-) ---------------------------------------------------------------------- Comment By: Jan Nijtmans (nijtmans) Date: 2012-06-09 00:33 Message: committed to branch bug-2443069 Looks good to me. The only problem with the patch is that it causes two test failures (see below), so those have to be fixed first before it can be merged to trunk. ==== clipboard-5.1 Tk_ClipboardClear procedure FAILED ==== Contents of test case: clipboard append -t TEST "test" set result [lsort [clipboard get TARGETS]] clipboard clear list $result [lsort [clipboard get TARGETS]] ---- Result was: {MULTIPLE TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW UTF8_STRING} {MULTIPLE TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW UTF8_STRING} ---- Result should have been (exact matching): {MULTIPLE TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW} {MULTIPLE TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW} ==== clipboard-5.1 FAILED ==== clipboard-5.2 Tk_ClipboardClear procedure FAILED ==== Contents of test case: clipboard append -t TEST "test" set result [lsort [clipboard get TARGETS]] selection own -s CLIPBOARD . lappend result [lsort [clipboard get TARGETS]] clipboard clear clipboard append -t TEST "test" lappend result [lsort [clipboard get TARGETS]] ---- Result was: MULTIPLE TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW UTF8_STRING {MULTIPLE TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW} {MULTIPLE TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW UTF8_STRING} ---- Result should have been (exact matching): MULTIPLE TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW {MULTIPLE TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW} {MULTIPLE TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW} ==== clipboard-5.2 FAILED ---------------------------------------------------------------------- Comment By: Andy Goth (andygoth) Date: 2012-06-08 16:12 Message: This has been hanging out for three to four years. Please, somebody have a look at it. I still need to manually apply this patch to get my application to work. ---------------------------------------------------------------------- Comment By: Andy Goth (andygoth) Date: 2011-04-17 18:38 Message: I fixed some typos in the patch. ---------------------------------------------------------------------- Comment By: Donal K. Fellows (dkf) Date: 2010-08-18 01:16 Message: It would be nice to be able to do this. ---------------------------------------------------------------------- Comment By: Andy Goth (andygoth) Date: 2009-01-06 10:05 Message: Tiny amendment to the patch: Replace "but" with "that" in the line "existing STRING handler is also being replaced but has a different" in the patch for doc/CrtSelHdlr.3 . ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112997&aid=2443069&group_id=12997 |