Skip to content
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

The name disappears after entering a dash #7536

Closed
maro-21 opened this issue Apr 25, 2020 · 4 comments
Closed

The name disappears after entering a dash #7536

maro-21 opened this issue Apr 25, 2020 · 4 comments
Assignees
Labels
bug A bug - let's fix this! field An issue with a field in the user interface
Milestone

Comments

@maro-21
Copy link

maro-21 commented Apr 25, 2020

I wanted to change the name of a bus stop:

volvo1

What I wanted to do was change the hyphen to the dash in the name:

volvo2

No matter what I do or where I click, the name after the dash disappears and only "Volvo" remains:

volvo3

I can edit the name only in All Tags section.

@bhousel
Copy link
Member

bhousel commented Apr 25, 2020

Thanks for reporting @maro-21 .. The endash is used as special separator character in the name dropdown for a few old reasons. Name suggestion presets sometimes need to disambiguate between several choices like “7-Eleven – Fuel” and “7-Eleven – Convenience Store”. Because names can have hyphens in them and the dropdown control only lets us work with a single text value, and the preset part of the name needs to be localized, we are using the endash as a separator.

It would be ideal if you can use a different separator character in your bus stop names. For example, it’s common in places like Belgium to represent multilingual names like “French - Dutch” with a standard hyphen between.

@1ec5
Copy link
Collaborator

1ec5 commented Apr 25, 2020

Looks like this bug only occurs if there are spaces surrounding the en dash, possibly due to that conflict with the name suggestion feature mentioned above, but it occurs even if there’s no name suggestion preset.

// NOTE: split on en-dash, not a hypen (to avoid conflict with hyphenated names)
var names = _presets.length === 1 ? _presets[0].name().split(' – ') : [t('inspector.multiple_types')];

Assuming it is due to the name suggestion preset feature, could that feature format the disambiguators differently? Some languages, such as Chinese, use en dashes in everyday usage and don’t consider hyphens to be a substitute.

name-suggestion-index already uses parentheses to disambiguate identically tagged presets in different countries. But there are other options for disambiguating tags that would be less likely to conflict with things users may be in the habit of entering manually; possibilities include a swung dash (⁓), bullet (•), or square brackets ([…]).

@bhousel
Copy link
Member

bhousel commented Apr 25, 2020

We could probably delimit on some nonprintable Unicode characters in the string to avoid the issue. The important thing is that the decorated string looks normal to the user and to html, because it will appear in dropdowns, preset labels, etc, and we will have to find it later to remove the decoration.

@quincylvania quincylvania added bug A bug - let's fix this! field An issue with a field in the user interface labels Sep 28, 2020
@quincylvania quincylvania self-assigned this Sep 28, 2020
@quincylvania quincylvania added this to the 2.19.0 milestone Sep 28, 2020
@quincylvania
Copy link
Collaborator

I ended up making name() only the brand name and added the parent preset name as a separate subtitle() property. The en dashes are still used for suggestion display, but no longer factor into the name value and thus don't need to be discarded. This seems cleaner and avoid bugs like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug - let's fix this! field An issue with a field in the user interface
Projects
None yet
Development

No branches or pull requests

4 participants