mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-01 16:51:56 +00:00
Keep track of the original index of a sequence of moves in one dimension. Pass it to the layout manager when moving the insertion point to prevent drifting.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@15956 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
1ae44e7270
commit
174f81dd1e
4 changed files with 77 additions and 25 deletions
|
@ -23,6 +23,9 @@
|
|||
Author: Pierre-Yves Rivaille <pyrivail@ens-lyon.fr>
|
||||
Date: September 2002
|
||||
|
||||
Extensive reworking: Alexander Malmberg <alexander@malmberg.org>
|
||||
Date: December 2002 - February 2003
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
|
@ -711,6 +714,8 @@ to this method from the text container or layout manager.
|
|||
_layoutManager->_selected_range = NSMakeRange(0,0);
|
||||
}
|
||||
|
||||
_currentInsertionPointMovementDirection = 0;
|
||||
|
||||
[self _updateMultipleTextViews];
|
||||
}
|
||||
|
||||
|
@ -2610,6 +2615,14 @@ afterString in order over charRange.
|
|||
/* Set the new selected range */
|
||||
_layoutManager->_selected_range = charRange;
|
||||
|
||||
/* Clear the remembered position and direction for insertion point
|
||||
movement.
|
||||
|
||||
Note that we must _not_ clear the index. Many movement actions will
|
||||
reset the direction to a valid value, and they assume that the index
|
||||
remains unchanged here. */
|
||||
_currentInsertionPointMovementDirection = 0;
|
||||
|
||||
/* TODO: when and if to restart timer <and where to stop it before> */
|
||||
[self updateInsertionPointStateAndRestartTimer: !stillSelectingFlag];
|
||||
|
||||
|
|
|
@ -22,6 +22,9 @@
|
|||
Author: Pierre-Yves Rivaille <pyrivail@ens-lyon.fr>
|
||||
Date: September 2002
|
||||
|
||||
Extensive reworking: Alexander Malmberg <alexander@malmberg.org>
|
||||
Date: December 2002 - February 2003
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
|
@ -723,14 +726,40 @@ added to the selection (1,3).
|
|||
select: (BOOL)select
|
||||
{
|
||||
unsigned int cindex;
|
||||
int new_direction;
|
||||
|
||||
if (direction == GSInsertionPointMoveUp ||
|
||||
direction == GSInsertionPointMoveDown)
|
||||
{
|
||||
new_direction = 2;
|
||||
}
|
||||
else if (direction == GSInsertionPointMoveLeft ||
|
||||
direction == GSInsertionPointMoveRight)
|
||||
{
|
||||
new_direction = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
new_direction = 0;
|
||||
}
|
||||
|
||||
cindex = [self _movementOrigin];
|
||||
if (new_direction != _currentInsertionPointMovementDirection ||
|
||||
!new_direction)
|
||||
{
|
||||
_originalInsertionPointCharacterIndex = cindex;
|
||||
}
|
||||
|
||||
|
||||
cindex = [_layoutManager characterIndexMoving: direction
|
||||
fromCharacterIndex: cindex
|
||||
originalCharacterIndex: cindex /* TODO */
|
||||
originalCharacterIndex: _originalInsertionPointCharacterIndex
|
||||
distance: distance];
|
||||
[self _moveTo: cindex
|
||||
select: select];
|
||||
/* Setting the selected range will clear out the current direction, but
|
||||
not the index. Thus, we always set the direction here. */
|
||||
_currentInsertionPointMovementDirection = new_direction;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue