Skip to content

Commit

Permalink
Indent to parent when barfing
Browse files Browse the repository at this point in the history
  • Loading branch information
julienvincent committed Aug 20, 2023
1 parent e803160 commit 41e68d8
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lua/nvim-paredit/indentation/native.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,16 @@ function indent_barf(operation)
return
end

local form_edges = operation.lang.get_form_edges(operation.parent)
local delta = child_range[2] - form_edges.left.range[2]
local lang = operation.lang
local parent = lang.get_node_root(operation.parent):parent()

local delta
if parent:type() == "source" then
delta = child_range[2]
else
local form_edges = operation.lang.get_form_edges(parent)
delta = child_range[2] - form_edges.left.range[2] - 1
end

if delta == 0 then
return
Expand Down

0 comments on commit 41e68d8

Please sign in to comment.