Changing BundleItemChooser’s hasSelection property now update item names

The items can be named “Do something with «unit» / Selection” and TextMate will show the proper title based on whether or not there is a selection, e.g. “Diff ▸ Document With Clipboard” versus “Diff ▸ Selection With Clipboard”.

Previously though, the item titles were not re-generated when changing the hasSelection property, so the user could be presented with stale titles until some other action triggered re-generation, e.g. indicating that an adaptive item works on current line when there is a selection.
This commit is contained in:
Allan Odgaard
2019-07-04 10:50:31 +02:00
parent dc47206829
commit 91d7aecf1b

View File

@@ -694,6 +694,16 @@ static std::vector<bundles::item_ptr> relevant_items_in_scope (scope::context_t
[self updateItems:self];
}
- (void)setHasSelection:(BOOL)flag
{
if(_hasSelection != flag)
{
_hasSelection = flag;
_unfilteredItems = nil;
[self updateItems:self];
}
}
- (void)setKeyEquivalentString:(NSString*)aString
{
if([_keyEquivalentString isEqualToString:aString])