Tk Source Code

Artifact [2e790be3]
Login

Artifact 2e790be3820b45b17080e6a1bfddca5e4f643134d43700205276531018404b75:

Ticket change [2e790be3] - Ticket [bdd1f645] Assertion failed when switching -elide in the revised text widget status still Open with 5 other changes by fvogel 2025-02-01 15:26:15.
D 2025-02-01T15:26:15.465
J assignee fvogel
J icomment Many\sthanks\sfor\syour\sinput.\sThere\sare\ssmall\serrors\sin\syour\spost\s(notably\ssegment\sorder\sinversion\sin\sthe\slinked\slist,\sthe\s3rd\sand\s2nd\ssegments\sare\sin\sthe\swrong\sorder\s-\sthe\spicture\sabove\sthat\slist\sis\showever\scorrect),\sbut\sit\swas\sdefinitely\svery\suseful\sto\shelp\sme\sin\sthe\sdebug\sprocess.\r\n\r\nI\shave\sunderstood\swhat's\shappening.\sWhen\stoggling\sthe\s-elide\sstate\sof\sseg4\s(the\s"text_hidden"\ssegment),\sin\sthe\sfirst\siteration\sof\sthe\s[https://core.tcl-lang.org/tk/artifact/c5bb7602?ln=8736|while\s(1)\sloop],\sthe\slastBranchPtr\sis\sobtained\sby\s[https://core.tcl-lang.org/tk/artifact/c5bb7602?ln=8872|calling\sTkBTreeFindStartOfElidedRange()].\sThis\sfunction\ssupposes\s(and\schecks\sthrough\sasserts)\sthat\sthe\ssegment\sfrom\swhich\sit\sis\srequested\sto\sstart\sits\ssearch\sfor\sthe\sbranch\ssegment\sis\selided.\sWith\sthe\sgiven\sreproducible\sscript,\sat\sthe\stime\sthis\sgets\scalled,\sthat\ssegment\sis\snot\sseen\sas\selided\ssince\sthe\selide\sstate\sof\sthe\stag\spertaining\sto\sthis\ssegment\salready\shas\sits\sstate\stoggled\sto\sthe\sdesired\snew\sstate\s(here:\s0).\sAnd\sthe\sassert\s(correctly)\striggers.\r\n\r\nI\scan\sthink\sof\sat\sleast\stwo\spossible\sfixes:\r\n\r\n\s\sa.\s\sTemporarily\srestore\sthe\selide\sstate\sof\sthe\stag\sbefore\scalling\sTkBTreeFindStartOfElidedRange(),\sand\sdo\sthe\sreverse\smanoeuver\safter\sthis\scall.\sThis\sis\s[https://core.tcl-lang.org/tk/artifact/c5bb7602?ln=8681,8721|done\salready\sin\sthe\scode]\sfor\sfinding\sthe\selide\sstate\sof\sthe\ssegment\spredecessing\sthe\sstart\sof\sthe\sconsidered\srange,\sthat\sis\sto\sset\sthe\svalue\sof\s'actualElided'.\r\n\r\n\s\sb.\s\sInstead\sof\sstarting\sthe\ssearch\sfor\sthe\sbranch\ssegment\sfrom\sthe\sfirst\ssegment\sof\sthe\srange\swhere\sthe\selide\sstate\smust\sbe\stoggled,\sstart\sthe\ssearch\sfrom\sthe\ssegment\sthat\sprecedes\sit.\sThis\smust\swork\sbecause\sthis\spredecessing\ssegment\sis\salways\selided\s(actualElided=1)\sat\sthis\splace\sof\sthe\scode.\r\n\r\nFix\sa.\sis\seasy\sto\sunderstand,\sis\sstraightforward\sto\simplement,\sand\sis\ssafe.\sI\shave\simplemented\sit\sin\s[4bce1cc132].\r\n\r\nFix\sb.\sis\smore\selegant\s(instead\sof\spassing\s<code>*firstSegPtr</code>,\sjust\spass\s<code>(*firstSegPtr)->prevPtr</code>\sto\sTkBTreeFindStartOfElidedRange())\sbut\sit\sis\smore\sdifficult\sto\sdo\scorrectly\ssince\sthere\smight\sbe\scases\swhere\s<code>(*firstSegPtr)->prevPtr</code>\scould\sbe\sNULL,\swhich\swould\sneed\sto\sbe\shandled\sby\slooking\sat\sthe\sprevious\sline\s(and\swhat\sif\sthere\sis\sno\sprevious\sline,\sand\sso\son).\sI\shave\sto\sthink\sabout\sthis.\r\n\r\nAt\sthis\spoint,\scould\syou\sperhaps\stry\sfix\sa.\sand\sconfirm\swhether\sit\sworks\sin\syour\slarge\saplication?\sWe\scould\sperhaps\sdecide\sto\sbe\ssatisfied\senough\sby\sthis\sfix.
J login fvogel
J mimetype text/x-fossil-wiki
J resolution Fixed
K bdd1f64523f509f2632cdaaed4447de8c5abb7cb
U fvogel
Z 98ab0efb91a78071d342a40424290cec