Skip to content

Commit

Permalink
fix: line parsing for empty columns
Browse files Browse the repository at this point in the history
  • Loading branch information
stevearc committed Nov 5, 2023
1 parent 57db10d commit 0715f1b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lua/oil/columns.lua
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,9 @@ end
M.parse_col = function(adapter, line, col_def)
local name, conf = util.split_config(col_def)
-- If rendering failed, there will just be a "-"
if vim.startswith(line, "- ") then
return nil, line:sub(3)
local empty_col, rem = line:match("^(-%s+)(.*)$")
if empty_col then
return nil, rem
end
local column = M.get_column(adapter, name)
if column then
Expand Down
2 changes: 1 addition & 1 deletion lua/oil/mutator/parser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ M.parse_line = function(adapter, line, column_defs)
local range = { start }
local start_len = string.len(rem)
value, rem = columns.parse_col(adapter, rem, def)
if not value or not rem then
if not rem then
return nil, string.format("Parsing %s failed", name)
end
ret[name] = value
Expand Down

0 comments on commit 0715f1b

Please sign in to comment.