Skip to content

Commit

Permalink
localize unpack
Browse files Browse the repository at this point in the history
  • Loading branch information
Tieske committed May 7, 2024
1 parent c8a2d1d commit 1d64b57
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions system/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ do
local left_over_key
local sequence -- table to store the sequence in progress
local utf8_length -- length of utf8 sequence currently being processed
local unpack = unpack or table.unpack

-- Reads a single key, if it is the start of ansi escape sequence then it reads
-- the full sequence.
Expand Down Expand Up @@ -320,7 +321,7 @@ do

if #sequence == utf8_length then
-- end of sequence, return the full sequence
local result = string.char((unpack or table.unpack)(sequence))
local result = string.char(unpack(sequence))
sequence = nil
utf8_length = nil
return result, "char"
Expand All @@ -339,15 +340,15 @@ do

if (key >= 65 and key <= 90) or (key >= 97 and key <= 126) then
-- end of sequence, return the full sequence
local result = string.char((unpack or table.unpack)(sequence))
local result = string.char(unpack(sequence))
sequence = nil
return result, "ansi"
end
end
end

-- error, or timeout reached, return the sequence so far
local partial = string.char((unpack or table.unpack)(sequence))
local partial = string.char(unpack(sequence))
return nil, err, partial
end
end
Expand Down

0 comments on commit 1d64b57

Please sign in to comment.