[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
NSString fix for getLineStart:end:contentsEnd:forRange:
From: |
Pete French |
Subject: |
NSString fix for getLineStart:end:contentsEnd:forRange: |
Date: |
Sun, 04 Aug 2002 00:46:40 +0100 |
Bug in this method which means that if the range provided exactly covers
a line then the line plus the next is returned. This is due to the
search position for the end of the line always being placed on the next
character after the range supplied. Fix is to place it on the charcter at the
end of the range so that if the line range is provided then the whole line
will be returned. This is only necessary if the length of the range is
greater that zero.
-bat. [patch follows]
*** NSString.m.orig Sun Aug 4 00:39:26 2002
--- NSString.m Sun Aug 4 00:41:42 2002
***************
*** 1904,1910 ****
if (lineEndIndex || contentsEndIndex)
{
BOOL found = NO;
! end = aRange.location + aRange.length;
while (end < len)
{
--- 1904,1914 ----
if (lineEndIndex || contentsEndIndex)
{
BOOL found = NO;
! end = aRange.location;
! if(aRange.length)
! {
! end += (aRange.length - 1);
! }
while (end < len)
{
- NSString fix for getLineStart:end:contentsEnd:forRange:,
Pete French <=