(-keyDown:): When the user selects a cell by typing a partial name, make sure all other cells are deselected.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@19090 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Alexander Malmberg 2004-04-13 22:42:30 +00:00
parent f7d73e0eca
commit 3b4a1570d4
2 changed files with 33 additions and 19 deletions

View file

@ -2254,10 +2254,11 @@ static NSTextFieldCell *titleCell;
NSMatrix *matrix;
NSString *sv;
int i, n, s;
int match;
int selectedColumn;
SEL lcarcSel = @selector(loadedCellAtRow:column:);
IMP lcarc = [self methodForSelector: lcarcSel];
selectedColumn = [self selectedColumn];
if(selectedColumn != -1)
{
@ -2290,7 +2291,7 @@ static NSTextFieldCell *titleCell;
RETAIN(_charBuffer);
}
}
_alphaNumericalLastColumn = selectedColumn;
_lastKeyPressed = [theEvent timestamp];
@ -2300,35 +2301,42 @@ static NSTextFieldCell *titleCell;
if (([sv length] > 0)
&& ([sv hasPrefix: _charBuffer]))
return;
for (i = s+1; i < n; i++)
match = -1;
for (i = s + 1; i < n; i++)
{
sv = [((*lcarc)(self, lcarcSel, i, selectedColumn))
stringValue];
if (([sv length] > 0)
&& ([sv hasPrefix: _charBuffer]))
{
[self selectRow: i
inColumn: selectedColumn];
[matrix scrollCellToVisibleAtRow: i column: 0];
[matrix performClick: self];
return;
match = i;
break;
}
}
for (i = 0; i < s; i++)
if (i == n)
{
sv = [((*lcarc)(self, lcarcSel, i, selectedColumn))
stringValue];
if (([sv length] > 0)
&& ([sv hasPrefix: _charBuffer]))
for (i = 0; i < s; i++)
{
[self selectRow: i
inColumn: selectedColumn];
[matrix scrollCellToVisibleAtRow: i column: 0];
[matrix performClick: self];
return;
sv = [((*lcarc)(self, lcarcSel, i, selectedColumn))
stringValue];
if (([sv length] > 0)
&& ([sv hasPrefix: _charBuffer]))
{
match = i;
break;
}
}
}
if (match != -1)
{
[matrix deselectAllCells];
[self selectRow: match
inColumn: selectedColumn];
[matrix scrollCellToVisibleAtRow: match column: 0];
[matrix performClick: self];
return;
}
}
_lastKeyPressed = 0.;
}