openstreetmap / merkaartor

Home of Merkaartor, an openstreetmap mapping program.
http://merkaartor.be/
Other
290 stars 79 forks source link

Autocompletion bugs #276

Open fkv1 opened 1 year ago

fkv1 commented 1 year ago

Autocompletion of key names has 3 serious bugs:

1) Key names are suggested that are already used on the object.

2) When I misspell a key name and then correct it, the misspelled name is still used for autocompletion. It should be removed from the set of suggested keys as soon as there are no more instances. A more general and useful approach is to always suggest the tag with the most instances (in the download/edit layers) of all that start with the typed in string.

3) When I type in some characters and the autocomplete suggestion is not what I want, I use the cursor-down or cursur-up keys to switch to another suggestion. (E.g. I type in "addr", and the autocomplete suggestion is "addr:city", but I want "addr:housenumber".) But the typed in characters are ignored and in fact overwritten by a random other suggestion. This is wrong. Cursor up/down should cycle through matching key names only, and they should be displayed in the same way as the initial suggestion, i.e. the suggested continuation (the characters behind the typed in characters) should be preselected (usually with blue background, but this may depend on system settings) so they can be manually overridden by simply typing in more characters.

Krakonos commented 2 days ago

Well, I did a bit of digging and instead of solutions, i found more:

  1. Loading a saved document does not restore the autocompletion.

The issue in in how the autocompletion is handled. I'm not sure of the reasons for the optimization (it's way before my time), there is a separate index for autocompletion purposes. I think I'll just try to rewrite it to walk all the objects and gather the tags. It might not be that bad - and if it is, I can definitely walk all the objects currently displayed and only do autocompletion on these. That might be an OK compromise, as I agree that the current state is pretty much broken.

Anyway, see PR #305 for a potential fix to 3. It does duplicate the combobox function a little bit but I think it's OK.