Migrate to Lua 5.4
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
local bit = {}
|
||||
|
||||
local LUA_NBITS = 32
|
||||
local ALLONES = (~(((~0) << (LUA_NBITS - 1)) << 1))
|
||||
|
||||
local function trim(x)
|
||||
return (x & ALLONES)
|
||||
end
|
||||
|
||||
local function mask(n)
|
||||
return (~((ALLONES << 1) << ((n) - 1)))
|
||||
end
|
||||
|
||||
function bit.extract(n, field, width)
|
||||
local r = trim(field)
|
||||
local f = width
|
||||
r = (r >> f) & mask(width)
|
||||
return r
|
||||
end
|
||||
|
||||
function bit.replace(n, v, field, width)
|
||||
local r = trim(v);
|
||||
local v = trim(field);
|
||||
local f = width
|
||||
local m = mask(width);
|
||||
r = (r & ~(m << f)) | ((v & m) << f);
|
||||
return r
|
||||
end
|
||||
|
||||
return bit
|
||||
@@ -55,7 +55,7 @@ end
|
||||
local function find(label, search_fn)
|
||||
last_view, last_sel = core.active_view,
|
||||
{ core.active_view.doc:get_selection() }
|
||||
local text = last_view.doc:get_text(unpack(last_sel))
|
||||
local text = last_view.doc:get_text(table.unpack(last_sel))
|
||||
found_expression = false
|
||||
|
||||
core.command_view:set_text(text, true)
|
||||
|
||||
@@ -42,7 +42,7 @@ end
|
||||
|
||||
|
||||
function common.distance(x1, y1, x2, y2)
|
||||
return math.sqrt(math.pow(x2-x1, 2)+math.pow(y2-y1, 2))
|
||||
return math.sqrt(((x2-x1) ^ 2)+((y2-y1) ^ 2))
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ function StatusView:get_items()
|
||||
col > config.line_limit and style.accent or style.text, "col: ", col,
|
||||
style.text,
|
||||
self.separator,
|
||||
string.format("%d%%", line / #dv.doc.lines * 100),
|
||||
string.format("%.f%%", line / #dv.doc.lines * 100),
|
||||
}, {
|
||||
style.text, indent_label, indent_size,
|
||||
style.dim, self.separator2, style.text,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
local syntax = require "core.syntax"
|
||||
local common = require "core.common"
|
||||
local bit32 = require "core.bit"
|
||||
|
||||
local tokenizer = {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user