Fix #134092: Keymap Editor can add an extra . to the end of an attribute

This happened for context attributes if already "complete" attributes
were typed/pasted in.

Reason is that this copies functionality from our intellisense
codecompletion where this is expected behavior, for context attributes
we cannot really use "tab" to expand, so it is less useful here.

When confirming (with the additional "."), the keymap entry would be
broken, so better solve in a way that we dont end up with those "." by
removing it.

NOTE: there might be ways to enhance the string-search behavior here (by
properly supporting "tab-expanding"), but this is a bit out-of-scope for
this bugfix.

Pull Request: https://projects.blender.org/blender/blender/pulls/135098
This commit is contained in:
Philipp Oeser
2025-02-26 09:12:28 +01:00
committed by Philipp Oeser
parent 78b54dd6d5
commit 138ede7194

View File

@@ -46,7 +46,8 @@ def _rna_path_prop_search_for_context_impl(context, edit_text, unique_attrs):
".bl_rna", ".rna_type",
)):
continue
attr_full = prefix + attr.lstrip()
# If we type/paste in complete attributes, intellisense expands with a ".", remove that again (see #134092)
attr_full = (prefix + attr.lstrip()).removesuffix(".")
if attr_full in unique_attrs:
continue
unique_attrs.add(attr_full)