diff --git a/source/funkin/editors/charter/CharterStrumlineScreen.hx b/source/funkin/editors/charter/CharterStrumlineScreen.hx index 56b33e0a..00eea694 100644 --- a/source/funkin/editors/charter/CharterStrumlineScreen.hx +++ b/source/funkin/editors/charter/CharterStrumlineScreen.hx @@ -59,11 +59,12 @@ class CharterStrumlineScreen extends UISubstateWindow { var title:UIText; add(title = new UIText(windowSpr.x + 20, windowSpr.y + 30 + 16, 0, creatingStrumLine ? "Create New Strumline" : "Edit Strumline Properties", 28)); + var charFileList = Character.getList(false); charactersList = new UIButtonList(15, title.y + title.height + 36, 250, 259, "", FlxPoint.get(250, 54), null, 0); - charactersList.addButton.callback = () -> charactersList.add(new CharacterButton(0, 0, "New Char", charactersList)); + charactersList.addButton.callback = () -> charactersList.add(new CharacterButton(0, 0, "New Char", charFileList, charactersList)); charactersList.cameraSpacing = 0; for (i in strumLine.characters) - charactersList.add(new CharacterButton(0, 0, i, charactersList)); + charactersList.add(new CharacterButton(0, 0, i, charFileList, charactersList)); add(charactersList); addLabelOn(charactersList, "Characters"); @@ -162,7 +163,7 @@ class CharacterButton extends UIButton { public var deleteButton:UIButton; public var deleteIcon:FlxSprite; - public function new(x:Float, y:Float, char:String, parent:UIButtonList) { + public function new(x:Float, y:Float, char:String, charsList:Array, parent:UIButtonList) { super(x, y, "", null, 250, 54); autoAlpha = false; @@ -175,7 +176,7 @@ class CharacterButton extends UIButton { members.push(charIcon); members.push(textBox = new UIAutoCompleteTextBox(charIcon.x + charIcon.width + 16, bHeight/2 - (32/2), char, 115)); - textBox.suggestItems = Character.getList(false); + textBox.suggestItems = charsList; textBox.antialiasing = true; textBox.onChange = function(char:String) { char = Character.getIconFromCharName(char); diff --git a/source/funkin/editors/ui/UIAutoCompleteTextBox.hx b/source/funkin/editors/ui/UIAutoCompleteTextBox.hx index c2cb4f73..8686bd31 100644 --- a/source/funkin/editors/ui/UIAutoCompleteTextBox.hx +++ b/source/funkin/editors/ui/UIAutoCompleteTextBox.hx @@ -66,6 +66,7 @@ class UIAutoCompleteTextBox extends UITextBox { //for(i in suggestItems) if(!_suggestions.contains(i) && i.contains(text)) _suggestions.push(i); _suggestions.remove(text); } + _suggestions.sort(function(a, b) return a.length - b.length); } if(suggestionText.visible = (_suggestions.length != 0)) {