Conversation
This is because it would be harder to figure out what numerical number to add to the end to differentiate? As I don't see having to re-enter "Skyhunter" a second time if I duplicate the model as an enhancement (let alone anything more complex naming). If so, I get it, but it certainly isn't an enhancement. |
Well I thought it would be better than having multiple models all with the same name; but yes it would be better to try and append a unique number to the current name. If there is no space for a unique number would it be better to fall back to the default name or truncate the current name to make room? |
I am in full agreement on that! but yes it would be better to try and append a unique number to the current name.
The easy option is to fall back, but truncation preserves as much of the original name as possible. It may even be worth considering splitting that behaviour out of this PR, as ideally you want bw and colorlcd to behave the same way, so may require changes there to keep from introducing diverging behaviours (in a PR ostensibly focused on colorlcd refactor)? |
The issue with B&W is the model duplication is done by just physically copying the model yaml file. |
e4f6bee to
a556d72
Compare
|
Updated to try and generate a unique name from the current name by appending a number as "(x)" to the current name. |
093b64e to
11d1363
Compare
|
Couple of things:
Claude is moaning about a off by one error, which will occur if someone is daft enough to duplicate a model with 12 character name more than 9 times... but it is still a off by one error regardless 🤷
Added some more unit tests... they should fail until some of those regressions / edge cases are fixed. Let me know if any were over-eager or wrong. Only two are testing against new behaviours - four of the failures would have passed on the prior API - RejectedLabelDoesNotMakeModelLabelled and UniqueNameTwelveCharNameTenthDuplicate are the new edge case ones. |
|
@pfeerick Are the 'RenameLabelRejectsYamlUnsafeCharacters' and 'RenameLabelTruncatesToLabelLength' tests really needed? |
Rename and select duplicated model. Prevent entry of excluded characters when editing a label.
Tests: - unique-name generation - LabelsMap bookkeeping - rename, remove and move of labels, including save/reload round trips - duplicating a model and patching its header - labels.yml load and save - filtering and sorting
dd8b329 to
d216bb6
Compare
|
@pfeerick The issues should be fixed. I've also fixed a number of issues with the maximum length of labels for a model in both companion and firmware. |
Refactor:
Enhancements: