View Single Post
09/09/18, 01:20 AM   #13
Phuein
 
Phuein's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 132
Just tested it thoroughly.

Apparently SetMaxInputChars() does NOT work with counting unicode wide characters, as #string does. I propose that this is a bug that should be fixed in the game.

I implemented my own counter and tested it. Everything seems okay. 2,000 characters does NOT save, but 1,999 does. I limited to 1,900 just in case.

Code:
local textLen = #text
if textLen > 1900 then
	NBUI.NB1SavePage_Button:SetHidden(true)
end
NBUI.NBUI_NB1RightPage_CharacterCounter:SetText(textLen .. ' / ' .. 1900)
Btw, max displayed (at all, in element, on screen) characters (non-unicode) count is about 3,600 - more will vanish! Bug? Maybe. I implemented a display limit with SetMaxInputChars(3000) to play it safe.