Definition
-- @/lua/ge/extensions/ui/console.lua:429
function ConsoleInputCallback(data)
--log('D', 'console', '>>> inputCallback 1 - ' .. dumps(data) .. ' / ' .. tostring(#history))
if data.EventFlag == im.InputTextFlags_CallbackHistory then
local prevHistoryPos = historyPos
if data.EventKey == im.Key_UpArrow then
--print("UP")
historyPos = historyPos - 1
if historyPos < 1 then
if loopHistory[0] or historyPos<0 then
historyPos = #history
else
historyPos = 1
end
end
--log('D', 'console', 'up prev=' .. dumps(prevHistoryPos) .. ' pos=' .. dumps(historyPos))
elseif data.EventKey == im.Key_DownArrow then
--print("DOWN")
historyPos = historyPos + 1
if historyPos > #history then
if loopHistory[0] then
historyPos = 1
else
historyPos = #history
end
end
if prevHistoryPos == -1 then historyPos = 1 end
--log('D', 'console', 'dw prev=' .. dumps(prevHistoryPos) .. ' pos=' .. dumps(historyPos))
end
if #history > 0 and prevHistoryPos ~= historyPos then
local t = history[historyPos]
if type(t) ~= "string" then
log("E","inputCallback", "history is corrupted (not str)")
return 0 -- im.Int(0)
end
local inplen = string.len(t)
local inplenInt = inplen
data.Buf = t
data.CursorPos = inplenInt
data.SelectionStart = inplenInt
data.SelectionEnd = inplenInt
data.BufTextLen = inplenInt
data.BufDirty = true
end
-- elseif data.EventFlag == im.InputTextFlags_CallbackCharFilter then
-- print(data.EventChar)
elseif data.EventFlag == im.InputTextFlags_CallbackCharFilter and data.EventChar == 96 then --96 = '`'
hide()
return 1 --im.Int(1)
end
return 0 --im.Int(0)
end
Callers