Tk Source Code

Artifact [8af3d8b1]
Login

Artifact 8af3d8b1d814ab738320141a98844e9a8e830d48:

Ticket change [8af3d8b1] - Ticket [1096580f] soft-hyphen in text widget status still Open with 3 other changes by fvogel 2016-10-16 20:57:47.
D 2016-10-16T20:57:47.911
J icomment I\shave\sproposed\sa\sfix\sfor\sthis\sbug,\ssee\s[1516a46a81].\r\n\r\n\r\n<b>I.\sApproach\sI\sused\sfor\ssolving\sthis\sbug,\sand\sstatus</b>\r\n\r\n\s\s<b>1.</b>\r\n\r\n\s\sIn\sLayoutDLine(),\ssee\sif\sthere\sis\ssoft\shyphen\sin\sthe\scurrent\ssegment;\sif\sso,\sonly\slayout\scharacters\sup\sto\s(and\sincluding)\sthis\scharacter.\sThat\smeans\sthat\sif\sthere\sis\sa\ssoft\shyphen\sin\sa\stext\ssegment\sthen\sit\swill\salways\sbe\sthe\slast\scharacter\sof\sa\schunk\s(chunks\sare\sproduced\sfrom\ssegments\sin\sTkTextCharLayoutProc()).\r\n\r\n\s\sThis\sis\sthe\ssame\sapproach\sas\salready\sdone\sin\sthe\stext\swidget\sfor\stabs\s(a\stabs\sis\salways\sthe\slast\scharacter\sof\sa\schunk).\r\n\r\n\s\s<b>2.</b>\r\n\r\n\s\sTkTextCharLayoutProc()\scomputes\schunk\sdata\sfrom\ssegment\sinformation.\sIn\sdoing\sthat,\sit\sincludes\sthe\ssoft\shyphen\sin\sthe\snumber\sof\s"bytes\sthat\sfit"\s(in\ssome\sallotted\shorizontal\sspace\son\sscreen).\sHowever\sthe\spixel\swidth\son\sscreen\sof\sthe\ssoft\shyphen\sis\salways\szero\s(this\sis\sdone\sin\sMeasureChars()),\sregardless\sof\sthe\sposition\sof\sthe\schunk,\si.e.\sregardless\sof\swhether\sthe\schunk\sis\sthe\slast\sof\sthe\sdisplay\sline\sor\snot.\r\n\r\n\s\s<b>3.</b>\r\n\r\n\s\sPossible\sbreak\slocations\sinclude\ssoft\shyphens\s(\\u00AD)\sin\sTkTextCharLayoutProc()\r\n\r\n\s\s<b>4.</b>\r\n\r\n\s\sWhen\srendering\sa\sdisplay\sline\son\sscreen,\sCharDisplayProc()\sactually\sdraws\sthe\ssoft\shyphen\sonly\sif\sit\sis\sthe\slast\scharacter\sof\sa\scontinuing\sdisplay\sline.\r\n\r\n\r\n<b>II.\sTesting\sstatus\swith\stoday's\scommit</b>\r\n\r\n\s\s<b>A.</b>\r\n\r\n\s\sNo\spreviously\sexisting\stest\sfail.\r\n\r\n\s\sSeveral\snew\stests\shave\sbeen\sadded\sto\sthe\stest\ssuite\sto\scheck\sfor\sthe\sbehaviour\sof\sthe\stext\swidget\swith\ssoft\shyphens.\sAll\sthese\stests\spass\s(for\sme\son\sWindows),\sexcept\stextDisp-2.34.\r\n\r\n\s\sThis\slatter\sone\schecks\sthe\swidth\s(in\sits\sbounding\sbox)\sof\sa\ssoft\shyphen\swhen\sit\sis\svisible\son\sscreen,\si.e.\swhen\sit\sis\sactually\sdislayed\sbecause\sit's\sthe\slast\scharacter\sof\sa\scontinuing\sdisplay\sline.\sCurrently\sthe\swidth\sof\sa\ssoft\shyphen\sis\salways\szero,\sas\sexplained\sabove\sin\s2.,\swhich\smakes\sthis\stest\sfail.\sTo\sfix\sthis\sis\snot\strivial\sat\sall.\sOne\sneeds\sto\stell\schunks\scontaining\ssoft\shyphens\sto\sincrease\stheir\swidth\sfield\sif\sand\sonly\sif\sthese\schunks\sterminate\sa\scontinuing\sdisplay\sline.\r\n\r\n<b><i>-->\sI'm\swondering\sif\sone\scould\snot\sjust\sleave\sthings\sas\sthey\sare\snow\sand\sdecide\sthat\sit's\sgood\senough,\sin\sother\swords\sthat\ssoft\shyphens\salways\shave\szero\swidth\sin\stheir\sbounding\sboxes\seven\sif\sthey\sare\saccidentally\sdisplayed.\sYour\sthoughts?</b></i>\r\n\r\n\s\s<b>B.</b>\r\n\r\n\s\sMy\sfix\sis\scurrently\suncompiled\sand\suntested\sin\sthe\scase\swhere\sTK_LAYOUT_WITH_BASE_CHUNKS\sand\sTK_DRAW_IN_CONTEXT\sare\sdefined.\sThis\sseems\sto\shappen\son\sOSX\sonly.\r\n\r\n<b><i>-->\sCould\ssomeone\shaving\san\sOSX\splatform\splease\srun\sthe\stest\ssuite\s(textDisp.test\sfile\sis\senough)\sin\sbranch\s[bug-1096580fff]\sand\sreport\sresults\shere?</b></i>\r\n\r\n\r\n<b>III.\sPeer\sreview</b>\r\n\r\n\s\sNot\ssure\sI\sdid\snot\smix\sbytes\sand\schars.\r\n\r\n<i><b>-->\sPeer\sreview\sof\sthe\sfix\srequested,\sthanks...!</b></i>\r\n\r\n\r\n<b>IV.\sDemo\sscript</b>\r\n\r\n<small><verbatim>\r\npackage\srequire\sTk\r\npack\s[text\s.t\s-width\s60\s-height\s5\s-wrap\sword\s-font\sfixed\s\\\r\n\s\s\s\s\s\s\s\s-insertofftime\s0]\s-fill\sboth\s-expand\strue\r\n.t\sinsert\send\s"Now\sthis\sis\sa\ssample\ssoft-hyphen\sabc\\u00AD123\stext.\\n"\r\n.t\sinsert\send\s"Now\sthis\sis\sa\ssample\ssoft-hyphen\sabc\\t123\stext.\\n"\r\n.t\sinsert\send\s"Very\sgood\slarge\sline\sTest\\twith\ssoft\\u00ADhyphen\sand\\ttabs.\\n"\r\n.t\sinsert\send\s"Very\sgood\slarge\sline\sTest\\u00ADwith\ssoft\\thyphen\sand\\u00ADtabs.\\n"\r\n#\sChange\swindow\swidth\sat\swill\swith\sthe\smouse\r\n#\sNotice\show\ssoft\shyphens\sshow\sup\sand\sdisappear\sfrom\sthe\sscreen\r\n#\sdepending\son\sthe\swindow\swidth\r\n</verbatim></small>
J login fvogel
J mimetype text/x-fossil-wiki
K 1096580fffffffffffffffffffffffffffffffff
U fvogel
Z 0e939c16f48e0191380f6a6d5b9a5bd9