mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
Avoid clash with NSCell’s keyEquivalent property
The rationale for the ‘string’ suffix is that our properties are things to be displayed rather than behavioral properties.
This commit is contained in:
@@ -301,8 +301,8 @@ static std::vector<bundles::item_ptr> relevant_items_in_scope (scope::context_t
|
||||
return;
|
||||
|
||||
BundleItemChooserItem* entry = self.items[rowIndex];
|
||||
cell.keyEquivalent = [NSString stringWithCxxString:key_equivalent(entry.item)];
|
||||
cell.tabTrigger = [NSString stringWithCxxString:entry.item->value_for_field(bundles::kFieldTabTrigger)];
|
||||
cell.keyEquivalentString = [NSString stringWithCxxString:key_equivalent(entry.item)];
|
||||
cell.tabTriggerString = [NSString stringWithCxxString:entry.item->value_for_field(bundles::kFieldTabTrigger)];
|
||||
}
|
||||
|
||||
- (void)updateItems:(id)sender
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
@interface OakBundleItemCell : NSTextFieldCell
|
||||
@property (nonatomic) NSString* keyEquivalent;
|
||||
@property (nonatomic) NSString* tabTrigger;
|
||||
@property (nonatomic) NSString* keyEquivalentString;
|
||||
@property (nonatomic) NSString* tabTriggerString;
|
||||
@property (nonatomic) NSAttributedString* attributedTabTrigger;
|
||||
@end
|
||||
|
||||
@@ -8,17 +8,17 @@
|
||||
- (id)copyWithZone:(NSZone*)zone
|
||||
{
|
||||
OakBundleItemCell* cell = [super copyWithZone:zone];
|
||||
cell.keyEquivalent = [self.keyEquivalent copy];
|
||||
cell.keyEquivalentString = [self.keyEquivalentString copy];
|
||||
cell.attributedTabTrigger = [self.attributedTabTrigger copy];
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (NSString*)tabTrigger
|
||||
- (NSString*)tabTriggerString
|
||||
{
|
||||
return self.attributedTabTrigger.string;
|
||||
}
|
||||
|
||||
- (void)setTabTrigger:(NSString*)tabTrigger
|
||||
- (void)setTabTriggerString:(NSString*)tabTrigger
|
||||
{
|
||||
self.attributedTabTrigger = tabTrigger ? [[NSAttributedString alloc] initWithString:tabTrigger attributes:nil] : nil;
|
||||
}
|
||||
@@ -58,10 +58,10 @@
|
||||
|
||||
CFRelease(str);
|
||||
}
|
||||
else if(OakNotEmptyString(self.keyEquivalent))
|
||||
else if(OakNotEmptyString(self.keyEquivalentString))
|
||||
{
|
||||
size_t keyStartsAt = 0;
|
||||
std::string const glyphString = ns::glyphs_for_event_string(to_s(self.keyEquivalent), &keyStartsAt);
|
||||
std::string const glyphString = ns::glyphs_for_event_string(to_s(self.keyEquivalentString), &keyStartsAt);
|
||||
NSString* modifiers = [NSString stringWithCxxString:glyphString.substr(0, keyStartsAt)];
|
||||
NSString* key = [NSString stringWithCxxString:glyphString.substr(keyStartsAt)];
|
||||
|
||||
@@ -101,8 +101,8 @@
|
||||
|
||||
if(OakNotEmptyString(self.attributedTabTrigger.string))
|
||||
[value appendFormat:@", tab trigger is %@", self.attributedTabTrigger.string];
|
||||
if(OakNotEmptyString(self.keyEquivalent))
|
||||
[value appendFormat:@", shortcut is %@", [NSString stringWithCxxString:ns::glyphs_for_event_string(to_s(self.keyEquivalent))]];
|
||||
if(OakNotEmptyString(self.keyEquivalentString))
|
||||
[value appendFormat:@", shortcut is %@", [NSString stringWithCxxString:ns::glyphs_for_event_string(to_s(self.keyEquivalentString))]];
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user