(-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

@ -1,3 +1,9 @@
2004-04-14 00:36 Alexander Malmberg <alexander@malmberg.org>
* Source/NSBrowser.m (-keyDown:): When the user selects a cell
by typing a partial name, make sure all other cells are
deselected.
2004-04-13 Quentin Mathe <qmathe@club-internet.fr> 2004-04-13 Quentin Mathe <qmathe@club-internet.fr>
* Source/NSToolbarItem.m: * Source/NSToolbarItem.m:

View file

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