Validate input Unicode codepoint
This commit is contained in:
parent
a3054bd45a
commit
3879d90b50
|
@ -123,7 +123,12 @@ local commands = {
|
||||||
["doc:type-unicode"] = function()
|
["doc:type-unicode"] = function()
|
||||||
core.command_view:enter("Unicode code point", function(text)
|
core.command_view:enter("Unicode code point", function(text)
|
||||||
-- It is possible both HEX and DEC, tonumber will converts
|
-- It is possible both HEX and DEC, tonumber will converts
|
||||||
doc():text_input(common.codepoint_to_utf8(tonumber(text)))
|
local number = tonumber(text)
|
||||||
|
if number ~= nil then
|
||||||
|
doc():text_input(common.codepoint_to_utf8(number))
|
||||||
|
else
|
||||||
|
core.error("Wrong Unicode codepoint")
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
core.command_view:set_text("0x")
|
core.command_view:set_text("0x")
|
||||||
end,
|
end,
|
||||||
|
|
Loading…
Reference in New Issue