local function k(k)local a=""local P=k.suggestionLabels["\076\097\098\101\108"..k.suggestionPos]if k.specificArg then a=P.Name.." "k.textBox.Text=a;(coroutine.wrap(function()for a=1,10,1 do k.textBox:ReleaseFocus()wait()end end))()wait()k.textBox.Text=a else local z={}local S=-1 local B=string.sub(k.textBox.Text,1,1)k.textBox.Text:gsub("\040\091\094"..(main.pdata.SplitKey.."\093\043\041"),function(k)S=S+1 if S>P.ArgPos-1 then return end table.insert(z,k.." ")end)if S==0 and(B==main.settings.UniversalPrefix or B==main.pdata.Prefix)then a=B end a=a..table.concat(z,"")a=a..P.Name a=a..main.pdata.SplitKey k.textBox.Text=a wait()k.textBox.Text=a k.textBox:CaptureFocus()k.textBox.CursorPosition=#a+1 end end

local function selectSuggestion(props)
	local newInput = ""
	local suggestion = props.suggestionLabels["Label"..props.suggestionPos]
	if props.specificArg then
		newInput = suggestion.Name.." "
		--
		props.textBox.Text = newInput
		coroutine.wrap(function()
			for i = 1,10 do
				props.textBox:ReleaseFocus()
				wait()
			end
		end)()
		wait()
		props.textBox.Text = newInput
	else
		local newInputTable = {}
		local argPosCount = -1
		local firstChar = string.sub(props.textBox.Text,1,1)
		props.textBox.Text:gsub('([^'..main.pdata.SplitKey..']+)',function(c) argPosCount = argPosCount + 1 if argPosCount > suggestion.ArgPos-1 then return end table.insert(newInputTable, c.." ") end);
		if argPosCount == 0 and (firstChar == main.settings.UniversalPrefix or firstChar == main.pdata.Prefix) then
			newInput = firstChar
		end
		newInput = newInput..table.concat(newInputTable, "")
		newInput = newInput..suggestion.Name
		newInput = newInput..main.pdata.SplitKey
		--
		props.textBox.Text = newInput
		wait()
		props.textBox.Text = newInput
		props.textBox:CaptureFocus()
		props.textBox.CursorPosition = #newInput+1
	end
end


