Skip to content

Commit

Permalink
Another minor tweak to avoid nil indent arithmetic...
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian committed Dec 19, 2024
1 parent 4fa5e3e commit e5b541d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lua/lean/indent.lua
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,17 @@ function M.indentexpr(linenr)
return math.max(0, sorry - shiftwidth - 1)
end

local _, last_indent = last:find '^%s+'
local _, last_indent = last:find '^%s*'

if is_enclosed(linenr - 1, 0) then
if is_enclosed(linenr - 2, 0) then
return last_indent
end
return (last_indent or 0) + shiftwidth
return last_indent + shiftwidth
end

if INDENT_AFTER:match_str(last) then
return (last_indent or 0) + shiftwidth
return last_indent + shiftwidth
end

if focuses_at(last, last_indent + 1) then
Expand Down

0 comments on commit e5b541d

Please sign in to comment.