mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-01 20:31:56 +00:00
* 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:
parent
b913f96dc2
commit
f111ea9e46
2 changed files with 90 additions and 19 deletions
|
@ -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>
|
2006-11-06 Matt Rice <ratmice@yahoo.com>
|
||||||
|
|
||||||
* Source/NSTextView_actions.m:
|
* Source/NSTextView_actions.m:
|
||||||
|
|
|
@ -746,7 +746,16 @@ added to the selection (1,3).
|
||||||
[self setSelectedRange: NSMakeRange(anchor, cindex - anchor)
|
[self setSelectedRange: NSMakeRange(anchor, cindex - anchor)
|
||||||
affinity: NSSelectionAffinityDownstream
|
affinity: NSSelectionAffinityDownstream
|
||||||
stillSelecting: NO];
|
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
|
else
|
||||||
{
|
{
|
||||||
|
@ -943,12 +952,24 @@ check if there was a reason for that.
|
||||||
select: NO];
|
select: NO];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) moveToBeginningOfDocumentAndModifySelection: (id)sender
|
||||||
|
{
|
||||||
|
[self _moveTo: 0
|
||||||
|
select:YES];
|
||||||
|
}
|
||||||
|
|
||||||
- (void) moveToEndOfDocument: (id)sender
|
- (void) moveToEndOfDocument: (id)sender
|
||||||
{
|
{
|
||||||
[self _moveTo: [_textStorage length]
|
[self _moveTo: [_textStorage length]
|
||||||
select: NO];
|
select: NO];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) moveToEndOfDocumentAndModifySelection: (id)sender
|
||||||
|
{
|
||||||
|
[self _moveTo: [_textStorage length]
|
||||||
|
select:YES];
|
||||||
|
}
|
||||||
|
|
||||||
- (void) moveToBeginningOfParagraph: (id)sender
|
- (void) moveToBeginningOfParagraph: (id)sender
|
||||||
{
|
{
|
||||||
NSRange aRange;
|
NSRange aRange;
|
||||||
|
@ -959,7 +980,17 @@ check if there was a reason for that.
|
||||||
select: NO];
|
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;
|
NSRange aRange;
|
||||||
unsigned newLocation;
|
unsigned newLocation;
|
||||||
|
@ -1010,9 +1041,18 @@ check if there was a reason for that.
|
||||||
}
|
}
|
||||||
|
|
||||||
[self _moveTo: newLocation
|
[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
|
/* TODO: this is only the beginning and end of lines if lines are horizontal
|
||||||
and layout is left-to-right */
|
and layout is left-to-right */
|
||||||
|
@ -1022,6 +1062,14 @@ and layout is left-to-right */
|
||||||
distance: 1e8
|
distance: 1e8
|
||||||
select: NO];
|
select: NO];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) moveToBeginningOfLineAndModifySelection: (id)sender
|
||||||
|
{
|
||||||
|
[self _move: GSInsertionPointMoveLeft
|
||||||
|
distance: 1e8
|
||||||
|
select: YES];
|
||||||
|
}
|
||||||
|
|
||||||
- (void) moveToEndOfLine: (id)sender
|
- (void) moveToEndOfLine: (id)sender
|
||||||
{
|
{
|
||||||
[self _move: GSInsertionPointMoveRight
|
[self _move: GSInsertionPointMoveRight
|
||||||
|
@ -1029,13 +1077,20 @@ and layout is left-to-right */
|
||||||
select: NO];
|
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
|
* Tries to move the selection/insertion point down one page of the
|
||||||
* visible rect in the receiver while trying to maintain the
|
* visible rect in the receiver while trying to maintain the
|
||||||
* horizontal position of the last vertical movement.
|
* horizontal position of the last vertical movement.
|
||||||
* If the receiver is a field editor, this method returns immediatly.
|
* 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 scrollDelta;
|
||||||
float oldOriginY;
|
float oldOriginY;
|
||||||
|
@ -1051,17 +1106,23 @@ and layout is left-to-right */
|
||||||
|
|
||||||
if (scrollDelta == 0)
|
if (scrollDelta == 0)
|
||||||
{
|
{
|
||||||
/* TODO/FIXME: If no scroll was done, it means we are in the
|
[self _moveTo:[_textStorage length] select:flag];
|
||||||
* last page of the document already - should we move the
|
|
||||||
* insertion point to the last line when the user clicks
|
|
||||||
* 'PageDown' in that case ?
|
|
||||||
*/
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
[self _move: GSInsertionPointMoveDown
|
[self _move: GSInsertionPointMoveDown
|
||||||
distance: scrollDelta
|
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.
|
* horizontal position of the last vertical movement.
|
||||||
* If the receiver is a field editor, this method returns immediatly.
|
* 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 scrollDelta;
|
||||||
float oldOriginY;
|
float oldOriginY;
|
||||||
|
@ -1086,18 +1147,23 @@ and layout is left-to-right */
|
||||||
|
|
||||||
if (scrollDelta == 0)
|
if (scrollDelta == 0)
|
||||||
{
|
{
|
||||||
/* TODO/FIXME: If no scroll was done, it means we are in the
|
[self _moveTo:0 select:flag];
|
||||||
* first page of the document already - should we move the
|
return;
|
||||||
* insertion point to the first line when the user clicks
|
|
||||||
* 'PageUp' in that case ?
|
|
||||||
*/
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[self _move: GSInsertionPointMoveUp
|
[self _move: GSInsertionPointMoveUp
|
||||||
distance: -scrollDelta
|
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
|
- (void) scrollLineDown: (id)sender
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue