replace unpack() with table.unpack()
I have no idea unpack() is still used and how it still worked.
This commit is contained in:
parent
ccba91261d
commit
30ccde896d
|
@ -36,7 +36,7 @@ local function update_preview(sel, search_fn, text)
|
||||||
last_view:scroll_to_line(line2, true)
|
last_view:scroll_to_line(line2, true)
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
last_view.doc:set_selection(unpack(sel))
|
last_view.doc:set_selection(table.unpack(sel))
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -44,7 +44,7 @@ end
|
||||||
local function find(label, search_fn)
|
local function find(label, search_fn)
|
||||||
last_view, last_sel, last_finds = core.active_view,
|
last_view, last_sel, last_finds = core.active_view,
|
||||||
{ core.active_view.doc:get_selection() }, {}
|
{ core.active_view.doc:get_selection() }, {}
|
||||||
local text, found = last_view.doc:get_text(unpack(last_sel)), false
|
local text, found = last_view.doc:get_text(table.unpack(last_sel)), false
|
||||||
|
|
||||||
core.command_view:set_text(text, true)
|
core.command_view:set_text(text, true)
|
||||||
core.status_view:show_tooltip(get_find_tooltip())
|
core.status_view:show_tooltip(get_find_tooltip())
|
||||||
|
@ -55,8 +55,8 @@ local function find(label, search_fn)
|
||||||
last_fn, last_text = search_fn, text
|
last_fn, last_text = search_fn, text
|
||||||
else
|
else
|
||||||
core.error("Couldn't find %q", text)
|
core.error("Couldn't find %q", text)
|
||||||
last_view.doc:set_selection(unpack(last_sel))
|
last_view.doc:set_selection(table.unpack(last_sel))
|
||||||
last_view:scroll_to_make_visible(unpack(last_sel))
|
last_view:scroll_to_make_visible(table.unpack(last_sel))
|
||||||
end
|
end
|
||||||
end, function(text)
|
end, function(text)
|
||||||
found = update_preview(last_sel, search_fn, text)
|
found = update_preview(last_sel, search_fn, text)
|
||||||
|
@ -64,8 +64,8 @@ local function find(label, search_fn)
|
||||||
end, function(explicit)
|
end, function(explicit)
|
||||||
core.status_view:remove_tooltip()
|
core.status_view:remove_tooltip()
|
||||||
if explicit then
|
if explicit then
|
||||||
last_view.doc:set_selection(unpack(last_sel))
|
last_view.doc:set_selection(table.unpack(last_sel))
|
||||||
last_view:scroll_to_make_visible(unpack(last_sel))
|
last_view:scroll_to_make_visible(table.unpack(last_sel))
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
|
@ -198,9 +198,9 @@ local function selection_iterator(invariant, idx)
|
||||||
local target = invariant[3] and (idx*4 - 7) or (idx*4 + 1)
|
local target = invariant[3] and (idx*4 - 7) or (idx*4 + 1)
|
||||||
if target > #invariant[1] or target <= 0 or (type(invariant[3]) == "number" and invariant[3] ~= idx - 1) then return end
|
if target > #invariant[1] or target <= 0 or (type(invariant[3]) == "number" and invariant[3] ~= idx - 1) then return end
|
||||||
if invariant[2] then
|
if invariant[2] then
|
||||||
return idx+(invariant[3] and -1 or 1), sort_positions(unpack(invariant[1], target, target+4))
|
return idx+(invariant[3] and -1 or 1), sort_positions(table.unpack(invariant[1], target, target+4))
|
||||||
else
|
else
|
||||||
return idx+(invariant[3] and -1 or 1), unpack(invariant[1], target, target+4)
|
return idx+(invariant[3] and -1 or 1), table.unpack(invariant[1], target, target+4)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -301,7 +301,7 @@ local function pop_undo(self, undo_stack, redo_stack, modified)
|
||||||
local line1, col1, line2, col2 = table.unpack(cmd)
|
local line1, col1, line2, col2 = table.unpack(cmd)
|
||||||
self:raw_remove(line1, col1, line2, col2, redo_stack, cmd.time)
|
self:raw_remove(line1, col1, line2, col2, redo_stack, cmd.time)
|
||||||
elseif cmd.type == "selection" then
|
elseif cmd.type == "selection" then
|
||||||
self.selections = { unpack(cmd) }
|
self.selections = { table.unpack(cmd) }
|
||||||
end
|
end
|
||||||
|
|
||||||
modified = modified or (cmd.type ~= "selection")
|
modified = modified or (cmd.type ~= "selection")
|
||||||
|
@ -335,7 +335,7 @@ function Doc:raw_insert(line, col, text, undo_stack, time)
|
||||||
|
|
||||||
-- push undo
|
-- push undo
|
||||||
local line2, col2 = self:position_offset(line, col, #text)
|
local line2, col2 = self:position_offset(line, col, #text)
|
||||||
push_undo(undo_stack, time, "selection", unpack(self.selections))
|
push_undo(undo_stack, time, "selection", table.unpack(self.selections))
|
||||||
push_undo(undo_stack, time, "remove", line, col, line2, col2)
|
push_undo(undo_stack, time, "remove", line, col, line2, col2)
|
||||||
|
|
||||||
-- update highlighter and assure selection is in bounds
|
-- update highlighter and assure selection is in bounds
|
||||||
|
@ -347,7 +347,7 @@ end
|
||||||
function Doc:raw_remove(line1, col1, line2, col2, undo_stack, time)
|
function Doc:raw_remove(line1, col1, line2, col2, undo_stack, time)
|
||||||
-- push undo
|
-- push undo
|
||||||
local text = self:get_text(line1, col1, line2, col2)
|
local text = self:get_text(line1, col1, line2, col2)
|
||||||
push_undo(undo_stack, time, "selection", unpack(self.selections))
|
push_undo(undo_stack, time, "selection", table.unpack(self.selections))
|
||||||
push_undo(undo_stack, time, "insert", line1, col1, text)
|
push_undo(undo_stack, time, "insert", line1, col1, text)
|
||||||
|
|
||||||
-- get line content before/after removed text
|
-- get line content before/after removed text
|
||||||
|
|
|
@ -155,7 +155,7 @@ function tokenizer.tokenize(incoming_syntax, text, state)
|
||||||
if count % 2 == 0 then break end
|
if count % 2 == 0 then break end
|
||||||
end
|
end
|
||||||
until not res[1] or not close or not target[3]
|
until not res[1] or not close or not target[3]
|
||||||
return unpack(res)
|
return table.unpack(res)
|
||||||
end
|
end
|
||||||
|
|
||||||
while i <= #text do
|
while i <= #text do
|
||||||
|
|
Loading…
Reference in New Issue