chore: run stylua
This commit is contained in:
+11
-11
@@ -30,7 +30,7 @@ local state = {
|
|||||||
---@return string
|
---@return string
|
||||||
local function strip_ansi(text)
|
local function strip_ansi(text)
|
||||||
local result =
|
local result =
|
||||||
text:gsub("\x1b%[%??[0-9;]*[a-zA-Z]", ""):gsub("\x1b%][0-9;]*.-(\x1b\\|\x07)", ""):gsub("\x1b[()][0-9A-Za-z]", "")
|
text:gsub("\x1b%[%??[0-9;]*[a-zA-Z]", ""):gsub("\x1b%][0-9;]*.-(\x1b\\|\x07)", ""):gsub("\x1b[()][0-9A-Za-z]", "")
|
||||||
|
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
@@ -46,7 +46,7 @@ local function normalize_output(text)
|
|||||||
|
|
||||||
text = text:gsub("\r\n", "\n")
|
text = text:gsub("\r\n", "\n")
|
||||||
text =
|
text =
|
||||||
text:gsub("\x1b%[%??[0-9;]*[a-zA-Z]", ""):gsub("\x1b%][0-9;]*.-(\x1b\\|\x07)", ""):gsub("\x1b[()][0-9A-Za-z]", "")
|
text:gsub("\x1b%[%??[0-9;]*[a-zA-Z]", ""):gsub("\x1b%][0-9;]*.-(\x1b\\|\x07)", ""):gsub("\x1b[()][0-9A-Za-z]", "")
|
||||||
|
|
||||||
local start_cr = text:len() > 0 and text:byte(1) == 0x0D
|
local start_cr = text:len() > 0 and text:byte(1) == 0x0D
|
||||||
|
|
||||||
@@ -80,17 +80,17 @@ end
|
|||||||
---@param line string
|
---@param line string
|
||||||
local function apply_highlights(buf, line_idx, line)
|
local function apply_highlights(buf, line_idx, line)
|
||||||
for _, p in ipairs({
|
for _, p in ipairs({
|
||||||
{ p = "[Ee][Rr][Rr][Oo][Rr]", h = "DiagnosticError" },
|
{ p = "[Ee][Rr][Rr][Oo][Rr]", h = "DiagnosticError" },
|
||||||
{ p = "[Ff][Aa][Ii][Ll][Ee][Dd]?", h = "DiagnosticError" },
|
{ p = "[Ff][Aa][Ii][Ll][Ee][Dd]?", h = "DiagnosticError" },
|
||||||
{ p = "[Ee][Rr][Rr]!", h = "DiagnosticError" },
|
{ p = "[Ee][Rr][Rr]!", h = "DiagnosticError" },
|
||||||
{ p = "[Ff][Aa][Tt][Aa][Ll]", h = "DiagnosticError" },
|
{ p = "[Ff][Aa][Tt][Aa][Ll]", h = "DiagnosticError" },
|
||||||
{ p = "[Ww][Aa][Rr][Nn][Ii][Nn][Gg]", h = "DiagnosticWarn" },
|
{ p = "[Ww][Aa][Rr][Nn][Ii][Nn][Gg]", h = "DiagnosticWarn" },
|
||||||
{ p = "[Ww][Aa][Rr][Nn]!", h = "DiagnosticWarn" },
|
{ p = "[Ww][Aa][Rr][Nn]!", h = "DiagnosticWarn" },
|
||||||
{ p = "[Ss][Uu][Cc][Cc][Ee][Ss][Ss]", h = "DiagnosticOk" },
|
{ p = "[Ss][Uu][Cc][Cc][Ee][Ss][Ss]", h = "DiagnosticOk" },
|
||||||
{ p = "[Pp][Aa][Ss][Ss][Ee][Dd]", h = "DiagnosticOk" },
|
{ p = "[Pp][Aa][Ss][Ss][Ee][Dd]", h = "DiagnosticOk" },
|
||||||
{ p = "%^%d+ .-[Ss]ucceed", h = "DiagnosticOk" },
|
{ p = "%^%d+ .-[Ss]ucceed", h = "DiagnosticOk" },
|
||||||
{ p = "%[ok%]", h = "DiagnosticOk" },
|
{ p = "%[ok%]", h = "DiagnosticOk" },
|
||||||
{ p = "[Oo][Kk]!", h = "DiagnosticOk" },
|
{ p = "[Oo][Kk]!", h = "DiagnosticOk" },
|
||||||
}) do
|
}) do
|
||||||
local s, e = line:find(p.p)
|
local s, e = line:find(p.p)
|
||||||
|
|
||||||
|
|||||||
@@ -223,7 +223,6 @@ describe("watchexec runner", function()
|
|||||||
assert.is_false(overwrite)
|
assert.is_false(overwrite)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
it("does not detect overwrite on CRLF that starts with \\r", function()
|
it("does not detect overwrite on CRLF that starts with \\r", function()
|
||||||
local _, overwrite = runner._normalize_output("\r\nxyz")
|
local _, overwrite = runner._normalize_output("\r\nxyz")
|
||||||
|
|
||||||
|
|||||||
@@ -304,7 +304,7 @@ describe("watchexec window", function()
|
|||||||
local buf = window.get_buf()
|
local buf = window.get_buf()
|
||||||
local maps = vim.api.nvim_buf_get_keymap(buf, "n")
|
local maps = vim.api.nvim_buf_get_keymap(buf, "n")
|
||||||
local found = false
|
local found = false
|
||||||
|
|
||||||
for _, m in ipairs(maps) do
|
for _, m in ipairs(maps) do
|
||||||
if m.lhs == "<Esc>" then
|
if m.lhs == "<Esc>" then
|
||||||
found = true
|
found = true
|
||||||
|
|||||||
Reference in New Issue
Block a user