Hello,
here are some bug fixes for NSText (cvs version from 2000-08-14).
- [NSText sizeToFit], line 2148:
I removed the 'else' to allow resize of height and width
(OpenStep 4.2 does it this way).
- scanRange() line 1032:
I added 1 to the scannerPosition to avoid an infinite loop for
a singe character text.
- scanRange() line 1011, and 1047:
I removed the '=' in the comparison of width
('> width' instead of '>= width')
this avoids a linebreak of the last character in a text which
actually should fit.
I'm not entirely sure about the side effects of the last two changes, since I
have no overview over scanRange().
As far as I can see NSText does a much better job with these changes.
2000-08-15 Georg Fleischmann
* gui/Source/NSText.m
([NSText sizeToFit:]):
'else' removed to allow resize of height and width
* gui/Source/NSText.m
scanRange():
line 1032: +1 to avoid infinit loop for single character
line 1011, 1047: '>' instead of '>='
*** gui/Source/NSText.m Tue Aug 15 18:53:09 2000
--- gui/Source/NSText.m.old Tue Aug 15 18:14:00 2000
***************
*** 1008,1014 ****
// handle case where single word is broader than width
// (buckle word) <!> unfinished and untested
// for richText (absolute position see above)
! if (advanceSize.width > width)
{
if (isBuckled)
{
--- 1008,1014 ----
// handle case where single word is broader than width
// (buckle word) <!> unfinished and untested
// for richText (absolute position see above)
! if (advanceSize.width >= width)
{
if (isBuckled)
{
***************
*** 1029,1035 ****
inBuckling = YES;
scannerPosition
= localLineStartIndex
! + (lastVisibleCharIndex - startingLineCharIndex)+1;
currentLineRect.size.width = advanceSize.width = width;
}
else
--- 1029,1035 ----
inBuckling = YES;
scannerPosition
= localLineStartIndex
! + (lastVisibleCharIndex - startingLineCharIndex);
currentLineRect.size.width = advanceSize.width = width;
}
else
***************
*** 1044,1050 ****
// end of line -> word wrap
// >= : wichtig fur abknicken (isBuckled)
! if (currentLineRect.size.width > width || isBuckled)
{
_GNULineLayoutInfo *ghostInfo = nil, *thisInfo;
--- 1044,1050 ----
// end of line -> word wrap
// >= : wichtig fur abknicken (isBuckled)
! if (currentLineRect.size.width >= width || isBuckled)
{
_GNULineLayoutInfo *ghostInfo = nil, *thisInfo;
***************
*** 2145,2151 ****
{
newWidth = textRect.size.width;
}
! if (_tf.is_vertically_resizable)
{
newHeight = textRect.size.height;
}
--- 2145,2151 ----
{
newWidth = textRect.size.width;
}
! else if (_tf.is_vertically_resizable)
{
newHeight = textRect.size.height;
}
---
* Georg Fleischmann
* vhf interservice GmbH
* research and development on self-similarity and geometry of fractals
* [EMAIL PROTECTED]