[MIRROR] tgui input list improvements (#6405)

* tgui input list improvements (#59668)

pressing enter or space now selects the selected button
duplicate keys no longer cause input lists to break

* tgui input list improvements

Co-authored-by: LatteKat <56778689+jupyterkat@users.noreply.github.com>
This commit is contained in:
SkyratBot
2021-06-20 15:08:42 +01:00
committed by GitHub
co-authored by LatteKat
parent 32f6ee93d3
commit c27ff0647e
2 changed files with 12 additions and 5 deletions
+4
View File
@@ -82,6 +82,7 @@
src.message = message
src.buttons = list()
src.buttons_map = list()
var/list/repeat_buttons = list()
// Gets rid of illegal characters
var/static/regex/whitelistedWords = regex(@{"([^\u0020-\u8000]+)"})
@@ -89,6 +90,9 @@
for(var/i in buttons)
var/string_key = whitelistedWords.Replace("[i]", "")
//avoids duplicated keys E.g: when areas have the same name
string_key = avoid_assoc_duplicate_keys(string_key, repeat_buttons)
src.buttons += string_key
src.buttons_map[string_key] = i