From: SourceForge.net <no...@so...> - 2003-11-16 02:55:21
|
Bugs item #628863, was opened at 2002-10-25 22:18 Message generated for change (Comment added) made by tm386 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112997&aid=628863&group_id=12997 Category: 18. [text] Group: obsolete: 8.4.1 Status: Open Resolution: None Priority: 9 Submitted By: Tao Ma (tm386) Assigned to: Jeffrey Hobbs (hobbs) Summary: tab incorrect with lmargin1 Initial Comment: in the latest 8.4.1 with the following code: text .text .text tag configure text -lmargin1 30 -font {Courier 10} .text insert 1.0 "a\n\tb\tc" .text tag add text 0.0 end pack .text the distance between a,b is not the same as the distance between b,c. the first tabstop seems to be caculated wrong, this seems to be caused by the -lmargin1 parameter, the following diff in tkTextDisp.c seems to fix the problem: 320c320 < TkTextDispChunk *chunkPtr)); --- > TkTextDispChunk *chunkPtr, int tabOrigin)); 379c379 < int maxX)); --- > int maxX, int tabOrigin)); 800a801 > int tabOrigin; 880a882 > tabOrigin = 0; 958a961 > tabOrigin = x; 1060c1063 < AdjustForTab(textPtr, tabArrayPtr, tabIndex, tabChunkPtr); --- > AdjustForTab(textPtr, tabArrayPtr, tabIndex, tabChunkPtr, tabOrigin); 1065c1068 < tabSize = SizeOfTab(textPtr, tabArrayPtr, tabIndex, x, maxX); --- > tabSize = SizeOfTab(textPtr, tabArrayPtr, tabIndex, x, maxX, tabOrigin); 1131c1134 < AdjustForTab(textPtr, tabArrayPtr, tabIndex, tabChunkPtr); --- > AdjustForTab(textPtr, tabArrayPtr, tabIndex, tabChunkPtr, tabOrigin); 4823c4826 < AdjustForTab(textPtr, tabArrayPtr, index, chunkPtr) --- > AdjustForTab(textPtr, tabArrayPtr, index, chunkPtr, tabOrigin) 4834a4838 > int tabOrigin; 4864c4868 < desired = NextTabStop(textPtr->tkfont, x, 0); --- > desired = NextTabStop(textPtr->tkfont, x, tabOrigin); 5005c5009 < SizeOfTab(textPtr, tabArrayPtr, index, x, maxX) --- > SizeOfTab(textPtr, tabArrayPtr, index, x, maxX, tabOrigin) 5016a5021 > int tabOrigin; 5022c5027 < tabX = NextTabStop(textPtr->tkfont, x, 0); --- > tabX = NextTabStop(textPtr->tkfont, x, tabOrigin); ---------------------------------------------------------------------- >Comment By: Tao Ma (tm386) Date: 2003-11-16 02:54 Message: Logged In: YES user_id=635724 i dont understand your point of comparing word and tk. yes you can use -tabs to align at a absolute pixel value. but wihtout these, by default, i think tab should be measured from the possible start of the 1st character. this is just my personal opinon. like you said if you just define tab to be always measured from pixel 0 then you are right there is no problem at all. ---------------------------------------------------------------------- Comment By: Vince Darley (vincentdarley) Date: 2003-11-16 00:24 Message: Logged In: YES user_id=32170 I've yet to see any editor which does what you describe (even Microsoft Word does as Tk does). So when you say 'very natural' to you, that is hardly a "compelling argument" for a particular behaviour. IMHO, If you want to align things at tabs, use tabs stops -- that's what they're for. Using 'lmargin1' is really for indenting the first line of a paragraph for cosmetic purposes. Finally, the purpose of tab stops is to align at the 'stops' you specify, _not_ necessarily at equal intervals. You can place those stops wherever you like, and stops are, in general, relative to the page, not to the current indent level -- precisely to achieve the goal you are looking for -- to enable consistent alignment. It seems you ought therefore to use '.text configure -tabs' to achieve the effect you want. ---------------------------------------------------------------------- Comment By: Tao Ma (tm386) Date: 2003-11-16 00:04 Message: Logged In: YES user_id=635724 it seems very natural to assume that tab will start at lmargin. the purpose for using tab is to allign text at equal intervals now the use of lmargin has broken this. ---------------------------------------------------------------------- Comment By: Vince Darley (vincentdarley) Date: 2003-11-15 12:52 Message: Logged In: YES user_id=32170 The reporter seems to be assuming that tab stops should be relative to lmargin1, rather than relative to the left edge (x=0) of the widget. There is no mention of this sort of 'floating ruler' behaviour in the text widget man pages, so I think it is really a case of misreading the documentation. I do agree, however, that the documentation should be made clearer on this point. Unless I hear compelling arguments to the contrary, I'll set about improving the documentation and then mark this as invalid. Any comments, please? ---------------------------------------------------------------------- Comment By: Vince Darley (vincentdarley) Date: 2003-11-12 17:52 Message: Logged In: YES user_id=32170 I'm not sure I understand what the desired behaviour is here. I get what I would expect: a b c can anyone explain? ---------------------------------------------------------------------- Comment By: Donal K. Fellows (dkf) Date: 2003-02-25 10:38 Message: Logged In: YES user_id=79902 I agree that there's work to be done in the future on several aspects of the behaviour of tabs (Tk's default behaviour is deeply magical, which is not good) and this could be fixed at the same time. ---------------------------------------------------------------------- Comment By: Jeffrey Hobbs (hobbs) Date: 2003-02-25 01:20 Message: Logged In: YES user_id=72656 Attached is a diff -u version of the patch I made, but I'm letting this slip to 8.5 because of the visual difference. I think it is right, but I'd like to see a test, as well as define what happens when people fiddle with the -tabs options globally and at the tag level. BTW, the simpler visual example is: pack [text .text -font {Courier 10}] .text tag configure margin -lmargin1 30 .text insert 1.0 "a\n\tb\tc" margin ---------------------------------------------------------------------- Comment By: Donal K. Fellows (dkf) Date: 2003-02-25 00:22 Message: Logged In: YES user_id=79902 For future reference, unified or context diffs are easier to review quickly... (Patch looks possible; hard to tell without applying it.) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112997&aid=628863&group_id=12997 |