Merge pull request #781 from Jan200101/PR/lua54

Migrate to Lua 5.4
This commit is contained in:
Adam
2022-01-08 12:11:48 -05:00
committed by GitHub
12 changed files with 98 additions and 56 deletions
+30
View File
@@ -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
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
View File
@@ -1,5 +1,6 @@
local syntax = require "core.syntax"
local common = require "core.common"
local bit32 = require "core.bit"
local tokenizer = {}
+1 -1
View File
@@ -176,7 +176,7 @@ function ResultsView:draw()
local text
if self.searching then
if files_number then
text = string.format("Searching %d%% (%d of %d files, %d matches) for %q...",
text = string.format("Searching %.f%% (%d of %d files, %d matches) for %q...",
per * 100, self.last_file_idx, files_number,
#self.results, self.query)
else