-
-
Notifications
You must be signed in to change notification settings - Fork 347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle searches for labels with spaces #3374
Conversation
Works perfectly. At some point we might want to prevent people from creating labels that only differ in whitespace, but that's not urgent. One other minor thing: We could change the label behavior with something like this: else if (TryPrefix(s, Properties.Resources.ModSearchLabelPrefix, out string labelName))
{
var matchingLabels = knownLabels.Where(lb => lb.Name.Replace(" ", "") == labelName).ToList();
if (!matchingLabels.Any())
{
// Label doesn't exist, still apply it to filter to ensure no mod is shown
matchingLabels.Add(new ModuleLabel{ Name = labelName });
}
labels.AddRange(matchingLabels);
} This might also better match the "inverse of getCombined". |
Maybe they have a reason for doing that, though? It's so unlikely to happen by accident through normal usage (users will pick meaningful names for labels, and creating two labels that mean the same thing would be confusing). Someone would have to know what they were doing and want the effects of it somehow. I'll have a think about whether searching for a non-existent tag or label should return everything or nothing. There are reasons for each... |
1eb0b0b
to
69fb1b3
Compare
OK, I agree. A temporary |
But I want to try using |
69fb1b3
to
0ea5384
Compare
I agree that it's unlikely, but I could see a user making heavy use of the label feature to have a long list of labels, and missing/forgetting that they already have one with this name. If they enter the same name they get an error, if they differ with a space somewhere it is accepted. But that's not something we need to decide now, just a non-critical edge case we might want to look at in the future.
Aha! That was the one I couldn't find anymore. I knew there was some Linq function for this, just couldn't remember it... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Let's hope that's it for v1.30.2
Hmm, true. I think the label editor sorts alphabetically by label name, though, so the error should at least be quickly apparent, if it's an error.
Unfortunately it creates the default object every time (but |
Very elegant solution, I like it. Something to keep in mind indeed. |
Problem
You can't search for a label with a space in its name.
Cause
We use spaces to split up search terms.
Changes
label:Label with a space
becomeslabel:Labelwithaspace