Support working with array as object value for our select base name cell

This is for the new file browser which uses array to be able to hold both a display and edit name for the items being shown and potentially edited.
This commit is contained in:
Allan Odgaard
2018-10-27 23:23:38 +07:00
parent a304ebe25f
commit f2f9eceed4

View File

@@ -108,7 +108,10 @@
@implementation OakSelectBasenameCell
- (void)selectWithFrame:(NSRect)aRect inView:(NSView*)aView editor:(NSText*)aText delegate:(id)someDelegate start:(NSInteger)start length:(NSInteger)length
{
NSString* basename = [self.stringValue stringByDeletingPathExtension];
NSString* path = self.stringValue;
if([self.objectValue respondsToSelector:@selector(firstObject)])
path = [self.objectValue firstObject];
NSString* basename = [path stringByDeletingPathExtension];
[super selectWithFrame:aRect inView:aView editor:aText delegate:someDelegate start:start length:(start == 0 && basename ? MIN(basename.length, length) : length)];
}
@end