* Source/NSTextView_actions.m: Implement some undocumented key

binding actions.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@24033 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Matt Rice 2006-11-06 10:56:48 +00:00
parent ba8d729b8a
commit fc21139a69
2 changed files with 90 additions and 19 deletions

View file

@ -1,3 +1,8 @@
2006-11-06 Matt Rice <ratmice@yahoo.com>
* Source/NSTextView_actions.m: Implement some undocumented key binding
actions.
2006-11-06 Matt Rice <ratmice@yahoo.com>
* Source/NSTextView_actions.m:

View file

@ -746,7 +746,16 @@ added to the selection (1,3).
[self setSelectedRange: NSMakeRange(anchor, cindex - anchor)
affinity: NSSelectionAffinityDownstream
stillSelecting: NO];
[self scrollRangeToVisible: NSMakeRange(anchor, cindex - anchor)];
if (anchor)
{
[self scrollRangeToVisible: NSMakeRange(anchor, cindex - anchor)];
}
else
{
/* seems to only happen from
* moveToEndOfDocumentAndModifySelection: */
[self scrollRangeToVisible: NSMakeRange(cindex, 0)];
}
}
else
{
@ -943,12 +952,24 @@ check if there was a reason for that.
select: NO];
}
- (void) moveToBeginningOfDocumentAndModifySelection: (id)sender
{
[self _moveTo: 0
select:YES];
}
- (void) moveToEndOfDocument: (id)sender
{
[self _moveTo: [_textStorage length]
select: NO];
}
- (void) moveToEndOfDocumentAndModifySelection: (id)sender
{
[self _moveTo: [_textStorage length]
select:YES];
}
- (void) moveToBeginningOfParagraph: (id)sender
{
NSRange aRange;
@ -959,7 +980,17 @@ check if there was a reason for that.
select: NO];
}
- (void) moveToEndOfParagraph: (id)sender
- (void) moveToBeginningOfParagraphAndModifySelection: (id)sender
{
NSRange aRange;
aRange = [[_textStorage string] lineRangeForRange:
NSMakeRange([self _movementOrigin], 0)];
[self _moveTo: aRange.location
select: YES];
}
- (void) _moveToEndOfParagraph: (id)sender modify:(BOOL)flag
{
NSRange aRange;
unsigned newLocation;
@ -1010,9 +1041,18 @@ check if there was a reason for that.
}
[self _moveTo: newLocation
select: NO];
select: flag];
}
- (void) moveToEndOfParagraph: (id)sender
{
[self _moveToEndOfParagraph:sender modify:NO];
}
- (void) moveToEndOfParagraphAndModifySelection: (id)sender
{
[self _moveToEndOfParagraph:sender modify:YES];
}
/* TODO: this is only the beginning and end of lines if lines are horizontal
and layout is left-to-right */
@ -1022,6 +1062,14 @@ and layout is left-to-right */
distance: 1e8
select: NO];
}
- (void) moveToBeginningOfLineAndModifySelection: (id)sender
{
[self _move: GSInsertionPointMoveLeft
distance: 1e8
select: YES];
}
- (void) moveToEndOfLine: (id)sender
{
[self _move: GSInsertionPointMoveRight
@ -1029,13 +1077,20 @@ and layout is left-to-right */
select: NO];
}
- (void) moveToEndOfLineAndModify: (id)sender
{
[self _move: GSInsertionPointMoveRight
distance: 1e8
select: YES];
}
/**
* Tries to move the selection/insertion point down one page of the
* visible rect in the receiver while trying to maintain the
* horizontal position of the last vertical movement.
* If the receiver is a field editor, this method returns immediatly.
*/
- (void) pageDown: (id)sender
- (void) _pageDown: (id)sender modify: (BOOL)flag
{
float scrollDelta;
float oldOriginY;
@ -1051,17 +1106,23 @@ and layout is left-to-right */
if (scrollDelta == 0)
{
/* TODO/FIXME: If no scroll was done, it means we are in the
* last page of the document already - should we move the
* insertion point to the last line when the user clicks
* 'PageDown' in that case ?
*/
[self _moveTo:[_textStorage length] select:flag];
return;
}
[self _move: GSInsertionPointMoveDown
distance: scrollDelta
select: NO];
select: flag];
}
- (void) pageDown:(id)sender
{
[self _pageDown:sender modify:NO];
}
- (void) pageDownAndModifySelection:(id)sender
{
[self _pageDown:sender modify:YES];
}
/**
@ -1070,7 +1131,7 @@ and layout is left-to-right */
* horizontal position of the last vertical movement.
* If the receiver is a field editor, this method returns immediatly.
*/
- (void) pageUp: (id)sender
- (void) _pageUp: (id)sender modify:(BOOL)flag
{
float scrollDelta;
float oldOriginY;
@ -1086,18 +1147,23 @@ and layout is left-to-right */
if (scrollDelta == 0)
{
/* TODO/FIXME: If no scroll was done, it means we are in the
* first page of the document already - should we move the
* insertion point to the first line when the user clicks
* 'PageUp' in that case ?
*/
return;
[self _moveTo:0 select:flag];
return;
}
[self _move: GSInsertionPointMoveUp
distance: -scrollDelta
select: NO];
select: flag];
}
- (void) pageUp:(id)sender
{
[self _pageUp:sender modify:NO];
}
- (void) pageUpAndModifySelection:(id)sender
{
[self _pageUp:sender modify:YES];
}
- (void) scrollLineDown: (id)sender