AutotypeCandidateSelectionWindow now displays username to help distinguish different entries with the same title

This commit is contained in:
Michael Starke
2019-02-06 16:42:47 +01:00
parent 1566ebbc61
commit 6378d4f426

View File

@@ -55,8 +55,8 @@
- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
NSTableCellView *view = [tableView makeViewWithIdentifier:tableColumn.identifier owner:self];
MPAutotypeContext *context = self.candidates[row];
NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@\n%@", context.entry.title, context.command]];
[string setAttributes:@{NSForegroundColorAttributeName: NSColor.disabledControlTextColor} range:NSMakeRange(context.entry.title.length + 1, context.command.length)];
NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@ (%@)\n%@", context.entry.title, context.entry.username, context.command]];
[string setAttributes:@{NSForegroundColorAttributeName: NSColor.disabledControlTextColor} range:NSMakeRange((string.length - context.command.length), context.command.length)];
view.textField.attributedStringValue = string;
view.imageView.image = context.entry.iconImage;
return view;