Skip to content

Commit

Permalink
fix: handle files with newlines in the name (#534)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevearc committed Dec 10, 2024
1 parent 7a55ede commit dba0375
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lua/oil/mutator/confirmation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ M.show = vim.schedule_wrap(function(actions, should_confirm, cb)
else
line = adapter.render_action(action)
end
-- We can't handle lines with newlines in them
line = line:gsub("\n", "")
table.insert(lines, line)
local line_width = vim.api.nvim_strwidth(line)
if line_width > max_line_width then
Expand Down
2 changes: 2 additions & 0 deletions lua/oil/view.lua
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,8 @@ M.format_entry_cols = function(entry, column_defs, col_width, adapter, is_hidden
if meta and meta.display_name then
name = meta.display_name
end
-- We can't handle newlines in filenames (and shame on you for doing that)
name = name:gsub("\n", "")
-- First put the unique ID
local cols = {}
local id_key = cache.format_id(entry[FIELD_ID])
Expand Down

0 comments on commit dba0375

Please sign in to comment.