mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 01:40:38 +00:00
Fixed bug when typing enter at the end of text; fixed drawing insertion
point when there is no text git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@12414 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
5198e15983
commit
42b0b2ef67
1 changed files with 23 additions and 4 deletions
|
@ -916,7 +916,7 @@ scanRange(NSScanner *scanner, NSCharacterSet* aSet)
|
|||
addObject: [_GNULineLayoutInfo
|
||||
lineLayoutWithRange: NSMakeRange (0, 0)
|
||||
rect: NSMakeRect (0, 0, width, 12)
|
||||
usedRect: NSMakeRect (0, 0, 0, 12)]];
|
||||
usedRect: NSMakeRect (0, 0, 1, 12)]];
|
||||
return NSMakeRange(0,1);
|
||||
}
|
||||
|
||||
|
@ -942,9 +942,10 @@ scanRange(NSScanner *scanner, NSCharacterSet* aSet)
|
|||
options: NSLiteralSearch
|
||||
range: para];
|
||||
|
||||
if (eol.length == 0)
|
||||
if (eol.location == NSNotFound)
|
||||
{
|
||||
eol.location = length;
|
||||
eol.length = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1066,8 +1067,8 @@ scanRange(NSScanner *scanner, NSCharacterSet* aSet)
|
|||
}
|
||||
|
||||
// line to long
|
||||
if (usedLineRect.size.width + advanceSize.width > width ||
|
||||
isBuckled)
|
||||
if (usedLineRect.size.width + advanceSize.width > width
|
||||
|| isBuckled)
|
||||
{
|
||||
// end of line -> word wrap
|
||||
// undo layout of last word
|
||||
|
@ -1158,6 +1159,24 @@ scanRange(NSScanner *scanner, NSCharacterSet* aSet)
|
|||
}
|
||||
while ([lScanner isAtEnd] == NO);
|
||||
}
|
||||
|
||||
/* Now test for the special case - there is a newline at the end of
|
||||
the text? The last newline is not displayed by the previous
|
||||
engine, so we do it manually. */
|
||||
if ([newlines characterIsMember: [allText characterAtIndex: (length - 1)]])
|
||||
{
|
||||
float width = [aTextContainer containerSize].width;
|
||||
|
||||
[_lineLayoutInformation
|
||||
addObject: [_GNULineLayoutInfo
|
||||
lineLayoutWithRange: NSMakeRange (length, 0)
|
||||
rect: NSMakeRect (drawingPoint.x, drawingPoint.y,
|
||||
width, 12)
|
||||
usedRect: NSMakeRect (drawingPoint.x, drawingPoint.y,
|
||||
1, 12)]];
|
||||
}
|
||||
|
||||
|
||||
|
||||
// lines actually updated (optimized drawing)
|
||||
return NSMakeRange(aLine, MAX(1, [_lineLayoutInformation count] - aLine));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue