mirror of
https://github.com/evennia/evennia.git
synced 2026-03-28 10:37:16 +01:00
Further fuzzy matching improvement, with integer list selection of multiple matches.
This uses exact-match-first fuzzy matching as discussed in previous commits. It also use the match order to present a list of options to narrow the selection down - the user can then specify the choice by appending the correct number to the query. Example: objects: [box,box]; searching for "box" gives a multiple match error, which presents a list looking like "1-box, 2-box". The user can now just write "2-box" to choose the second box. Showing dbrefs is perhaps even more universal, but revealing the underlying data structure to the normal user is not really good practice - dbrefs is only something builders and admins should have to know about ... (IMHO). /Griatch
This commit is contained in:
parent
2aae4a0105
commit
41365074fd
2 changed files with 147 additions and 92 deletions
|
|
@ -180,9 +180,9 @@ class Object(models.Model):
|
|||
limit_types=limit_types)
|
||||
|
||||
if len(results) > 1:
|
||||
emit_to_obj.emit_to("More than one match found (please narrow target):")
|
||||
for result in results:
|
||||
emit_to_obj.emit_to(" %s" % (result.get_name(),))
|
||||
emit_to_obj.emit_to("More than one match for '%s' (please narrow target):" % ostring)
|
||||
for num, result in enumerate(results):
|
||||
emit_to_obj.emit_to(" %i-%s" % (num+1,result.get_name(show_dbref=False)))
|
||||
return False
|
||||
elif len(results) == 0:
|
||||
emit_to_obj.emit_to("I don't see that here.")
|
||||
|
|
@ -952,9 +952,6 @@ class Object(models.Model):
|
|||
|
||||
NOTE: A 'name' can be a dbref or the actual name of the object. See
|
||||
dbref_match for an exclusively name-based match.
|
||||
|
||||
The fuzzy match gives precedence to exact matches by raising the
|
||||
UniqueMatch Exception.
|
||||
"""
|
||||
|
||||
if util_object.is_dbref(oname):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue