-
-
Notifications
You must be signed in to change notification settings - Fork 896
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
Feature: Town name filtering #6983
Conversation
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 for your contribution! Overall it looks good, there's a few things you should change, mostly cosmetic.
You also need to change the commit message to follow the scheme used, always starting with a keyword (like Add, Change, Fix), a colon, and then the message. Do this with a commit amend in Git, and force-push your branch. (Amending and force-pushing is often frowned upon, but necessary in this case. Github handles it correctly and updates the PR.)
@nielsmh Thanks for your kind comments. I've corrected, is it okay? |
I don't have anything more for now. Will find time to test it later :) |
Thanks for the PR. |
@J0anJosep Thanks for your notice, I committed, is it right? |
You'll want to rebase & force-push to merge the commits together, but that's the right idea |
It looks nice. However the sorting doesn't seem to be stable even when I do not change input into the search box (anymore). The resulting list flickers and changes order randomly for me. That doesn't happen with the full list where the entries immediately follow eachother. I currently can only speculate as to the reasons: I assume a sub-list is generated from the whole list - and display sometimes happens before sorting, but after generation of the sub-list - but most times it happens correctly after sub-list generation and its sorting. Looks to me you already consider only re-generating the list, when the input field actually changed, though. Honestly I'm not sure whether this, my observation, is beyond the scope of this patch which just makes use of the existing sort framework. I lean toward "out-of-scope" - yet this makes a bug or race condition visible. |
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.
As per @planetmaker's comments
@planetmaker Thanks for your comment, even though I cannot understand 100% what you're meant to because of my lack of english/coding skills. |
It's my first OpenTTD PR, and please let you know I'm very new to c++ and openttd's codes.
I referenced this code from town_gui.cpp and other's PR and it works, but very strangely.
So please advice your enhanced code, and you can ignore/edit this commit.
This allows filtering town names like below: