File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -122,18 +122,19 @@ local function fixWrongIndent(state, change)
122122 local position = guide .positionOf (change .range .start .line , change .range .start .character )
123123 local row = guide .rowColOf (position )
124124 local myIndent = getIndent (state , row + 1 )
125- local lastIndent = getIndent (state , row )
126- if # myIndent <= # lastIndent then
125+ local lastOffset = lookBackward . findAnyOffset (state . lua , guide . positionToOffset ( state , position ) )
126+ if not lastOffset then
127127 return
128128 end
129- if not util .stringStartWith (myIndent , lastIndent ) then
129+ local lastPosition = guide .offsetToPosition (state , lastOffset )
130+ local lastRow = guide .rowColOf (lastPosition )
131+ local lastIndent = getIndent (state , lastRow )
132+ if # myIndent <= # lastIndent then
130133 return
131134 end
132- local lastOffset = lookBackward .findAnyOffset (state .lua , guide .positionToOffset (state , position ))
133- if not lastOffset then
135+ if not util .stringStartWith (myIndent , lastIndent ) then
134136 return
135137 end
136- local lastPosition = guide .offsetToPosition (state , lastOffset )
137138 if isInBlock (state , lastPosition ) then
138139 return
139140 end
You can’t perform that action at this time.
0 commit comments